navigation_utils.cpp
Go to the documentation of this file.
00001 #include "navigation_utils.h"
00002 
00003 bool goToDest(point3d go_posi, tf::Quaternion q) {
00004 
00005   // make an action client that spins up a thread
00006   MoveBaseClient ac("move_base", true);
00007 
00008   // cancel previous goals
00009   ac.cancelAllGoals();
00010 
00011   //wait for the action server to come up
00012   while(!ac.waitForServer(ros::Duration(5.0))){
00013     ROS_INFO("Waiting for the move_base action server to come up");
00014   }
00015 
00016   move_base_msgs::MoveBaseGoal goal;
00017 
00018   goal.target_pose.header.frame_id = "map";
00019   goal.target_pose.header.stamp = ros::Time::now();
00020 
00021   goal.target_pose.pose.position.x = go_posi.x();
00022   goal.target_pose.pose.position.y = go_posi.y();
00023   goal.target_pose.pose.position.z = go_posi.z();
00024 
00025   goal.target_pose.pose.orientation.x = q.x();
00026   goal.target_pose.pose.orientation.y = q.y();
00027   goal.target_pose.pose.orientation.z = q.z();
00028   goal.target_pose.pose.orientation.w = q.w();
00029 
00030   ROS_INFO("Sending goal to (%3.2f, %3.2f, %3.2f), and wait for 30 seconds...", go_posi.x(), go_posi.y(), go_posi.z());
00031   ac.sendGoal(goal);
00032 
00033   // while(ros::ok())
00034     ac.waitForResult(ros::Duration(30.0));
00035 
00036   // Returns true iff we reached the goal
00037   if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
00038     return true;
00039   else
00040     return false;
00041 }
00042 
00043 
00044 int main(int argc, char** argv){
00045   ros::init(argc, argv, "navigation_utils");
00046 
00047   return 0;
00048 }


turtlebot_exploration_3d
Author(s): Bona , Shawn
autogenerated on Thu Jun 6 2019 20:59:06