@@ -74,16 +74,7 @@ controller_interface::InterfaceConfiguration ScaledJointTrajectoryController::st
7474
7575controller_interface::CallbackReturn ScaledJointTrajectoryController::on_configure (const rclcpp_lifecycle::State& state)
7676{
77- auto update_rate = get_update_rate ();
78-
79- if (update_rate == 0 ) {
80- RCLCPP_WARN (get_node ()->get_logger (), " Controller's update_rate is 0. Please configure a non-zero update_rate for "
81- " the controller to work properly. Falling back to sampling trajectory at "
82- " current_time + last period." );
83- update_period_ = rclcpp::Duration (0 , 0 );
84- } else {
85- update_period_ = rclcpp::Duration (0 , static_cast <uint32_t >(1.0e9 / static_cast <double >(get_update_rate ())));
86- }
77+ update_period_ = rclcpp::Duration (0.0 , static_cast <uint32_t >(1.0e9 / static_cast <double >(get_update_rate ())));
8778
8879 return JointTrajectoryController::on_configure (state);
8980}
@@ -194,10 +185,8 @@ controller_interface::return_type ScaledJointTrajectoryController::update(const
194185 end_segment_itr);
195186 state_desired_.time_from_start = traj_time_ - traj_external_point_ptr_->time_from_start ();
196187
197- // find segment for current timestamp. Look controller period ahead, fallback to last cycle's
198- // period if no update rate is configured.
199- const auto & sample_period = update_period_.seconds () == 0.0 ? period : update_period_;
200- const bool valid_point = traj_external_point_ptr_->sample (traj_time_ + sample_period, interpolation_method_,
188+ // find segment for current timestamp
189+ const bool valid_point = traj_external_point_ptr_->sample (traj_time_ + update_period_, interpolation_method_,
201190 command_next_, start_segment_itr, end_segment_itr);
202191 state_current_.time_from_start = time - traj_external_point_ptr_->time_from_start ();
203192
0 commit comments