Hey Gil, 

Thanks so much. I tried what you suggested and here's the code I have: 

arm_navigation_msgs::Shape trimesh_object; 
trimesh_object.type = arm_navigation_msgs::Shape::MESH; 
btVector3 scale(1.0,1.0,1.0); 
shapes::Mesh *mesh = shapes::createMeshFromFilename("package://.../ship.stl", &scale); 
if(!planning_environment::constructObjectMsg(mesh, trimesh_object)) { 
  ROS_WARN_STREAM("Object construction fails"); 

geometry_msgs::Pose pose; 
collision_object.shapes.push_back(trimesh_object); 
collision_object.poses.push_back(pose); 

Now the meshes are computed into convex hulls without errors, but the problem is: at rviz, Planning Scene /planning_scene_markers topic's pole/0 displays error: 

"Contains invalid floating point values (nans or infs)" 

So maybe the convex hulls or something else are still not computed correctly. I tried different mesh files and got the same error. Maybe it's the Post object's problem? Otherwise it's really hard to figure out why this is happening. I also added this question into here but sadly no one has a clue yet. 

Thanks in advance. 

-Paul


On Sat, Mar 10, 2012 at 9:25 PM, Arkapravo Bhaumik <arkapravobhaumik@gmail.com> wrote:
Consider putting this question to answer.ros, chances are that you may get better replies.


On 11 March 2012 03:11, Paul Heran Yang <heranyang@gmail.com> wrote:
Hi all,

I've been trying to add meshes into collision object, but always get error: "Unable to compute convex hull"

    trimesh_object.type = arm_navigation_msgs::Shape::MESH;
    for (int i = 0; i < 3; i++) {
        geometry_msgs::Point p;
        p.x = i;
        p.y = i+1;
        p.z = i+2;
        trimesh_object.vertices.push_back(p);
    }

    // then add {0, 1, 2} into trimesh_object.triangles
    collision_object.shapes.push_back(trimesh_object);

    geometry_msgs::Pose pose;
    collision_object.poses.push_back(pose);

    ...

    planning_scene_req.planning_scene_diff.collision_objects.push_back(collision_object);
    get_planning_scene_client.call(planning_scene_req, planning_scene_res) ...


All I'm trying to do is just to add a simple triangle into the scene, but so far no luck. The above code just adds {0,1,2},{1,2,3},{2,3,4} into it. I also tried {0,0,1},{0,1,0},{1,0,0}. Nothing works.

I don't get why there's "unable to compute convex hull" error. Thanks in advance.

-Paul


_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users




--
Paul (Heran) Yang
http://heranyang.com
http://heray.tumblr.com
Cornell University
Computer Science, B.S. 2012