Skip to content

[Instruction Executor] Allow joint and pose targets for all motion functions - #491

Merged
urfeex merged 34 commits into
UniversalRobots:masterfrom
urfeex:more_motion_target_interfaces
May 7, 2026
Merged

[Instruction Executor] Allow joint and pose targets for all motion functions#491
urfeex merged 34 commits into
UniversalRobots:masterfrom
urfeex:more_motion_target_interfaces

Conversation

@urfeex

@urfeex urfeex commented Apr 24, 2026

Copy link
Copy Markdown
Member

All script functions interfaced through the InstructionExecutor allow their targets to be either defined as joint array or as poses. This change makes the same interface available on the c++ Instruction executor. See the example for different calls.

I fixed a mismatch in the trajectory interface wire protocol in the movec command. There, acceleration and velocity were mixed up between the c++ sender and the urscript. I went with the order as it was documented in the protocol descroption, which is velocity first, acceleration second. However, all other motion commands use acceleration first, velocity second. Since mixing them up was clearly a bug, I think it would also be fine breaking the documentation and changing this to acceleration first, as all the others. What is your opinion on this @urrsk?


Note

Medium Risk
Updates the trajectory wire protocol handling and bundled external_control.urscript for new motion-type variants and q_near hints; mistakes here can break robot motion execution or change kinematics behavior. Changes are fairly broad across motion primitives, encoding, and tests but include extensive test coverage updates.

Overview
Adds mixed joint-space and Cartesian targets across all InstructionExecutor motion APIs. Introduces strong types urcl::Q and urcl::MotionTarget (Q|Pose) plus new InstructionExecutor/Move*Primitive overloads so callers can explicitly choose joint vs pose targets (including mixed moveC via/target combinations) while preserving legacy brace-init behavior.

Extends motion encoding/decoding end-to-end. Adds new MotionType variants (e.g., MOVEJ_POSE, MOVEL_JOINT, OPTIMOVEL_JOINT, MOVEC_*) and updates TrajectoryPointInterface packing to flatten MotionTarget, propagate optional Pose::q_near hints, and align the on-wire field meanings (including fixing MOVEC velocity/acceleration ordering).

Updates robot-side script + docs/tests/examples. resources/external_control.urscript now interprets the new motion types (IK/FK behaviors and optional q_near seed), documentation describes the revised protocol/overloads, examples demonstrate usage, and new/updated GTests cover the new types and wire round-trips. Also adds portable URCL_SILENCE_DEPRECATED_* macros and uses them to suppress deprecation warnings in implementation/tests.

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

@urfeex
urfeex requested a review from urrsk April 24, 2026 14:01
@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.96403% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.69%. Comparing base (01cf607) to head (3616b95).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/control/motion_primitives.cpp 97.10% 2 Missing and 3 partials ⚠️
src/types.cpp 92.85% 1 Missing and 2 partials ⚠️
...lude/ur_client_library/control/motion_primitives.h 84.61% 1 Missing and 1 partial ⚠️
include/ur_client_library/types.h 0.00% 0 Missing and 2 partials ⚠️
src/ur/ur_driver.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #491      +/-   ##
==========================================
- Coverage   76.91%   76.69%   -0.23%     
==========================================
  Files         113      114       +1     
  Lines        6048     6251     +203     
  Branches     2640     2732      +92     
==========================================
+ Hits         4652     4794     +142     
- Misses       1060     1110      +50     
- Partials      336      347      +11     
Flag Coverage Δ
python_scripts 75.90% <ø> (ø)
start_ursim 82.48% <ø> (-2.56%) ⬇️
ur20-latest 73.02% <94.96%> (+0.71%) ⬆️
ur5-3.14.3 ?
ur5e-10.11.0 66.98% <94.96%> (+0.75%) ⬆️
ur5e-10.12.0 68.00% <94.96%> (+0.70%) ⬆️
ur5e-10.7.0 66.33% <94.96%> (+0.98%) ⬆️
ur5e-5.9.4 73.61% <94.96%> (+0.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@urfeex
urfeex marked this pull request as draft April 27, 2026 05:05
@urfeex
urfeex marked this pull request as ready for review April 27, 2026 07:23
@urfeex
urfeex force-pushed the more_motion_target_interfaces branch from 76cc550 to 151a5a3 Compare April 27, 2026 07:24
Comment thread doc/architecture/instruction_executor.rst Outdated
Comment thread doc/architecture/trajectory_point_interface.rst Outdated
Comment thread include/ur_client_library/types.h Outdated
urfeex and others added 2 commits May 4, 2026 12:02
Co-authored-by: Rune Søe-Knudsen <41109954+urrsk@users.noreply.github.com>
Comment thread resources/external_control.urscript
@urfeex
urfeex force-pushed the more_motion_target_interfaces branch from cd6ad52 to d8e3824 Compare May 4, 2026 15:32
@urfeex
urfeex force-pushed the more_motion_target_interfaces branch from d4996d9 to b0fed74 Compare May 4, 2026 18:51
Comment thread resources/external_control.urscript
@urfeex
urfeex requested a review from urrsk May 4, 2026 19:38
Comment thread resources/external_control.urscript Outdated
Comment thread resources/external_control.urscript
Comment thread resources/external_control.urscript Outdated
Comment on lines +692 to +697
if has_qnear:
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], second_block)
else:
target_q = get_inverse_kin(p[q[0], q[1], q[2], q[3], q[4], q[5]], get_target_joint_positions())
end
optimovej(target_q, a = acceleration, v = velocity, r = blend_radius)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my comment regarding inverse_kin and movej

@urrsk

urrsk commented May 5, 2026

Copy link
Copy Markdown
Member
  • Please add a test that also uses the pose variant with q_near in the constructor

Comment thread include/ur_client_library/types.h Outdated
* Unlike raw initializer lists (``{...}``) which may bind to either \ref vector6d_t or
* \ref Pose, wrapping values in ``urcl::Q{...}`` always forces a joint-target interpretation.
*/
struct Q

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggest changing Q to a class and add set and get function just like Pose

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pose isn't a class either and doesn't have get functions. But I can definitively make Q a class and protect the data member.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I made Pose also a class, which should be fine from an API stability standpoint, as long as we leave the x,y,z,rx,ry,rz members public.

urfeex and others added 3 commits May 5, 2026 11:30
Co-authored-by: Rune Søe-Knudsen <41109954+urrsk@users.noreply.github.com>
Comment thread src/types.cpp
@urfeex
urfeex force-pushed the more_motion_target_interfaces branch from c056349 to af4f7f0 Compare May 6, 2026 07:54

@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 mode and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit af4f7f0. Configure here.

Comment thread src/control/motion_primitives.cpp
@urfeex
urfeex requested a review from urrsk May 6, 2026 08:20
Since the via_point is set in the initializer list already, and
setTarget handles all recomputation, we can skip this redundant step.
@urfeex urfeex added the enhancement New feature or request label May 7, 2026
@urfeex
urfeex merged commit 8f35234 into UniversalRobots:master May 7, 2026
29 of 37 checks passed
@urfeex
urfeex deleted the more_motion_target_interfaces branch May 7, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants