visualization.cpp
Go to the documentation of this file.
00001 /* Functions for visualization of crossings in rviz */
00002 
00003 #include <nj_laser/visualization.h>
00004 
00005 namespace nj_laser {
00006 
00007 /* Return the marker for the visualization of the crossing center
00008  */
00009 visualization_msgs::Marker crossingMarker(const std::string& frame_id, const double x, const double y, const double radius)
00010 {
00011         visualization_msgs::Marker m;
00012         m.header.frame_id = frame_id;
00013         m.ns = "crossing_center";
00014         m.type = visualization_msgs::Marker::SPHERE;
00015         m.pose.position.x = x;
00016         m.pose.position.y = y;
00017         m.pose.position.z = 0;
00018         m.pose.orientation.w = 1.0;
00019         m.scale.x = radius;
00020         m.scale.y = radius;
00021         m.scale.z = 1;
00022         m.color.r = 1.0;
00023         m.color.g = 1.0;
00024         m.color.a = 0.5;
00025         return m;
00026 }
00027 
00028 /* Return the marker for the visualization of crossing exits
00029  */
00030 visualization_msgs::Marker exitsMarker(const std::string& frame_id, const double x, const double y, const std::vector<double>& angles, const double length)
00031 {
00032         visualization_msgs::Marker m;
00033         m.header.frame_id = frame_id;
00034         m.ns = "road_direction";
00035         m.type = visualization_msgs::Marker::LINE_LIST;
00036         m.pose.orientation.w = 1.0;
00037         m.scale.x = 0.1;
00038         m.color.r = 0.0;
00039         m.color.g = 0.0;
00040         m.color.b = 1.0;
00041         m.color.a = 0.5;
00042   for(size_t i = 0; i < angles.size(); ++i)
00043         {
00044                 geometry_msgs::Point p;
00045     p.x = x;
00046     p.y = y;
00047                 m.points.push_back(p);
00048                 p.x = x + length * cos(angles[i]);
00049                 p.y = y + length * sin(angles[i]);
00050                 m.points.push_back(p);
00051         }
00052         return m;
00053 }
00054 
00055 } // namespace nj_laser
00056 


nj_laser
Author(s): Gaël Ecorchard , Karel Košnar , Vojtěch Vonásek
autogenerated on Thu Jun 6 2019 17:50:54