@@ -253,7 +253,16 @@ controller_interface::return_type JointTrajectoryController::update(
253253 bool outside_goal_tolerance = false ;
254254 bool within_goal_time = true ;
255255 const bool before_last_point = end_segment_itr != current_trajectory_->end ();
256- auto active_tol = active_tolerances_.readFromRT ();
256+ auto active_tol_op = goal_tolerances_.try_get ();
257+ if (active_tol_op.has_value ())
258+ {
259+ active_tol_ = active_tol_op.value ();
260+ }
261+ else
262+ {
263+ // fallback if try_get fails
264+ active_tol_ = default_tolerances_;
265+ }
257266
258267 // have we reached the end, are not holding position, and is a timeout configured?
259268 // Check independently of other tolerances
@@ -278,22 +287,22 @@ controller_interface::return_type JointTrajectoryController::update(
278287 if (
279288 (before_last_point || first_sample) && !rt_is_holding_ &&
280289 !check_state_tolerance_per_joint (
281- state_error_, index, active_tol-> state_tolerance [index], true /* show_errors */ ))
290+ state_error_, index, active_tol_. state_tolerance [index], true /* show_errors */ ))
282291 {
283292 tolerance_violated_while_moving = true ;
284293 }
285294 // past the final point, check that we end up inside goal tolerance
286295 if (
287296 !before_last_point && !rt_is_holding_ &&
288297 !check_state_tolerance_per_joint (
289- state_error_, index, active_tol-> goal_state_tolerance [index], false /* show_errors */ ))
298+ state_error_, index, active_tol_. goal_state_tolerance [index], false /* show_errors */ ))
290299 {
291300 outside_goal_tolerance = true ;
292301
293- if (active_tol-> goal_time_tolerance != 0.0 )
302+ if (active_tol_. goal_time_tolerance != 0.0 )
294303 {
295304 // if we exceed goal_time_tolerance set it to aborted
296- if (time_difference > active_tol-> goal_time_tolerance )
305+ if (time_difference > active_tol_. goal_time_tolerance )
297306 {
298307 within_goal_time = false ;
299308 // print once, goal will be aborted afterwards
@@ -925,7 +934,7 @@ controller_interface::CallbackReturn JointTrajectoryController::on_configure(
925934
926935 // parse remaining parameters
927936 default_tolerances_ = get_segment_tolerances (logger, params_);
928- active_tolerances_. initRT (default_tolerances_);
937+ goal_tolerances_. set (default_tolerances_);
929938 const std::string interpolation_string =
930939 get_node ()->get_parameter (" interpolation_method" ).as_string ();
931940 interpolation_method_ = interpolation_methods::from_string (interpolation_string);
@@ -1412,7 +1421,7 @@ void JointTrajectoryController::goal_accepted_callback(
14121421
14131422 // Update tolerances if specified in the goal
14141423 auto logger = this ->get_node ()->get_logger ();
1415- active_tolerances_. writeFromNonRT (get_segment_tolerances (
1424+ goal_tolerances_. set (get_segment_tolerances (
14161425 logger, default_tolerances_, *(goal_handle->get_goal ()), params_.joints ));
14171426
14181427 // Set smartpointer to expire for create_wall_timer to delete previous entry from timer list
0 commit comments