Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit eed506c

Browse files
authored
Clean shutdown position example (#196)
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
1 parent 970b929 commit eed506c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gazebo_ros2_control_demos/examples/example_position.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ int main(int argc, char * argv[])
149149
rclcpp::FutureReturnCode::SUCCESS)
150150
{
151151
RCLCPP_ERROR(node->get_logger(), "send goal call failed :(");
152+
action_client.reset();
153+
node.reset();
152154
return 1;
153155
}
154156
RCLCPP_INFO(node->get_logger(), "send goal call ok :)");
@@ -157,6 +159,8 @@ int main(int argc, char * argv[])
157159
goal_handle = goal_handle_future.get();
158160
if (!goal_handle) {
159161
RCLCPP_ERROR(node->get_logger(), "Goal was rejected by server");
162+
action_client.reset();
163+
node.reset();
160164
return 1;
161165
}
162166
RCLCPP_INFO(node->get_logger(), "Goal was accepted by server");
@@ -171,7 +175,8 @@ int main(int argc, char * argv[])
171175
return 1;
172176
}
173177

174-
std::cout << "async_send_goal" << std::endl;
178+
action_client.reset();
179+
node.reset();
175180
rclcpp::shutdown();
176181

177182
return 0;

0 commit comments

Comments
 (0)