og_builder.cpp
Go to the documentation of this file.
00001 #include <ros/ros.h>
00002 #include <nav_msgs/OccupancyGrid.h>
00003 #include <dynamic_reconfigure/server.h>
00004 #include <riskrrt/OccupancyGridArray.h>
00005 #include <riskrrt/PoseTwistStamped.h>
00006 #include <riskrrt/Trajectory.h>
00007 #include <vector>
00008 #include <iostream>
00009 
00010 using namespace std;
00011 
00012 nav_msgs::OccupancyGrid grid;
00013 riskrrt::OccupancyGridArray og_array;
00014 riskrrt::Trajectory traj;
00015 int nbMap;
00016 
00017 void OGCallback(const nav_msgs::OccupancyGrid::ConstPtr& msg)
00018 {
00019   grid = *msg;
00020   int i;
00021   for(i=0;i<nbMap;i++){
00022     og_array.array.push_back(grid);
00023   }
00024 }
00025 
00026 int main(int argc, char **argv)
00027 {
00028   ros::init(argc, argv, "og_builder");
00029 
00030   ros::NodeHandle n;
00031   
00032   //n.param("timeStep", timeStep,0.5);
00033   n.param("maxDepth", nbMap, 10);
00034 
00035   ros::Subscriber og_sub = n.subscribe("map", 1, OGCallback);
00036   ros::Publisher og_pub = n.advertise<riskrrt::OccupancyGridArray>("ogarray", 1);
00037 
00038   ros::Rate loop_rate(10);
00039 
00040   while (ros::ok())
00041   {
00042     og_pub.publish(og_array);
00043 
00044     ros::spinOnce();
00045 
00046     loop_rate.sleep();
00047   }
00048   return 0;
00049 }


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