@@ -213,13 +213,12 @@ controller_interface::return_type JointTrajectoryController::update(
213213 // Adjust time with scaling factor
214214 TimeData time_data;
215215 time_data.time = time;
216- rcl_duration_value_t t_period = (time_data.time - time_data_.readFromRT ()-> time ).nanoseconds ();
216+ rcl_duration_value_t t_period = (time_data.time - time_data_.time ).nanoseconds ();
217217 time_data.period = rclcpp::Duration::from_nanoseconds (t_period) * scaling_factor_;
218- time_data.uptime = time_data_.readFromRT ()-> uptime + time_data.period ;
218+ time_data.uptime = time_data_.uptime + time_data.period ;
219219 rclcpp::Time traj_time =
220- time_data_.readFromRT ()->uptime + rclcpp::Duration::from_nanoseconds (t_period);
221- time_data_.reset ();
222- time_data_.initRT (time_data);
220+ time_data_.uptime + rclcpp::Duration::from_nanoseconds (t_period);
221+ time_data_ = time_data;
223222
224223 bool first_sample = false ;
225224 // if sampling the first time, set the point before you sample
@@ -950,10 +949,9 @@ controller_interface::CallbackReturn JointTrajectoryController::on_activate(
950949 default_tolerances_ = get_segment_tolerances (logger, params_);
951950 // Setup time_data buffer used for scaling
952951 TimeData time_data;
953- time_data.time = get_node ()->now ();
954- time_data.period = rclcpp::Duration::from_nanoseconds (0 );
955- time_data.uptime = get_node ()->now ();
956- time_data_.initRT (time_data);
952+ time_data_.time = get_node ()->now ();
953+ time_data_.period = rclcpp::Duration::from_nanoseconds (0 );
954+ time_data_.uptime = get_node ()->now ();
957955
958956 // order all joints in the storage
959957 for (const auto & interface : params_.command_interfaces )
0 commit comments