O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required