June 2018
Intermediate to advanced
484 pages
11h 36m
English
Next, we will create a new file with the name sendGoals.cpp in the chapter7_tutorials/src folder and add the following code there:
#include <ros/ros.h> #include <move_base_msgs/MoveBaseAction.h>#include <actionlib/client/simple_action_client.h>#include <tf/transform_broadcaster.h>#include <sstream>typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;int main(int argc, char** argv){ros::init(argc, argv, "navigation_goals");MoveBaseClient ac("move_base", true);while(!ac.waitForServer(ros::Duration(5.0))){ROS_INFO("Waiting for the move_base action server");}move_base_msgs::MoveBaseGoal goal;goal.target_pose.header.frame_id = "map";goal.target_pose.header.stamp = ros::Time::now();goal.target_pose.pose.position.x ...