og_sample.cpp
Go to the documentation of this file.
00001 
00002 #include "simple_occupancy_grid/occupancy_grid.h"
00003 
00004 #include "hrl_msgs/FloatArrayBare.h"
00005 
00006 #include <ros/ros.h>
00007 #include <ros/console.h>
00008 
00009 /*
00010 
00011    This file makes a dummy occupancy grid and publishes visualization
00012    markers so that we can view it in rviz.
00013 
00014 Steps:
00015     1. run this node (bin/og_sample)
00016     2. in rviz subscribe to the /occupancy_grid_node/viz ROS topic
00017        which is of the type Marker and set the fixed frame to be
00018        /occupancy_grid_frame.
00019 
00020 */
00021 
00022 
00023 
00024 int main(int argc, char *argv[])
00025 {
00026     ros::init(argc, argv, "occupancy_grid_node");
00027     ROS_INFO("Hello World");
00028 
00029     occupancy_grid::OccupancyGrid og(0.5, 0., 1.0,
00030                                      0.5, 0.5, 0.5,
00031                                      0.02, 0.02, 0.02);
00032 
00033     hrl_msgs::FloatArrayBare fa;
00034 
00035     fa.data.push_back(0.5);
00036     fa.data.push_back(0.);
00037     fa.data.push_back(1.);
00038 
00039     fa.data.push_back(0.6);
00040     fa.data.push_back(0.);
00041     fa.data.push_back(1.);
00042 
00043     fa.data.push_back(0.4);
00044     fa.data.push_back(0.);
00045     fa.data.push_back(1.);
00046 
00047     fa.data.push_back(0.5);
00048     fa.data.push_back(0.1);
00049     fa.data.push_back(1.);
00050 
00051     fa.data.push_back(0.5);
00052     fa.data.push_back(-0.1);
00053     fa.data.push_back(1.);
00054 
00055     fa.data.push_back(0.5);
00056     fa.data.push_back(0.);
00057     fa.data.push_back(1.1);
00058 
00059     fa.data.push_back(0.5);
00060     fa.data.push_back(0.);
00061     fa.data.push_back(0.9);
00062 
00063     og.addPointsUnstamped(fa);
00064 
00065 
00066     ros::Rate loop_rate(1);
00067 
00068     while(ros::ok())
00069     {
00070         og.publishMarkerArray_simple();
00071         loop_rate.sleep();
00072     }
00073 
00074 }
00075 
00076 


simple_occupancy_grid
Author(s): Advait Jain
autogenerated on Wed Nov 27 2013 12:10:09