@@ -46,8 +46,7 @@ namespace ur_robot_driver
4646{
4747
4848using TCAction = ur_msgs::action::ToolContact;
49- using TrajectoryUntil = ur_msgs::action::TrajectoryUntil;
50- using GoalHandleTrajectoryUntil = rclcpp_action::ServerGoalHandle<TrajectoryUntil>;
49+ using GoalHandleTrajectoryUntil = rclcpp_action::ServerGoalHandle<ur_msgs::action::FollowJointTrajectoryUntil>;
5150using FollowJointTrajectory = control_msgs::action::FollowJointTrajectory;
5251using TrajectoryResult = rclcpp_action::ClientGoalHandle<control_msgs::action::FollowJointTrajectory>::WrappedResult;
5352
@@ -61,8 +60,8 @@ TrajectoryUntilNode::TrajectoryUntilNode(const rclcpp::NodeOptions& options)
6160 , trajectory_accepted_(false )
6261 , until_accepted_(false )
6362{
64- prealloc_res = std::make_shared<TrajectoryUntil ::Result>(TrajectoryUntil ::Result ());
65- prealloc_fb = std::make_shared<TrajectoryUntil ::Feedback>(TrajectoryUntil ::Feedback ());
63+ prealloc_res = std::make_shared<TrajectoryUntilAction ::Result>(TrajectoryUntilAction ::Result ());
64+ prealloc_fb = std::make_shared<TrajectoryUntilAction ::Feedback>(TrajectoryUntilAction ::Feedback ());
6665
6766 // Different callback groups for the server and the clients, so their callbacks can run concurrently.
6867 server_callback_group = create_callback_group (rclcpp::CallbackGroupType::MutuallyExclusive);
@@ -77,7 +76,7 @@ TrajectoryUntilNode::TrajectoryUntilNode(const rclcpp::NodeOptions& options)
7776 clients_callback_group);
7877
7978 // Create action server to advertise the "/trajectory_until_node/execute"
80- action_server_ = rclcpp_action::create_server<TrajectoryUntil >(
79+ action_server_ = rclcpp_action::create_server<TrajectoryUntilAction >(
8180 this , std::string (this ->get_name ()) + " /execute" ,
8281 std::bind (&TrajectoryUntilNode::goal_received_callback, this , std::placeholders::_1, std::placeholders::_2),
8382 std::bind (&TrajectoryUntilNode::goal_cancelled_callback, this , std::placeholders::_1),
@@ -90,11 +89,10 @@ TrajectoryUntilNode::~TrajectoryUntilNode()
9089}
9190
9291// Assign the correct type of action client to the variant
93- bool TrajectoryUntilNode::assign_until_action_client (std::shared_ptr<const TrajectoryUntil ::Goal> goal)
92+ bool TrajectoryUntilNode::assign_until_action_client (std::shared_ptr<const TrajectoryUntilAction ::Goal> goal)
9493{
95- int type = goal->until_type ;
96- switch (type) {
97- case TrajectoryUntil::Goal::TOOL_CONTACT:
94+ switch (goal->until_type ) {
95+ case TrajectoryUntilAction::Goal::TOOL_CONTACT:
9896 until_action_client_variant = rclcpp_action::create_client<TCAction>(this ,
9997 " /tool_contact_controller/"
10098 " detect_tool_contact" ,
@@ -111,7 +109,7 @@ bool TrajectoryUntilNode::assign_until_action_client(std::shared_ptr<const Traje
111109
112110// Check if the node is capable of accepting a new action goal right now.
113111rclcpp_action::GoalResponse TrajectoryUntilNode::goal_received_callback (
114- const rclcpp_action::GoalUUID& /* uuid */ , std::shared_ptr<const TrajectoryUntil ::Goal> goal)
112+ const rclcpp_action::GoalUUID& /* uuid */ , std::shared_ptr<const TrajectoryUntilAction ::Goal> goal)
115113{
116114 if (server_goal_handle_) {
117115 RCLCPP_ERROR (this ->get_logger (), " Node is currently busy, rejecting action goal." );
@@ -184,7 +182,7 @@ TrajectoryUntilNode::goal_cancelled_callback(const std::shared_ptr<GoalHandleTra
184182}
185183
186184// Send the trajectory goal, using the relevant fields supplied from the action server
187- void TrajectoryUntilNode::send_trajectory_goal (std::shared_ptr<const TrajectoryUntil ::Goal> goal)
185+ void TrajectoryUntilNode::send_trajectory_goal (std::shared_ptr<const TrajectoryUntilAction ::Goal> goal)
188186{
189187 auto goal_msg = FollowJointTrajectory::Goal ();
190188 goal_msg.trajectory = goal->trajectory ;
@@ -204,7 +202,7 @@ void TrajectoryUntilNode::send_trajectory_goal(std::shared_ptr<const TrajectoryU
204202
205203// Send the until goal, using the relevant fields supplied from the action server.
206204template <class ActionType , class ClientType >
207- void TrajectoryUntilNode::send_until_goal (std::shared_ptr<const TrajectoryUntil ::Goal> /* goal */ )
205+ void TrajectoryUntilNode::send_until_goal (std::shared_ptr<const TrajectoryUntilAction ::Goal> /* goal */ )
208206{
209207 // Setup goal
210208 auto goal_msg = typename ActionType::Goal ();
@@ -219,7 +217,7 @@ void TrajectoryUntilNode::send_until_goal(std::shared_ptr<const TrajectoryUntil:
219217}
220218
221219void TrajectoryUntilNode::trajectory_response_callback (
222- const rclcpp_action::ClientGoalHandle<control_msgs::action:: FollowJointTrajectory>::SharedPtr& goal_handle)
220+ const rclcpp_action::ClientGoalHandle<FollowJointTrajectory>::SharedPtr& goal_handle)
223221{
224222 {
225223 std::lock_guard<std::mutex> guard (mutex_trajectory);
@@ -253,8 +251,8 @@ void TrajectoryUntilNode::until_response_callback(
253251
254252// Just forward feedback from trajectory controller. No feedback from until controllers so far.
255253void TrajectoryUntilNode::trajectory_feedback_callback (
256- const rclcpp_action::ClientGoalHandle<control_msgs::action:: FollowJointTrajectory>::SharedPtr& /* goal_handle */ ,
257- const std::shared_ptr<const control_msgs::action:: FollowJointTrajectory::Feedback> feedback)
254+ const rclcpp_action::ClientGoalHandle<FollowJointTrajectory>::SharedPtr& /* goal_handle */ ,
255+ const std::shared_ptr<const FollowJointTrajectory::Feedback> feedback)
258256{
259257 if (server_goal_handle_) {
260258 prealloc_fb->actual = feedback->actual ;
@@ -270,7 +268,7 @@ void TrajectoryUntilNode::trajectory_feedback_callback(
270268
271269// When a result is received from either trajectory or until condition, report it back to user
272270void TrajectoryUntilNode::trajectory_result_callback (
273- const rclcpp_action::ClientGoalHandle<control_msgs::action::FollowJointTrajectory>::WrappedResult & result)
271+ const TrajectoryResult & result)
274272{
275273 RCLCPP_INFO (this ->get_logger (), " Trajectory result received." );
276274 current_trajectory_goal_handle_.reset ();
@@ -289,7 +287,7 @@ void TrajectoryUntilNode::until_result_callback(
289287void TrajectoryUntilNode::report_goal (TrajectoryResult result)
290288{
291289 if (server_goal_handle_) {
292- prealloc_res->until_condition_result = TrajectoryUntil ::Result::NOT_TRIGGERED;
290+ prealloc_res->until_condition_result = TrajectoryUntilAction ::Result::NOT_TRIGGERED;
293291 prealloc_res->error_code = result.result ->error_code ;
294292 prealloc_res->error_string = result.result ->error_string ;
295293 switch (result.code ) {
@@ -328,8 +326,8 @@ void TrajectoryUntilNode::report_goal(UntilResult result)
328326 if (server_goal_handle_) {
329327 switch (result.code ) {
330328 case rclcpp_action::ResultCode::SUCCEEDED:
331- prealloc_res->error_code = TrajectoryUntil ::Result::SUCCESSFUL;
332- prealloc_res->until_condition_result = ur_msgs::action::TrajectoryUntil ::Result::TRIGGERED;
329+ prealloc_res->error_code = TrajectoryUntilAction ::Result::SUCCESSFUL;
330+ prealloc_res->until_condition_result = TrajectoryUntilAction ::Result::TRIGGERED;
333331 prealloc_res->error_string += " Trajectory finished successfully by triggering until condition." ;
334332 server_goal_handle_->succeed (prealloc_res);
335333 break ;
@@ -374,8 +372,8 @@ void TrajectoryUntilNode::reset_node()
374372 current_until_goal_handle_ = nullptr ;
375373 trajectory_accepted_ = false ;
376374 until_accepted_ = false ;
377- prealloc_res = std::make_shared<TrajectoryUntil ::Result>(TrajectoryUntil ::Result ());
378- prealloc_fb = std::make_shared<TrajectoryUntil ::Feedback>(TrajectoryUntil ::Feedback ());
375+ prealloc_res = std::make_shared<TrajectoryUntilAction ::Result>(TrajectoryUntilAction ::Result ());
376+ prealloc_fb = std::make_shared<TrajectoryUntilAction ::Feedback>(TrajectoryUntilAction ::Feedback ());
379377
380378 server_goal_handle_ = nullptr ;
381379}
0 commit comments