导入dae,stl,mesh时代码:
// 定义一个mesh文件指针,从createMeshFromResource的函数名可知,将由一个文件生成我们的mesh物体
// 此处的路径必须是ROS中可以找到的包路径
shapes::Mesh* m = shapes::createMeshFromResource(“package://apc/collision_objects/pod_lowres.stl”);
shape_msgs::Mesh shelf_mesh;
shapes::ShapeMsg shelf_mesh_msg;
// 从mesh文件指针创建mesh的msg
shapes::constructMsgFromShape(m,shelf_mesh_msg);
shelf_mesh = boost::get<shape_msgs::Mesh>(shelf_mesh_msg);
编译时报错:
对‘shapes::createMeshFromResource(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)’未定义的引用等等
解决方法:
find_package(catkin REQUIRED COMPONENTS
message_generation
message_runtime
roscpp
std_msgs
Eigen3
)
You appear to be missing geometric_shapes in this list. That’s most likely the problem: you’re not linking against geometric_shapes, but are using a function from that library.