37 #include <visualization_msgs/MarkerArray.h> 
   38 #include <sick_ldmrs_msgs/ObjectArray.h> 
  302 void callback(
const sick_ldmrs_msgs::ObjectArray::ConstPtr& oa)
 
  304   visualization_msgs::MarkerArray velocity;
 
  305   velocity.markers.resize(oa->objects.size());
 
  307   for (
size_t i = 0; i < oa->objects.size(); i++)
 
  309     velocity.markers[i].header = oa->header;
 
  310     velocity.markers[i].ns = 
"velocities";
 
  311     velocity.markers[i].id = oa->objects[i].id;
 
  312     velocity.markers[i].type = visualization_msgs::Marker::ARROW;
 
  313     velocity.markers[i].action = visualization_msgs::Marker::ADD;
 
  314     velocity.markers[i].scale.x = 0.1;
 
  315     velocity.markers[i].scale.y = 0.2;
 
  316     velocity.markers[i].color.a = 0.75;
 
  317     velocity.markers[i].color.r = 
GLASBEY_LUT[oa->objects[i].id * 3] / 255.0;
 
  318     velocity.markers[i].color.g = 
GLASBEY_LUT[oa->objects[i].id * 3 + 1] / 255.0;
 
  319     velocity.markers[i].color.b = 
GLASBEY_LUT[oa->objects[i].id * 3 + 2] / 255.0;
 
  322     velocity.markers[i].points.resize(2);
 
  323     velocity.markers[i].points[0] = oa->objects[i].object_box_center.pose.position;
 
  324     velocity.markers[i].points[1].x = oa->objects[i].object_box_center.pose.position.x + oa->objects[i].velocity.twist.linear.x;
 
  325     velocity.markers[i].points[1].y = oa->objects[i].object_box_center.pose.position.y + oa->objects[i].velocity.twist.linear.y;
 
  330   visualization_msgs::MarkerArray bounding_box;
 
  331   bounding_box.markers.resize(oa->objects.size());
 
  333   for (
size_t i = 0; i < oa->objects.size(); i++)
 
  335     bounding_box.markers[i].header = oa->header;
 
  336     bounding_box.markers[i].ns = 
"bounding_boxes";
 
  337     bounding_box.markers[i].id = oa->objects[i].id;
 
  338     bounding_box.markers[i].type = visualization_msgs::Marker::CUBE;
 
  339     bounding_box.markers[i].action = visualization_msgs::Marker::ADD;
 
  340     bounding_box.markers[i].color.a = 0.75;
 
  341     bounding_box.markers[i].color.r = 
GLASBEY_LUT[oa->objects[i].id * 3] / 255.0;
 
  342     bounding_box.markers[i].color.g = 
GLASBEY_LUT[oa->objects[i].id * 3 + 1] / 255.0;
 
  343     bounding_box.markers[i].color.b = 
GLASBEY_LUT[oa->objects[i].id * 3 + 2] / 255.0;
 
  346     bounding_box.markers[i].pose = oa->objects[i].bounding_box_center;
 
  347     bounding_box.markers[i].scale = oa->objects[i].bounding_box_size;
 
  349     if (bounding_box.markers[i].scale.x == 0.0)
 
  351       bounding_box.markers[i].scale.x = 0.01;
 
  353     if (bounding_box.markers[i].scale.y == 0.0)
 
  355       bounding_box.markers[i].scale.y = 0.01;
 
  357     bounding_box.markers[i].scale.z = 0.2;
 
  362   visualization_msgs::MarkerArray object_boxes;
 
  363   object_boxes.markers.resize(oa->objects.size());
 
  365   for (
size_t i = 0; i < oa->objects.size(); i++)
 
  367     object_boxes.markers[i].header = oa->header;
 
  368     object_boxes.markers[i].ns = 
"object_boxes";
 
  369     object_boxes.markers[i].id = oa->objects[i].id;
 
  370     object_boxes.markers[i].type = visualization_msgs::Marker::CUBE;
 
  371     object_boxes.markers[i].action = visualization_msgs::Marker::ADD;
 
  372     object_boxes.markers[i].color.a = 0.75;
 
  373     object_boxes.markers[i].color.r = 
GLASBEY_LUT[oa->objects[i].id * 3] / 255.0;
 
  374     object_boxes.markers[i].color.g = 
GLASBEY_LUT[oa->objects[i].id * 3 + 1] / 255.0;
 
  375     object_boxes.markers[i].color.b = 
GLASBEY_LUT[oa->objects[i].id * 3 + 2] / 255.0;
 
  378     object_boxes.markers[i].pose = oa->objects[i].object_box_center.pose;
 
  379     object_boxes.markers[i].scale = oa->objects[i].object_box_size;
 
  381     if (object_boxes.markers[i].scale.x == 0.0)
 
  383       object_boxes.markers[i].scale.x = 0.01;
 
  385     if (object_boxes.markers[i].scale.y == 0.0)
 
  387       object_boxes.markers[i].scale.y = 0.01;
 
  389     object_boxes.markers[i].scale.z = 0.2;
 
  394   visualization_msgs::MarkerArray contour_lines;
 
  395   contour_lines.markers.resize(oa->objects.size());
 
  397   for (
size_t i = 0; i < oa->objects.size(); i++)
 
  399     contour_lines.markers[i].header = oa->header;
 
  400     contour_lines.markers[i].ns = 
"contour_lines";
 
  401     contour_lines.markers[i].id = oa->objects[i].id;
 
  402     contour_lines.markers[i].type = visualization_msgs::Marker::LINE_STRIP;
 
  403     contour_lines.markers[i].action = visualization_msgs::Marker::ADD;
 
  404     contour_lines.markers[i].scale.x = 0.1;
 
  405     contour_lines.markers[i].color.a = 0.75;
 
  406     contour_lines.markers[i].color.r = 
GLASBEY_LUT[oa->objects[i].id * 3] / 255.0;
 
  407     contour_lines.markers[i].color.g = 
GLASBEY_LUT[oa->objects[i].id * 3 + 1] / 255.0;
 
  408     contour_lines.markers[i].color.b = 
GLASBEY_LUT[oa->objects[i].id * 3 + 2] / 255.0;
 
  411     contour_lines.markers[i].points = oa->objects[i].contour_points;
 
  418 int main(
int argc, 
char **argv)
 
  420   ros::init(argc, argv, 
"sick_ldmrs_object_marker");
 
  424   pub = nh.
advertise<visualization_msgs::MarkerArray>(
"object_markers", 1);