Ask Your Question
4

ROS electric arm navigation programmatically adding collision object

asked 2011-10-04 11:00:34 -0500

Ibrahim gravatar image

Hi all,

I'm a little unsure of the proper way to programmatically insert my own custom meshes into the planning scene environment for the ROS electric arm_navigation package. I've been able to insert my own objects in using the planning scene viewer GUI (loading an STL file) but how would I do this programmatically? For instance, I have a model of some object that I want to plan around and I can recognize and align to sensory data, and I want to insert this object into the planning environment when I've recognized it in the scene. What is the correct way to go about doing this? Thanks!

edit retag flag offensive close merge delete

Comments

I would also like to add Collision objectss to the planning scene using the code below, but with ROS Groovy and MoveIt. So far I did not get it to work because the headers are deprecated in Groovy and MoveIt. Does anyone have an idea how to do a similar thing in Groovy+MoveIt?

Wouter gravatar image Wouter  ( 2013-02-27 03:35:35 -0500 )edit

@Ibrahim i am new in ROS and now i am doing motion planing for my Robotic arm . i Generate all the Moveit configuration files .Now i want to insert a Environment . HOW i can load that STL file in mine Moveit demo.launch File

lagankapoor gravatar image lagankapoor  ( 2018-04-16 02:58:42 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
10

answered 2011-10-04 11:43:31 -0500

egiljones gravatar image

Basically what you want to do is load the mesh object, create an arm_navigation_msgs::CollisionObject from that mesh object, and publish it on the '/collision_object' topic. The environment_server listens to this topic and then will include the mesh object in the planning scene, making MoveArm plan around it.

In a bit more detail, here's a sketch of some code:

#include <geometric_shapes/shape_operations.h>
#include <planning_environment/util/construct_object.h>

btVector3 scale(1.0,1.0,1.0);
//filename is either an absolute path or a package:// address
shapes::Mesh* mesh = shapes::createMeshFromFilename(filename, &scale);

arm_navigation_msgs::Shape object;
if(!planning_environment::constructObjectMsg(mesh, object)) {
  ROS_WARN_STREAM("Object construction fails");
}
delete mesh;
arm_navigation_msgs::CollisionObject collision_object;
collision_object.operation.operation = arm_navigation_msgs::CollisionObjectOperation::ADD;
collision_object.header.stamp = ros::Time::now();
collision_object.header.frame_id = WORLD_FRAME_ID;
collision_object.id = "my_object";
collision_object.shapes.push_back(object);
//pose comes from elsewhere and must be set
geometry_msgs::Pose object_recognition_pose;
collision_object.poses.push_back(pose);

//publish on /collision_object topic
collision_object_publisher.publish(collision_object)
edit flag offensive delete link more

Comments

Ok, thanks! I actually tried this last night and I had trouble getting assimp to link properly but I'll try again looking at the CMakelists.txt for the move_arm_warehouse which uses this function too.
Ibrahim gravatar image Ibrahim  ( 2011-10-04 13:05:34 -0500 )edit
there's a rosdep for it in the geometric_shapes package - just make sure you declare a depend on planning_environment - which depends on geometric_shapes - in your manifest and you shouldn't need to mention assimp at all in linking.
egiljones gravatar image egiljones  ( 2011-10-05 04:38:09 -0500 )edit
1
Mm yeah, not sure what was wrong the first time but I got your code snippet to work in my application. Thanks!
Ibrahim gravatar image Ibrahim  ( 2011-10-05 17:50:01 -0500 )edit

how to assign the file name?e.g. my file is /opt/myros/chair.dae, i use createMeshFromFilename("/opt/myros/chair.dae", &scale); but got this error: Error retrieving file [/opt/myros/chair.dae]: <url> malformed

yangyangcv gravatar image yangyangcv  ( 2012-10-31 02:34:56 -0500 )edit

In hydro this createMeshFromFilename has been replaced with createMeshFromResouce: http://docs.ros.org/hydro/api/geometric_shapes/html/namespaceshapes.html#a0747930a810548cc02dc9b8ed0d59ed0

St3am gravatar image St3am  ( 2014-04-02 07:55:14 -0500 )edit
0

answered 2011-10-05 01:09:09 -0500

tom temple gravatar image

Don't forget that you will need to set the "use_collision" to true in the planning environment.

edit flag offensive delete link more

Comments

The parameter "use_collision_map" only controls whether or not the voxelized collision map is subscribed to by the environment server - publishing on the collision_object topic should work as long as the "use_monitor" parameter is set.
egiljones gravatar image egiljones  ( 2011-10-05 04:10:24 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

6 followers

Stats

Asked: 2011-10-04 11:00:34 -0500

Seen: 1,413 times

Last updated: Oct 05 '11