Creating a CollisionObject from a mesh in indigo
im building a c++ code to move ur5_moveit_config on rviz, andvtrying to add a mesh into rviz with a ur5_moveit_config on it. i read some previous answers and use them to build my code. i believe my problem is at my code:
moveit_msgs::CollisionObject toilet;
shapes::Mesh* m = shapes::createMeshFromResource("package://home/toilet seat grubcad/toiletseat2.stl");
shape_msgs::Mesh toilet_mesh;
shapes::ShapeMsg toilet_mesh_msg;
shapes::constructMsgFromShape(m,toilet_mesh_msg);
toilet_mesh = boost::get<shape_msgs::Mesh>(toilet_mesh_msg);
toilet.meshes.resize(1);
toilet.meshes[0] = toilet_mesh;
toilet.mesh_poses.resize(1);
toilet.mesh_poses[0].position.x = 1.0;
toilet.mesh_poses[0].position.y = 1.0;
toilet.mesh_poses[0].position.z = 0.0;
toilet.mesh_poses[0].orientation.w= 1.0;
toilet.mesh_poses[0].orientation.x= 0.0;
toilet.mesh_poses[0].orientation.y= 0.0;
toilet.mesh_poses[0].orientation.z= 0.0;
//pub_co.publish(toilet);
toilet.meshes.push_back(toilet_mesh);
toilet.mesh_poses.push_back(toilet.mesh_poses[0]);
toilet.operation = toilet.ADD;
std::vector<moveit_msgs::CollisionObject> collision_objects;
collision_objects.push_back(toilet);
// Now, let's add the collision object into the world
ROS_INFO("Add an object into the world");
planning_scene_interface.addCollisionObjects(collision_objects);
when i'm trying to "catkin_make" the program i get:
Built target move_arm_server
[ 50%] Built target manipulator_gazebo_generate_messages_lisp
[100%] [100%] Built target manipulator_gazebo_generate_messages_py
Built target manipulator_gazebo_generate_messages_cpp
[100%] Built target manipulator_gazebo_generate_messages
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:19:19: error: ‘createMeshFromResource’ is not a member of ‘shapes’
shapes::Mesh* m = shapes::createMeshFromResource("package://home/toilet seat grubcad/toiletseat2.stl");
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:21:1: error: ‘ShapeMsg’ in namespace ‘shapes’ does not name a type
shapes::ShapeMsg toilet_mesh_msg;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:22:30: error: expected constructor, destructor, or type conversion before ‘(’ token
shapes::constructMsgFromShape(m,toilet_mesh_msg);
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:23:1: error: ‘toilet_mesh’ does not name a type
toilet_mesh = boost::get<shape_msgs::Mesh>(toilet_mesh_msg);
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:24:1: error: ‘toilet’ does not name a type
toilet.meshes.resize(1);
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:25:1: error: ‘toilet’ does not name a type
toilet.meshes[0] = toilet_mesh;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:26:1: error: ‘toilet’ does not name a type
toilet.mesh_poses.resize(1);
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:27:1: error: ‘toilet’ does not name a type
toilet.mesh_poses[0].position.x = 1.0;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:28:1: error: ‘toilet’ does not name a type
toilet.mesh_poses[0].position.y = 1.0;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:29:1: error: ‘toilet’ does not name a type
toilet.mesh_poses[0].position.z = 0.0;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:30:1: error: ‘toilet’ does not name a type
toilet.mesh_poses[0].orientation.w= 1.0;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:31:1: error: ‘toilet’ does not name a type
toilet.mesh_poses[0].orientation.x= 0.0;
^
/home/noamsalo/catkin_ws/src/project/src/move_ur5_by_me.cpp:32:1 ...
Hi noamon, I am facing the same issue. Any luck fixing it?