We have seen how to send a goal position to a robot for moving it from point A to B, using the RViz 2D Nav Goal button. Now we will see how to command the robot using actionlib client and ROS C++ APIs. Following is a sample package and node for communicating with Navigation stack move_base node.
The move_base node is SimpleActionServer. We can send and cancel the goals to the robot if the task takes a lot of time to complete.
The following code is SimpleActionClient for the move_base node, which can send the x, y, and theta from the command line arguments. The following code is in the chefbot_bringup/src folder with the name of send_robot_goal.cpp:
#include <ros/ros.h> #include <move_base_msgs/MoveBaseAction.h> ...