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

Revision history [back]

click to hide/show revision 1
initial version

Hi!

I tried hard to implement the mesh entry mentioned by dornhege. Using the code of this question and the information from here I get the following:

moveit_msgs::CollisionObject co;
shapes::Mesh* m = shapes::createMeshFromResource("package://ur5_test/step/table.stl");
shape_msgs::Mesh co_mesh;
shapes::ShapeMsg co_mesh_msg;
shapes::constructMsgFromShape(m,co_mesh_msg);
co_mesh = boost::get<shape_msgs::Mesh>(co_mesh_msg);
co.meshes.resize(1);
co.meshes[0] = co_mesh;
co.mesh_poses.resize(1);
co.mesh_poses[0].position.x = 1.0;
co.mesh_poses[0].position.y = 1.0;
co.mesh_poses[0].position.z = 0.0;
co.mesh_poses[0].orientation.w= 1.0;
co.mesh_poses[0].orientation.x= 0.0;
co.mesh_poses[0].orientation.y= 0.0;
co.mesh_poses[0].orientation.z= 0.0;
//pub_co.publish(co);

co.meshes.push_back(co_mesh);
co.mesh_poses.push_back(co.mesh_poses[0]);
co.operation = co.ADD;

std::vector<moveit_msgs::CollisionObject> collision_objects;  
collision_objects.push_back(co);  

// Now, let's add the collision object into the world
ROS_INFO("Add an object into the world");  
planning_scene_interface.addCollisionObjects(collision_objects);

Unfortunately, I cannot use the part pub_co.publish(co);, as my compiler says, it does not know pub_co...

But still with this code above, I can't get the object into my world. Instead I get the follwing error when I run it.

[ INFO] [1427024351.360110501]: Add an object into the world
terminate called after throwing an instance of 'class_loader::LibraryUnloadException'
  what():  Attempt to unload library that class_loader is unaware of.
Aborted (core dumped)

What am I still doing wrong?

Hi!

I tried hard to implement the mesh entry mentioned by dornhege. Using the code of this question and the information from here I get the following:

moveit_msgs::CollisionObject co;
shapes::Mesh* m = shapes::createMeshFromResource("package://ur5_test/step/table.stl");
shape_msgs::Mesh co_mesh;
shapes::ShapeMsg co_mesh_msg;
shapes::constructMsgFromShape(m,co_mesh_msg);
co_mesh = boost::get<shape_msgs::Mesh>(co_mesh_msg);
co.meshes.resize(1);
co.meshes[0] = co_mesh;
co.mesh_poses.resize(1);
co.mesh_poses[0].position.x = 1.0;
co.mesh_poses[0].position.y = 1.0;
co.mesh_poses[0].position.z = 0.0;
co.mesh_poses[0].orientation.w= 1.0;
co.mesh_poses[0].orientation.x= 0.0;
co.mesh_poses[0].orientation.y= 0.0;
co.mesh_poses[0].orientation.z= 0.0;
//pub_co.publish(co);

co.meshes.push_back(co_mesh);
co.mesh_poses.push_back(co.mesh_poses[0]);
co.operation = co.ADD;

std::vector<moveit_msgs::CollisionObject> collision_objects;  
collision_objects.push_back(co);  

// Now, let's add the collision object into the world
ROS_INFO("Add an object into the world");  
planning_scene_interface.addCollisionObjects(collision_objects);

Unfortunately, I cannot use the part pub_co.publish(co);, as my compiler says, it does not know pub_co...

But still with this actually don't need it as the code above, I can't get the object into my world. Instead I get the follwing error when I run it.does what it should do now.

[ INFO] [1427024351.360110501]: Add an object into the world
terminate called after throwing an instance of 'class_loader::LibraryUnloadException'
  what():  Attempt to unload library that class_loader is unaware of.
Aborted (core dumped)

What am I still doing wrong?Thanks and regards

Hi!

I tried hard to implement the mesh entry mentioned by dornhege. Using the code of this question and the information from here I get the following:following (and this does the trick):

moveit_msgs::CollisionObject co;
shapes::Mesh* m = shapes::createMeshFromResource("package://ur5_test/step/table.stl");
shape_msgs::Mesh co_mesh;
shapes::ShapeMsg co_mesh_msg;
shapes::constructMsgFromShape(m,co_mesh_msg);
co_mesh = boost::get<shape_msgs::Mesh>(co_mesh_msg);
co.meshes.resize(1);
co.meshes[0] = co_mesh;
co.mesh_poses.resize(1);
co.mesh_poses[0].position.x = 1.0;
co.mesh_poses[0].position.y = 1.0;
co.mesh_poses[0].position.z = 0.0;
co.mesh_poses[0].orientation.w= 1.0;
co.mesh_poses[0].orientation.x= 0.0;
co.mesh_poses[0].orientation.y= 0.0;
co.mesh_poses[0].orientation.z= 0.0;
//pub_co.publish(co);

co.meshes.push_back(co_mesh);
co.mesh_poses.push_back(co.mesh_poses[0]);
co.operation = co.ADD;

std::vector<moveit_msgs::CollisionObject> collision_objects;  
collision_objects.push_back(co);  

// Now, let's add the collision object into the world
ROS_INFO("Add an object into the world");  
planning_scene_interface.addCollisionObjects(collision_objects);

Unfortunately, I cannot use the part pub_co.publish(co);, as my compiler says, it does not know pub_co...

But actually don't need it as the code does what it should do now.

Thanks and regards