I'm trying to create create a collision object from a mesh resource and am having trouble understanding how to pass an enumerated type to a message constructor:
const shapes::Mesh* navstar_shape = shapes::createMeshFromResource("package://altius_arm/meshes/NAVSTAR_GPS_Satellite.dae");
shape_msgs::Mesh navstar_mesh;
shapes::constructMsgFromShape(navstar_shape,navstar_mesh);
navstar_collision_object.meshes[0] = navstar_mesh;
I get the following compiler error:
/home/peter/ros/altius_ws/src/altius_arm/src/servo_capture.cpp: In constructor ‘ServoCapture::ServoCapture()’:
/home/peter/ros/altius_ws/src/altius_arm/src/servo_capture.cpp:77:61: error: invalid initialization of reference of type ‘shapes::ShapeMsg& {aka boost::variant<shape_msgs::SolidPrimitive_<std::allocator<void> >, shape_msgs::Mesh_<std::allocator<void> >, shape_msgs::Plane_<std::allocator<void> > >&}’ from expression of type ‘shape_msgs::Mesh’
/opt/ros/hydro/include/geometric_shapes/shape_operations.h:62:6: error: in passing argument 2 of ‘bool shapes::constructMsgFromShape(const shapes::Shape*, shapes::ShapeMsg&)’
I thought constructMsgFromShape was asking for the message object by reference, but it didn't work so I tried passing it by address which at least gets the compiler to realize that I'm passing the right typedef but gives a similar error. Does anyone have any idea what I'm doing wrong?
Originally posted by St3am on ROS Answers with karma: 170 on 2014-04-02
Post score: 3