Skip to content

[JTC] Segfault on skipped last segment #2282

@SprGrf

Description

@SprGrf

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:

  • OS: Ubuntu 24
  • Jazzy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions