@@ -65,10 +65,8 @@ class TrajectoryUntilNode : public rclcpp::Node
6565 rclcpp_action::Client<control_msgs::action::FollowJointTrajectory>::SharedPtr trajectory_action_client_;
6666 rclcpp_action::Client<ur_msgs::action::ToolContact>::SharedPtr until_action_client_;
6767
68- rclcpp::CallbackGroup::SharedPtr server_callback_group =
69- create_callback_group (rclcpp::CallbackGroupType::MutuallyExclusive);
70- rclcpp::CallbackGroup::SharedPtr clients_callback_group =
71- create_callback_group (rclcpp::CallbackGroupType::MutuallyExclusive);
68+ rclcpp::CallbackGroup::SharedPtr server_callback_group;
69+ rclcpp::CallbackGroup::SharedPtr clients_callback_group;
7270
7371 std::shared_ptr<rclcpp_action::ServerGoalHandle<ur_msgs::action::TrajectoryUntil>> server_goal_handle_;
7472
@@ -95,24 +93,26 @@ class TrajectoryUntilNode : public rclcpp::Node
9593 const std::shared_ptr<rclcpp_action::ServerGoalHandle<ur_msgs::action::TrajectoryUntil>> goal_handle);
9694
9795 void send_trajectory_goal (std::shared_ptr<const ur_msgs::action::TrajectoryUntil::Goal> goal);
96+
9897 void send_until_goal (std::shared_ptr<const ur_msgs::action::TrajectoryUntil::Goal> goal);
9998
100- void report_goal (auto result, bool until_triggered );
99+ void report_goal (rclcpp_action::ClientGoalHandle<control_msgs::action::FollowJointTrajectory>::WrappedResult result);
101100
102- void reset_vars ();
101+ template <typename UntilResult>
102+ void report_goal (UntilResult result);
103103
104- std::atomic<bool > trajectory_accepted_;
105- std::atomic<bool > until_accepted_;
104+ void reset_node ();
106105
107106 rclcpp_action::ClientGoalHandle<control_msgs::action::FollowJointTrajectory>::SharedPtr
108107 current_trajectory_goal_handle_;
109108 rclcpp_action::ClientGoalHandle<ur_msgs::action::ToolContact>::SharedPtr current_until_goal_handle_;
110109
111- std::shared_ptr<ur_msgs::action::TrajectoryUntil::Result> prealloc_res =
112- std::make_shared<ur_msgs::action::TrajectoryUntil::Result>(ur_msgs::action::TrajectoryUntil::Result());
110+ std::shared_ptr<ur_msgs::action::TrajectoryUntil::Result> prealloc_res;
113111
114- std::shared_ptr<ur_msgs::action::TrajectoryUntil::Feedback> prealloc_fb =
115- std::make_shared<ur_msgs::action::TrajectoryUntil::Feedback>(ur_msgs::action::TrajectoryUntil::Feedback());
112+ std::shared_ptr<ur_msgs::action::TrajectoryUntil::Feedback> prealloc_fb;
113+
114+ std::atomic<bool > trajectory_accepted_;
115+ std::atomic<bool > until_accepted_;
116116
117117 std::condition_variable cv_until_;
118118 std::condition_variable cv_trajectory_;
0 commit comments