Skip to content

Commit

Permalink
Verify correct sample index in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertWilbrandt committed Sep 25, 2024
1 parent cbf99af commit 339e36c
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ class Trajectory
JOINT_TRAJECTORY_CONTROLLER_PUBLIC
bool is_sampled_already() const { return sampled_already_; }

/// Get the index of the segment start returned by the last \p sample() operation.
/**
* As the trajectory is only accessed at monotonically increasing sampling times, this index is
* used to speed up the selection of relevant trajectory points.
*/
JOINT_TRAJECTORY_CONTROLLER_PUBLIC
size_t last_sample_index() const { return last_sample_idx_; }

private:
void deduce_from_derivatives(
trajectory_msgs::msg::JointTrajectoryPoint & first_state,
Expand Down
Loading

0 comments on commit 339e36c

Please sign in to comment.