Skip to content

feat(robot_driver): add tool GPIO get/set to RobotDriver - #13

Open
erwinkendo wants to merge 1 commit into
MarinhoLab:mainfrom
erwinkendo:feature/tool_gpio
Open

erwinkendo wants to merge 1 commit into
MarinhoLab:mainfrom
erwinkendo:feature/tool_gpio

Conversation

@erwinkendo

Copy link
Copy Markdown

This PR adds a generic interface to RobotDriver for controlling the digital outputs on a robot's tool (wrist) connector.

This functionality was originally developed against SmartArmStack/sas_core. It is ported here because the C++ core now lives in sas_cpp.

Changes

  • include/marinholab/sas/core/sas_robot_driver.hpp
    • New protected member std::array<bool, 2> tool_gpio_{} (value-initialised to {false, false}).
    • New virtual methods get_tool_gpio() and set_tool_gpio(const std::array<bool, 2>&).
    • Added #include <array>.
  • src/sas_robot_driver.cpp
    • Default implementations that store and return tool_gpio_. Concrete drivers override them to command the hardware.
  • examples/sas_robot_driver_example_main.cpp
    • Checks the {false, false} default and a set/get round-trip, throwing on failure, so the check also runs in Release builds. docker/build.sh runs this example, so CI covers it.
  • Contributors sections updated.

Backwards compatibility

The methods are virtual and have default implementations, so existing drivers build and behave exactly as before.

Related PRs

This change is used by follow-up changes on these branches. PRs will be opened once this one is merged and released:

  1. Python bindings: https://github.com/erwinkendo/sas_py/tree/feature/tool_gpio
  2. ROS server/client: https://github.com/erwinkendo/sas_robot_driver/tree/feature/tool_gpio
  3. UR driver: https://github.com/erwinkendo/sas_robot_driver_ur/tree/feature/tool_gpio

PRs 2 and 3 need a libmarinholab-sas-core release that includes this change.

Testing

  • Built with -Wall -Wextra -Wpedantic. No new warnings.
  • sas_robot_driver_example passes the new tool GPIO checks.
  • End-to-end tests were run with https://github.com/erwinkendo/sas_robot_driver_tester, which builds this branch from source together with the sas_robot_driver and sas_robot_driver_ur branches (see PR 4).

Open question

The array size is fixed at 2 to match the UR wrist connector. If you'd prefer to keep this robot-agnostic, I can change it to std::vector<bool> or a template size.

Adds virtual get_tool_gpio()/set_tool_gpio() with default implementations that store and return a std::array<bool, 2> member (value-initialised to {false, false}). Ported from SmartArmStack/sas_core feature/tool_gpio. The sas_robot_driver_example now checks the default value and a set/get round-trip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant