Skip to content

Allow setting payload inertia matrix via set_payload service #1808

Merged
urfeex merged 16 commits into
UniversalRobots:mainfrom
srvald:set_payload_inertia
Jul 9, 2026
Merged

Allow setting payload inertia matrix via set_payload service #1808
urfeex merged 16 commits into
UniversalRobots:mainfrom
srvald:set_payload_inertia

Conversation

@srvald

@srvald srvald commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the driver-side changes to support the extended SetPayload service,
which now accepts a full geometry_msgs/Inertia payload (mass, center of gravity,
and 6-component inertia tensor) and a transition_time field.

This enables use of the robot's set_target_payload(m, cog, inertia, transition_time)
URScript function instead of the simpler set_payload(m, cog) (DEPRECATED).

Note: This PR depends on the updated ur_msgs/SetPayload.srv (ros-industrial/ur_msgs#42) and on the
setTargetPayload() addition to ur_client_library (UniversalRobots/Universal_Robots_Client_Library#515).

Breaking changes

The set_payload service request format changes (driven by the ur_msgs update).
Any existing callers must be updated to use geometry_msgs/Inertia instead of
separate mass and cog fields.

Changes

ur_controllers

  • Added PAYLOAD_INERTIA_IXX/IYY/IZZ/IXY/IXZ/IYZ and PAYLOAD_TRANSITION_TIME
    entries to the CommandInterfaces enum in gpio_controller.hpp
  • Added PAYLOAD_STATE_INERTIA_* entries to the StateInterfaces enum
  • Extended command_interface_configuration() and state_interface_configuration()
    with the new payload interfaces
  • Updated setPayload() callback to pass inertia and transition_time to the
    command interfaces
  • Extended waitForPayloadRtdeMatch() to verify inertia components and to wait
    for transition_time to elapse before checking RTDE feedback

ur_robot_driver

  • Added payload_inertia_, payload_transition_time_ and rtde_payload_inertia_ members to hardware_interface.hpp
  • Added inertia and transition_time command interfaces and payload state interfaces
    (backed by RTDE feedback) to export_state_interfaces() and
    export_command_interfaces() in hardware_interface.cpp
  • Updated checkAsyncIO() to call setTargetPayload() instead of setPayload().
  • Added payload_inertia to rtde_output_recipe.txt
  • Updated ur.ros2_control.xacro with the new payload command and state interfaces
  • Added integration_test_payload.py and registered it in CMakeLists.txt

Test

Open one terminal and launch the ur_ros2_driver by:

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=<robot_type> robot_ip:=<robot_ip>

Then in another terminal execute:

ros2 service call /io_and_status_controller/set_payload ur_msgs/srv/SetPayload '{payload: {m: 0.01, com: {x: 0.2, y: 0.1, z: 0.3}, ixx: 0.01, ixy: 0.0, ixz: 0.03, iyy: 0.01, iyz: 0.02, izz: 0.01}, transition_time: 1.0}'

It will successfully set the new changes.

Design notes

geometry_msgs/Inertia was chosen because it encapsulates mass, center of gravity,
and the full inertia tensor in a single standard ROS type, resulting in a cleaner API.

This is a breaking change: the previous mass (float32) and cog (Vector3) fields
are replaced by geometry_msgs/Inertia payload. A backwards-compatible alternative
would be to keep mass and cog and add individual float64 fields for the inertia
components (ixx, iyy, izz, ixy, ixz, iyz) and transition_time.
If this approach is preferred, then I'll update the implementation, which will mean that the SetPayload.srv will be:

float32 mass  
geometry_msgs/Vector3 cog  
float64 ixx  
float64 iyy  
float64 izz  
float64 ixy  
float64 ixz  
float64 iyz  
float64 transition_time  
---  
bool success  

Related issues

Closes #1711


Note

Medium Risk
Breaking change to a public service API and robot payload configuration path; incorrect inertia or timing could affect motion/dynamics, though changes are localized to set_payload and RTDE verification.

Overview
Extends set_payload to match the updated ur_msgs/SetPayload API: callers must pass geometry_msgs/Inertia (m, com, inertia tensor) and an optional transition_time, instead of separate mass / center_of_gravity fields. Migration notes document the new service call shape for the Maoka release.

The GPIO controller and robot hardware interface now expose inertia and transition_time through ros2_control payload command/state interfaces. RTDE feedback includes payload_inertia, and optional verification compares mass, COG, and all inertia components (waiting out transition_time before checking). The driver invokes setTargetPayload() on the client library rather than the deprecated set_payload URScript path.

Rolling builds pin ur_msgs to rolling-devel. Integration and mock-hardware tests use the new Inertia-based requests and add coverage for inertia, timed transitions, and sequential updates.

Reviewed by Cursor Bugbot for commit 89d8c2b. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread ur_robot_driver/src/hardware_interface.cpp
Comment thread ur_robot_driver/src/hardware_interface.cpp
Comment thread ur_controllers/src/gpio_controller.cpp
Comment thread ur_controllers/include/ur_controllers/gpio_controller.hpp Outdated
@urfeex urfeex added the blocked label Jun 26, 2026
Comment thread ur_controllers/include/ur_controllers/gpio_controller.hpp Outdated
Comment thread ur_controllers/src/gpio_controller.cpp
Comment thread ur_robot_driver/test/integration_test_payload.py Outdated
Comment thread ur_robot_driver/test/integration_test_payload.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 5bfbbb5. Configure here.

Comment thread ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp Outdated
@srvald
srvald requested a review from urfeex July 3, 2026 11:12
@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@urfeex urfeex added the enhancement New feature or request label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish Payload mass, cog and inertial matrix

2 participants