Skip to content

kortex_driver: export handles instead of value pointers (ros2_control 6.12) - #431

Open
Tobias-Fischer wants to merge 1 commit into
Kinovarobotics:mainfrom
Tobias-Fischer:ros2-control-6.12-handles
Open

Tobias-Fischer wants to merge 1 commit into
Kinovarobotics:mainfrom
Tobias-Fischer:ros2-control-6.12-handles

Conversation

@Tobias-Fischer

Copy link
Copy Markdown

Fixes #430. ros2_control 6.12 (ros-controls/ros2_control#3610) removed the pointer-based StateInterface/CommandInterface constructors and export_state_interfaces()/export_command_interfaces(), so kortex_driver no longer builds on Rolling.

The port keeps the driver's logic and its interface lists:

  • The former export loops now describe (prefix, name, &member) bindings. Interfaces the URDF declares (per joint: command position, state position/velocity/effort; gripper: command position, state position/velocity) come from the base class. The ones it doesn't (per-joint velocity/effort commands, set_gripper_max_velocity/set_gripper_max_effort, tcp/twist.*, reset_fault/command, reset_fault/async_success, reset_fault/internal_fault) are exported as unlisted interfaces with the same names, all double, so controllers and configurations need no changes.
  • Every member behind an interface is written only by the control loop, so the sync is simple: write() first copies the command handles into the members, read() ends by copying the state members into their handles, and wherever the driver itself resets commands (perform_command_mode_switch, on_activate, the fault reset in write()) it writes the handles too. After export, each command handle starts at its member's initial value (e.g. the gripper's max velocity/effort).
  • Two small fixes on the way: arm_commands_velocities_ is reset with std::fill instead of a six-element literal (which shrank it to six entries on the 7-DoF arm, and the sync loops index every joint), and the reset_fault members are initialised.

Formatted with clang-format 18 (the pre-commit version); no new cppcheck findings.

Tested:

  • Builds against Rolling's hardware_interface 6.12.0 (RoboStack, linux-64), on the 0.2.5 release with the CMake part of Kortex API & Rolling Binary Build Updates #415, which is the same C++ change as this PR; kortex_bringup and kinova_gen3_7dof_robotiq_2f_85_moveit_config build on top.
  • An offline check that loads the real xacro URDFs, runs on_init up to the robot connection, and lists the exported interfaces: for gen3 7-DoF with and without the gripper and gen3 6-DoF, the names and types match exactly what 0.2.5 exported, and the state/command sync works in both directions.
  • Not tested on hardware or through controller_manager; that's the part that needs someone with a robot.

Unrelated, but noticed while testing on Rolling: robotiq_description 0.0.1 rejects the mock_sensor_commands argument that kortex_description passes to the gripper xacro.

🤖 Claude (AI assistant), on behalf of @Tobias-Fischer

🤖 Generated with Claude Code

… 6.12)

ros2_control 6.12 (ros-controls/ros2_control#3610) removed the pointer-based
StateInterface/CommandInterface constructors and export_state_interfaces()/
export_command_interfaces(), so kortex_driver no longer builds on Rolling
(Kinovarobotics#430).

The driver keeps its logic and interface lists: the former export loops now
describe (prefix, name, &member) bindings. The interfaces the URDF declares
come from the base class; the others (per-joint velocity/effort commands,
the gripper's set_gripper_max_velocity/effort, tcp/twist.*, reset_fault/*)
are exported as unlisted interfaces with the same names, all double. Every
member written only by the control loop is mirrored: write() first copies
the command handles into the members, read() ends by copying the state
members into their handles, and wherever the driver itself resets commands
(perform_command_mode_switch, on_activate, the fault reset in write()) it
writes the handles too.

Also: arm_commands_velocities_ is reset with std::fill instead of a
six-element literal (which shrank it to six entries on the 7-DoF arm), and
the reset_fault members are initialised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tobias-Fischer added a commit to RoboStack/robostack that referenced this pull request Oct 19, 2026
…gain [skip ci]

Instead of excluding Kortex on rolling, patch kortex_driver 0.2.5: the CMake
part of Kinovarobotics/ros2_kortex#415 (no ament_target_dependencies in
ament_cmake 2.9) and the handle-based interface export, the same C++ change
as Kinovarobotics/ros2_kortex#431 (sent upstream for #430): unlisted
interfaces for everything the URDF doesn't declare, same names and types,
with the members mirrored around read()/write() and the driver's own
command resets written to the handles.

Built against hardware_interface 6.12.0 on linux-64 with kortex_bringup and
the 7-DoF Gen3 MoveIt config on top; an offline check of the exported
interface names matches 0.2.5's. Not tested on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

kortex_driver: build fails on Rolling with ros2_control 6.12 (pointer-based StateInterface/CommandInterface removed)

1 participant