Add set_target_payload support to ScriptCommandInterface#515
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #515 +/- ##
==========================================
- Coverage 78.95% 78.90% -0.05%
==========================================
Files 116 115 -1
Lines 6689 6764 +75
Branches 2953 2986 +33
==========================================
+ Hits 5281 5337 +56
- Misses 1040 1055 +15
- Partials 368 372 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
67d123d to
2d1074a
Compare
urfeex
left a comment
There was a problem hiding this comment.
This is looking clean! I'm only wondering whether we should move the MULT_TIME up to ReverseInterface and re-use that for the transition time. I think, we should do that.
urfeex
left a comment
There was a problem hiding this comment.
Please also add documentation updates to script_command_interface.rst and add a command to the script_command_example,
|
@urfeex Should we put somewhere that setPayload is deprecated? |
I would say let's not add a compile time deprecation. We could print a warning when |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit e067c0c. Configure here.
| {% else %} | ||
| set_payload(mass, cog) | ||
| textmsg("PolyScope < 5.10.0. Inertia and transition_time ignored.") | ||
| {% endif %} |
There was a problem hiding this comment.
Missing PolyScope 3.15 gate
Medium Severity
set_target_payload availability is gated only on PolyScope 5.10+, but the API was also introduced in PolyScope 3.15. On 3.15+ CB3 robots, the script and fallback paths call set_payload instead, so inertia and transition_time from setTargetPayload are dropped while the call still succeeds.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e067c0c. Configure here.
Otherwise this will affect other tests running on the same robot later.


Description
Adds support for the URScript
set_target_payload()command through theScriptCommandInterface, allowing users to set the payload mass, center ofgravity, inertia matrix, and transition time.
This follows the same pattern as the existing
setPayload()implementation.Changes
include/ur_client_library/control/script_command_interface.h: AddedsetTargetPayload()declaration and theSET_TARGET_PAYLOAD = 12enum valueto
ScriptCommand.include/ur_client_library/ur/ur_driver.h: AddedsetTargetPayload()declaration to
UrDriver.src/control/script_command_interface.cpp: ImplementedScriptCommandInterface::setTargetPayload(), encoding mass, CoG (3 values),inertia matrix (6 values), and transition time into the binary message.
src/ur/ur_driver.cpp: ImplementedUrDriver::setTargetPayload().resources/external_control.urscript: AddedSET_TARGET_PAYLOAD = 12constant and the corresponding
elifbranch in thescript_commandsthreadto call
set_target_payload().tests/test_script_command_interface.cpp: Addedtest_set_target_payloadunit test verifying correct encoding of all fields(mass, CoG, inertia, transition time) and that unused message slots are zero.
Message layout for SET_TARGET_PAYLOAD
12)Notes
transition_timedefaults to0.0seconds (no transition).Related issues
UniversalRobots/Universal_Robots_ROS2_Driver#1711
Related PR (ur_ros2_driver): UniversalRobots/Universal_Robots_ROS2_Driver#1808
Tasks
Note
Medium Risk
Changes active payload modeling on the robot (mass, inertia, timed transitions), which affects motion and force behavior; version fallbacks limit inertia on older PolyScope but mass/CoG still apply.
Overview
Adds
setTargetPayload()onUrDriverandScriptCommandInterface, exposing URScriptset_target_payload()(mass, CoG, inertia, transition time) over the existing script-command socket as command 12 (SET_TARGET_PAYLOAD), mirroringsetPayload().The binary path encodes eleven payload fields plus transition time (
MULT_JOINTSTATE/MULT_TIME);external_control.urscriptdecodes them and callsset_target_payload()on PolyScope ≥ 5.10, otherwise falls back toset_payload()and logs that inertia and transition time are ignored.MULT_TIMEis moved toReverseInterface(removed fromTrajectoryPointInterface).Docs, the script-command example, and unit/integration tests cover encoding and driver behavior (connected interface and plain-script fallback).
Reviewed by Cursor Bugbot for commit a86f7b3. Bugbot is set up for automated code reviews on this repo. Configure here.