Joint Trajectory Controller with future trajectories

Hello there,

I am using a UR5e robot arm in a telemanipulation scenario. I am currently using the joint trajectory controller as the interface to my model predictive trajectory planner.

Since I want a fixed sample rate, I am planning trajectories, that will start at the beginning of the “next” interval. From my understanding, the joint trajectory controller should be able to handle this case the following way:
The old trajectory is executed until the time stamp of the start of the new trajecotry is reached. From there the controller will follow the new trajectory ( Trajectory Representation — ROS2_Control: Rolling Apr 2024 documentation).

When trying this on the robot, I had strong vibration issues. The following plot shows the (joint trajectory controller) internal desired (red) and measured (green) angles of joint 0. The dotted lines represent the trajectories I sent to the tracking controller (red=newest, blue=last, gray = second last). The blue vertical line is the where the dotted red trajectory was published.

What I observe is, that the internal desired position is set to the current measured value, as soon as the new trajectory is published. What I would expect is, that the internal desired position stays on the blue dotted trajectory until the red dotted trajectory starts.

Am I using the joint trajectory controller in a wrong way, or could this be a bug?

Thanks for any ideas on this!