Skip to content

Commit

Permalink
Fix createTrajectoryMessage (moveit#3064)
Browse files Browse the repository at this point in the history
* Fix createTrajectoryMessage

Signed-off-by: Paul Gesel <[email protected]>

* Use std::ceil to handle non-aligned sampling_rate

Signed-off-by: Paul Gesel <[email protected]>

---------

Signed-off-by: Paul Gesel <[email protected]>
  • Loading branch information
pac48 authored and dyackzan committed Nov 7, 2024
1 parent b05ab22 commit ee73b10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion moveit_core/trajectory_processing/src/trajectory_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ trajectory_msgs::msg::JointTrajectory createTrajectoryMessage(const std::vector<
}
trajectory_msg.joint_names = joint_names;
const double time_step = 1.0 / static_cast<double>(sampling_rate);
const int n_samples = static_cast<int>(trajectory.getDuration() / time_step) + 1;
const int n_samples = static_cast<int>(std::ceil(trajectory.getDuration() / time_step)) + 1;
trajectory_msg.points.reserve(n_samples);
for (int sample = 0; sample < n_samples; ++sample)
{
Expand Down

0 comments on commit ee73b10

Please sign in to comment.