ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Creating a CollisionObject from a mesh in indigo

asked 2016-05-15 09:13:59 -0600

noamon gravatar image

updated 2016-05-16 02:06:37 -0600

gvdhoorn gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

Hi noamon, I am facing the same issue. Any luck fixing it?

kmohan gravatar image kmohan  ( 2016-07-08 16:58:54 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2017-02-02 08:38:22 -0600

sbock gravatar image

updated 2017-02-02 08:39:28 -0600

I had the same issue. For me adding these includes solved my issue:

#include "geometric_shapes/shapes.h"
#include "geometric_shapes/mesh_operations.h"
#include "geometric_shapes/shape_operations.h"
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-15 09:13:59 -0600

Seen: 1,320 times

Last updated: Feb 02 '17