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

Revision history [back]

This worked for me, maybe it was the .id:

moveit_msgs::CollisionObject co; //shapes::Mesh* m = shapes::createMeshFromResource("package://ur_description/meshes/BODY_X.dae"); shapes::Mesh* m = shapes::createMeshFromResource("package://ur_description/meshes/ur10/collision/base.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.header.frame_id = "/world"; co.id = "base"; co.header.stamp = ros::Time::now(); 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 = 1.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; co.operation = co.ADD;

pub_co.publish(co);