00001 #include <nav_msgs/Odometry.h>
00002 #include <ros/ros.h>
00003 #include <stdio.h>
00004 #include <tf/tf.h>
00005
00006 using namespace std;
00007 using namespace ros;
00008 using namespace nav_msgs;
00009
00010 void sendGoal(double x, double y, double theta, Publisher pub){
00011
00012 geometry_msgs::PoseStamped goal;
00013
00014
00015
00016 goal.pose.position.x = x;
00017 goal.pose.position.y = y;
00018 goal.pose.position.z = 0;
00019 btQuaternion temp;
00020 temp.setEulerZYX(theta,0,0);
00021 goal.pose.orientation.x = temp.getX();
00022 goal.pose.orientation.y = temp.getY();
00023 goal.pose.orientation.z = temp.getZ();
00024 goal.pose.orientation.w = temp.getW();
00025 goal.header.stamp = ros::Time::now();
00026 goal.header.frame_id = "/map";
00027 pub.publish(goal);
00028 }
00029
00030 int main(int argc, char** argv){
00031 ros::init(argc, argv, "demo_sbpl_dynamic_env");
00032
00033 Publisher robotGoal = ros::NodeHandle().advertise<geometry_msgs::PoseStamped>("/robot_0/move_base_simple/goal", 1);
00034 Publisher dynObsGoal1 = ros::NodeHandle().advertise<geometry_msgs::PoseStamped>("/robot_1/move_base_simple/goal", 1);
00035 Publisher dynObsGoal2 = ros::NodeHandle().advertise<geometry_msgs::PoseStamped>("/robot_2/move_base_simple/goal", 1);
00036
00037
00038
00039 sleep(10);
00040 ROS_DEBUG("fire one!\n");
00041 sendGoal(25.413, 6.113, 0.0, dynObsGoal1);
00042 sleep(8);
00043 ROS_DEBUG("fire two!\n");
00044 sendGoal(25.413, 7.713, 0.0, dynObsGoal2);
00045 sleep(1);
00046 ROS_DEBUG("fire three!\n");
00047
00048 sendGoal(4.913, 7.713, 3.14159, robotGoal);
00049
00050 ros::spin();
00051 }
00052