Skip to content

Add bindings for RobotDriver tool GPIO methods - #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 exposes the tool GPIO methods added in MarinhoLab/sas_cpp#13 to Python.

Changes

  • src/sas_robot_driver_py.cpp
    • Trampoline overrides for get_tool_gpio() and set_tool_gpio(), so Python subclasses of RobotDriver can implement them. The return type is wrapped in PYBIND11_TYPE(...) because of the comma in std::array<bool, 2>, following the existing get_joint_limits pattern.
    • .defs for both methods.
    • Contributors section updated.
  • marinholab/sas/core/_core.pyi
    • Type stubs: get_tool_gpio() -> list[bool] and set_tool_gpio(tool_gpio: list[bool]) -> None.

Dependencies

Requires MarinhoLab/sas_cpp#. Once that merges, submodules/sas_cpp needs bumping to include it. I can add that commit here, or you can bump it as part of the merge.

Testing

Built against the sas_cpp branch and checked from Python:

  • The base class returns [False, False] by default, and set/get round-trips.
  • A Python subclass that overrides both methods works as expected.
  • A list with the wrong number of elements is rejected with TypeError by pybind11's std::array caster.

Exposes get_tool_gpio()/set_tool_gpio() (added in MarinhoLab/sas_cpp) on RobotDriver, with trampoline overrides so Python subclasses can implement them, and updates the type stubs.
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