File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
joint_trajectory_controller/src Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,8 @@ controller_interface::return_type JointTrajectoryController::update(
152152 sort_to_local_joint_order (*new_external_msg);
153153 // TODO(denis): Add here integration of position and velocity
154154 traj_external_point_ptr_->update (*new_external_msg);
155+ // set the active trajectory pointer to the new goal
156+ traj_point_active_ptr_ = &traj_external_point_ptr_;
155157 }
156158
157159 // TODO(anyone): can I here also use const on joint_interface since the reference_wrapper is not
@@ -315,6 +317,8 @@ controller_interface::return_type JointTrajectoryController::update(
315317 // TODO(matthew-reynolds): Need a lock-free write here
316318 // See https://github.com/ros-controls/ros2_controllers/issues/168
317319 rt_active_goal_.writeFromNonRT (RealtimeGoalHandlePtr ());
320+ // remove the active trajectory pointer so that we stop commanding the hardware
321+ traj_point_active_ptr_ = nullptr ;
318322
319323 // check goal tolerance
320324 }
@@ -328,6 +332,8 @@ controller_interface::return_type JointTrajectoryController::update(
328332 // TODO(matthew-reynolds): Need a lock-free write here
329333 // See https://github.com/ros-controls/ros2_controllers/issues/168
330334 rt_active_goal_.writeFromNonRT (RealtimeGoalHandlePtr ());
335+ // remove the active trajectory pointer so that we stop commanding the hardware
336+ traj_point_active_ptr_ = nullptr ;
331337
332338 RCLCPP_INFO (get_node ()->get_logger (), " Goal reached, success!" );
333339 }
You can’t perform that action at this time.
0 commit comments