Describe the bug
The Joint Trajectory Controller allows velocity-only points in trajectories by filling in the missing positions here:
Sampling within a segment will fill in the positions for this segment's endpoint. So starting from the first, this should fill in the positions for all points sequentially. After the trajectory has played out, the last point will be provided as output_state.
All works well, unless the last segment is skipped for some reason. In my case it happened with a trajectory where the last segment was quite small in duration and sometimes not sampled because of the slow(er) controller rate. In this case, compute_error_for_joint will segfault trying to access the desired state, whose positions have not been filled in.
To Reproduce
Provide a velocity-only trajectory with a very small last segment duration and run it with a relatively larger controller rate.
Expected behavior
Some sort of error handling or check for empty positions. Hard to say at which point of the call stack an intervention could be made to fix the issue. @domire8 has a suggestion of an extra check here to see if the positions are empty and return false, with the drawback being that there is no actual feedback on the failure.
Environment:
Describe the bug
The Joint Trajectory Controller allows velocity-only points in trajectories by filling in the missing positions here:
ros2_controllers/joint_trajectory_controller/src/trajectory.cpp
Line 192 in fafccb5
Sampling within a segment will fill in the positions for this segment's endpoint. So starting from the first, this should fill in the positions for all points sequentially. After the trajectory has played out, the last point will be provided as
output_state.All works well, unless the last segment is skipped for some reason. In my case it happened with a trajectory where the last segment was quite small in duration and sometimes not sampled because of the slow(er) controller rate. In this case,
compute_error_for_jointwill segfault trying to access the desired state, whose positions have not been filled in.To Reproduce
Provide a velocity-only trajectory with a very small last segment duration and run it with a relatively larger controller rate.
Expected behavior
Some sort of error handling or check for empty positions. Hard to say at which point of the call stack an intervention could be made to fix the issue. @domire8 has a suggestion of an extra check here to see if the positions are empty and return
false, with the drawback being that there is no actual feedback on the failure.Environment: