goal_pub.cpp
Go to the documentation of this file.
00001 #include "ros/ros.h"
00002 #include <geometry_msgs/Pose.h>
00003 #include <geometry_msgs/PoseStamped.h>
00004 #include <unistd.h>
00005 
00006 int main(int argc, char **argv)
00007 {
00008   ros::init(argc, argv, "goal_pub");
00009   ros::NodeHandle n;
00010   
00011   if (argc != 3){
00012     ROS_INFO("USAGE: goal_pub [x] [y]");
00013     return 0;
00014   }
00015   
00016   ros::Publisher goal_pub = n.advertise<geometry_msgs::PoseStamped>("goal", 1000);
00017   
00018   geometry_msgs::PoseStamped goal_msg;
00019   goal_msg.pose.position.x = atof(argv[1]);
00020   goal_msg.pose.position.y = atof(argv[2]);
00021   
00022   
00023   ros::Rate loop_rate(100);
00024   
00025   
00026   while(goal_pub.getNumSubscribers() == 0){
00027     loop_rate.sleep();
00028   }
00029   
00030   ros::Duration(5.0).sleep();
00031 
00032   goal_pub.publish(goal_msg);
00033 
00034 
00035   return 0;
00036 }


riskrrt
Author(s): Gregoire Vignon
autogenerated on Thu Jun 6 2019 18:42:06