Stitch Trajectories with Smooth Blending
In many robotics applications — pick-and-place, palletizing, machine tending — the robot must execute a sequence of pre-planned motions back-to-back. Without trajectory blending, the robot comes to a full stop between each trajectory, wasting valuable cycle time. Trajectory stitching with smooth blending eliminates these stops by generating jerk-limited transition segments at each connection point, producing a single continuous trajectory from a sequence of separate ones.
The Problem: Dead Time Between Trajectories
When executing trajectories sequentially without blending, the robot must decelerate to zero velocity at the end of the first trajectory, pause, and then re-accelerate from rest at the start of the next. This introduces a measurable dead time at every connection — time during which the robot is stationary but the application is waiting. For applications with many trajectory segments this compounds into major cycle time losses.
The Solution: Trajectory Blending
BlendJointTrajectories takes a vector of joint trajectories and produces a single blended output trajectory. At each connection point, a smooth transition segment is generated using Ruckig, a jerk-limited trajectory generator that respects the kinematic limits (velocity, acceleration, jerk) of the planning group. The original trajectories are preserved outside the blending regions, so only the immediate neighborhood of each connection point is modified.
How the Blending Radius Works
The blending_radius parameter defines a zone around each connection point measured in joint-space Euclidean distance (radians). Points within the radius zone are replaced by the smooth Ruckig blend segment; points outside the radius zone are kept from the original trajectories unchanged.
A larger radius creates a smoother, more gradual transition but modifies a larger portion of the original path around the connection point. A radius of 0 concatenates the trajectories at the connection point without generating a blend segment.
Using the BlendJointTrajectories Behavior
Add BlendJointTrajectories to your Behavior Tree wherever you need to combine a set of pre-planned trajectories into one smooth motion. The Behavior reads a vector of trajectories from the blackboard, performs blending, and writes the resulting trajectory_msgs::msg::JointTrajectory back to the blackboard for execution.
Tips
- The input trajectories must have position, velocity, and acceleration data on every waypoint. Trajectories that contain only positions will be rejected.
- Use
SaveJointTrajectoryToYamlandLoadJointTrajectoryFromYamlto pre-plan trajectories offline and blend them at runtime, eliminating planning delays during execution. See the Save and Replay Trajectories guide for details. - Enable
retime_after_blendingif you want consistent velocity and acceleration profiles across the entire output trajectory. - Start with the default
blending_radiusof0.1rad and tune based on your application's path accuracy requirements.