41                                                 visualization_msgs::Marker& mk)
 
   43   switch (shape_msg.type)
 
   46       if (shape_msg.dimensions.size() < geometric_shapes::solidPrimitiveDimCount<shape_msgs::SolidPrimitive::SPHERE>())
 
   47         throw std::runtime_error(
"Insufficient dimensions in sphere definition");
 
   51         mk.scale.x = mk.scale.y = mk.scale.z = shape_msg.dimensions[shape_msgs::SolidPrimitive::SPHERE_RADIUS] * 2.0;
 
   55       if (shape_msg.dimensions.size() < geometric_shapes::solidPrimitiveDimCount<shape_msgs::SolidPrimitive::BOX>())
 
   56         throw std::runtime_error(
"Insufficient dimensions in box definition");
 
   59         mk.type = visualization_msgs::Marker::CUBE;
 
   60         mk.scale.x = shape_msg.dimensions[shape_msgs::SolidPrimitive::BOX_X];
 
   61         mk.scale.y = shape_msg.dimensions[shape_msgs::SolidPrimitive::BOX_Y];
 
   62         mk.scale.z = shape_msg.dimensions[shape_msgs::SolidPrimitive::BOX_Z];
 
   66       if (shape_msg.dimensions.size() < geometric_shapes::solidPrimitiveDimCount<shape_msgs::SolidPrimitive::CONE>())
 
   67         throw std::runtime_error(
"Insufficient dimensions in cone definition");
 
   72         mk.scale.x = shape_msg.dimensions[shape_msgs::SolidPrimitive::CONE_RADIUS] * 2.0;
 
   73         mk.scale.y = mk.scale.x;
 
   74         mk.scale.z = shape_msg.dimensions[shape_msgs::SolidPrimitive::CONE_HEIGHT];
 
   78       if (shape_msg.dimensions.size() <
 
   79           geometric_shapes::solidPrimitiveDimCount<shape_msgs::SolidPrimitive::CYLINDER>())
 
   80         throw std::runtime_error(
"Insufficient dimensions in cylinder definition");
 
   84         mk.scale.x = shape_msg.dimensions[shape_msgs::SolidPrimitive::CYLINDER_RADIUS] * 2.0;
 
   85         mk.scale.y = mk.scale.x;
 
   86         mk.scale.z = shape_msg.dimensions[shape_msgs::SolidPrimitive::CYLINDER_HEIGHT];
 
   93       throw std::runtime_error(
"Unknown shape type: " + ss.str());
 
   99                                                 bool use_mesh_triangle_list)
 
  101   if (shape_msg.triangles.empty() || shape_msg.vertices.empty())
 
  102     throw std::runtime_error(
"Mesh definition is empty");
 
  103   if (use_mesh_triangle_list)
 
  105     mk.type = visualization_msgs::Marker::TRIANGLE_LIST;
 
  106     mk.scale.x = mk.scale.y = mk.scale.z = 1.0;
 
  107     for (std::size_t i = 0; i < shape_msg.triangles.size(); ++i)
 
  109       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[0]]);
 
  110       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[1]]);
 
  111       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[2]]);
 
  116     mk.type = visualization_msgs::Marker::LINE_LIST;
 
  117     mk.scale.x = mk.scale.y = mk.scale.z = 0.01;
 
  118     for (std::size_t i = 0; i < shape_msg.triangles.size(); ++i)
 
  120       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[0]]);
 
  121       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[1]]);
 
  122       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[0]]);
 
  123       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[2]]);
 
  124       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[1]]);
 
  125       mk.points.push_back(shape_msg.vertices[shape_msg.triangles[i].vertex_indices[2]]);