Skip to content

Fix spline point velocity and acceleration precision - #559

Open
s4lmon wants to merge 4 commits into
UniversalRobots:masterfrom
s4lmon:precision_vel_acc
Open

Fix spline point velocity and acceleration precision#559
s4lmon wants to merge 4 commits into
UniversalRobots:masterfrom
s4lmon:precision_vel_acc

Conversation

@s4lmon

@s4lmon s4lmon commented Aug 26, 2026

Copy link
Copy Markdown

The spline vel/acc are quantised at 1e-6 by MULT_JOINTSTATE, so near-zero accelerations reconstruct as jagged profiles. On our UR15 we notice many current compensation errors, that make the arm unusable with the ROS 2 driver.

We have this fix that is working, implementing the same strategy as #482.

We implement a finer dedicated multiplier (MULT_VEL_ACC = 1e8) and an explicit range guard (~21.47 rad/s(²)), analagous to max goal time check. This is backwards compatible.

Credit to Toni Divic for discovering this bug.


Note

Medium Risk
Changes the on-wire encoding for spline vel/acc and requires matching robot script deployment; incorrect pairing would mis-decode trajectories, but non-spline paths are unchanged.

Overview
Spline trajectory points now encode per-sample velocities and accelerations with a dedicated MULT_VEL_ACC (1e8) instead of MULT_JOINTSTATE (1e6). Positions and non-spline motion primitives still use the old multipliers, so the wire layout is unchanged but spline vel/acc get 1e-8 resolution and avoid near-zero values collapsing to zero and producing jagged acceleration profiles that can fault the controller (e.g. current compensation errors on UR15).

The library rejects spline vel/acc whose magnitude exceeds ~21.47 rad/s (²) (MAX_VEL_ACC_), mirroring the existing max goal-time guard. external_control.urscript decodes spline qd/qdd with the injected MULT_velacc, and UrDriver passes VEL_ACC_REPLACE when templating the script. Docs and tests cover the new constant, near-zero roundtrip behavior, and range validation.

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

const int32_t vel_acc_mult = primitive->type == MotionType::SPLINE ? MULT_VEL_ACC : MULT_JOINTSTATE;
write_block(first_block, MULT_JOINTSTATE);
write_block(second_block, vel_acc_mult);
write_block(third_block, vel_acc_mult);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

prefer this but happy to revert for readability

joint-vs-pose interpretation as the target at indices 0-5, see the motion type at
index 20).
- trajectory point velocities (multiplied by ``MULT_JOINTSTATE``) for spline joint types
- trajectory point velocities (multiplied by ``MULT_VEL_ACC``) for spline joint types

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

name ok?

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