2 #include "std_msgs/String.h" 12 #include "nav_msgs/OccupancyGrid.h" 13 #include "geometry_msgs/PointStamped.h" 14 #include "std_msgs/Header.h" 15 #include "nav_msgs/MapMetaData.h" 16 #include "geometry_msgs/Point.h" 17 #include "visualization_msgs/Marker.h" 34 void mapCallBack(
const nav_msgs::OccupancyGrid::ConstPtr& msg)
41 void rvizCallBack(
const geometry_msgs::PointStamped::ConstPtr& msg)
44 geometry_msgs::Point p;
49 points.points.push_back(p);
56 int main(
int argc,
char **argv)
59 unsigned long init[4] = {0x123, 0x234, 0x345, 0x456},
length = 7;
67 ros::init(argc, argv,
"global_rrt_frontier_detector");
72 std::string map_topic,base_frame_topic;
77 ros::param::param<float>(ns+
"/eta", eta, 0.5);
78 ros::param::param<std::string>(ns+
"/map_topic", map_topic,
"/robot_1/map");
111 points.pose.orientation.w =1.0;
112 line.pose.orientation.w = 1.0;
118 line.color.r =9.0/255.0;
119 line.color.g= 91.0/255.0;
120 line.color.b =236.0/255.0;
121 points.color.r = 255.0/255.0;
122 points.color.g = 0.0/255.0;
123 points.color.b = 0.0/255.0;
129 geometry_msgs::Point p;
132 while(
points.points.size()<5)
142 std::vector<float> temp1;
143 temp1.push_back(
points.points[0].x);
144 temp1.push_back(
points.points[0].y);
146 std::vector<float> temp2;
147 temp2.push_back(
points.points[2].x);
148 temp2.push_back(
points.points[0].y);
151 init_map_x=
Norm(temp1,temp2);
152 temp1.clear(); temp2.clear();
154 temp1.push_back(
points.points[0].x);
155 temp1.push_back(
points.points[0].y);
157 temp2.push_back(
points.points[0].x);
158 temp2.push_back(
points.points[2].y);
160 init_map_y=
Norm(temp1,temp2);
161 temp1.clear(); temp2.clear();
170 geometry_msgs::Point trans;
172 std::vector< std::vector<float> > V;
173 std::vector<float> xnew;
174 xnew.push_back( trans.x);xnew.push_back( trans.y);
189 std::vector<float> x_rand,x_nearest,x_new;
202 x_rand.push_back( xr ); x_rand.push_back( yr );
210 x_new=
Steer(x_nearest,x_rand,eta);
225 points.points.push_back(p);
233 else if (checking==1){
239 line.points.push_back(p);
243 line.points.push_back(p);
void rvizCallBack(const geometry_msgs::PointStamped::ConstPtr &msg)
void publish(const boost::shared_ptr< M > &message) const
void mapCallBack(const nav_msgs::OccupancyGrid::ConstPtr &msg)
visualization_msgs::Marker line
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
nav_msgs::OccupancyGrid mapData
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL const std::string & getName()
std::vector< float > Steer(std::vector< float >, std::vector< float >, float)
geometry_msgs::PointStamped clickedpoint
geometry_msgs::PointStamped exploration_goal
char ObstacleFree(std::vector< float >, std::vector< float > &, nav_msgs::OccupancyGrid)
visualization_msgs::Marker points
float Norm(std::vector< float >, std::vector< float >)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::vector< float > Nearest(std::vector< std::vector< float > >, std::vector< float >)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
int main(int argc, char **argv)
ROSCPP_DECL void spinOnce()