Skip to content

Commit c1332c4

Browse files
Felix ExnerRobertWilbrandt
authored andcommitted
Reformat scaling the time period
This avoids writing the explicit conversion by hand Internally that basically does: static_cast<rcl_duration_value_t>(static_cast<long double>(rcl_duration_.nanoseconds) * scale_ld)
1 parent e79862b commit c1332c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

joint_trajectory_controller/src/joint_trajectory_controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ controller_interface::return_type JointTrajectoryController::update(
196196
TimeData time_data;
197197
time_data.time = time;
198198
rcl_duration_value_t t_period = (time_data.time - time_data_.readFromRT()->time).nanoseconds();
199-
time_data.period = rclcpp::Duration::from_nanoseconds(scaling_factor_ * t_period);
199+
time_data.period = rclcpp::Duration::from_nanoseconds(t_period) * scaling_factor_;
200200
time_data.uptime = time_data_.readFromRT()->uptime + time_data.period;
201201
rclcpp::Time traj_time =
202202
time_data_.readFromRT()->uptime + rclcpp::Duration::from_nanoseconds(t_period);

0 commit comments

Comments
 (0)