[JTC] Add spline_upsampling feature for positions-only trajectories (no separate controller) - #2491
Open
vedh1234 wants to merge 19 commits into
Open
[JTC] Add spline_upsampling feature for positions-only trajectories (no separate controller)#2491vedh1234 wants to merge 19 commits into
vedh1234 wants to merge 19 commits into
Conversation
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
github-actions
Bot
requested review from
Maverobot,
bijoua29,
bmagyar,
destogl and
moriarty
July 28, 2026 07:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
spline_upsamplingfeature toJointTrajectoryControllerto upsample sparse, positions-only trajectory chunks into smooth global C2 cubic-spline trajectories.Background:
AI / learned policies (e.g. diffusion policy, ACT) emit action chunks: short
JointTrajectorymessages containing only positions at the policy's output rate (e.g. 10–50 Hz), with no velocities or accelerations. Fed positions-only, JTC interpolates linearly (C0) producing velocity discontinuities and jerk spikes at every knot. This is unsuitable for real hardware.Approach
The controller intercepts incoming
~/joint_trajectorymessages viatopic_callbackand, ifspline_upsampling.enableis true and it receives positions-only chunks:spline_upsampling.policy_frequencyparameter whentime_from_startis absent.fill_cubic_spline_velocities(), an O(n) tridiagonal Thomas solve with rest boundary conditions (v₀ = vₙ₋₁ = 0) and writes them intopoints[i].velocities.Chunks that already carry velocities pass through unchanged, meaning the feature is a strict superset of existing JTC behavior and operates as a safe no-op when disabled.
Is this user-facing behavior change?
Yes, as an opt-in feature. Users can now enable
spline_upsampling.enable(default:false) in their JTC configuration. When enabled, positions-only trajectory messages on the topic interface are automatically upsampled to smooth C2 cubic splines. Thespline_upsampling.policy_frequencyparameter (Hz) controls the synthesised timing for chunks that arrive withouttime_from_start. Existing trajectories with velocities are unaffected, and because it is off by default, there is no breaking change for existing users.Did you use Generative AI?
Yes, Google Gemini and Claude were used to make improvements in manually written code, architectural analysis, edge-case review. All generated code was reviewed, modified, and verified by the author.
Additional Information
Known limitations / future work:
~/joint_trajectory) is upsampled.FollowJointTrajectoryaction goals bypasstopic_callbackand are not upsampled.TODOs
To send us a pull request, please:
colcon testandpre-commit run(requires you to install pre-commit bypip3 install pre-commit)Test Scenario:
Two position only motion profiles were sent on the using the
~/joint_trajectory. As we can see, with upsampling enabled and being C2 continuous, the staircase like discontinuity is not observed in velocity plot in both motion profiles. The sharp corners we observe are due to the lack of cross chunk continuity.