attach a collision object to a frame

422 views
Skip to first unread message

Marcello Chiurazzi

unread,
Aug 20, 2015, 10:05:47 AM8/20/15
to MoveIt! Users
Hi, i'm trying to avoid collision with object in the environment.
I can create a collision object with a shape,position and orientation. the question is can i set position and orientation automatically, connecting this object to a fixed frame???

Marcello Chiurazzi

unread,
Aug 20, 2015, 10:07:32 AM8/20/15
to MoveIt! Users

the code is very similar to the tutorial on moveit:


moveit_msgs::CollisionObject collision_object;

  collision_object.header.frame_id = group.getPlanningFrame();



  /* The id of the object is used to identify it. */

  collision_object.id = "box1";





  /* Define a box to add to the world. */

  shape_msgs::SolidPrimitive primitive;

  primitive.type = primitive.BOX;

  primitive.dimensions.resize(3);

  primitive.dimensions[0] = 0.005;

  primitive.dimensions[1] = 0.35;

  primitive.dimensions[2] = 0.05;



  /* A pose for the box (specified relative to frame_id) */

  geometry_msgs::Pose box_pose;

  box_pose.orientation.x = eps[0];

  box_pose.orientation.y = eps[1];

  box_pose.orientation.z = eps[2];

  box_pose.orientation.w = eta;

  box_pose.position.x =Pos(0);

  box_pose.position.y =Pos(1);

  box_pose.position.z =Pos(2)+0.4;



  collision_object.primitives.push_back(primitive);

  collision_object.primitive_poses.push_back(box_pose);

  collision_object.operation = collision_object.ADD;



  std::vector<moveit_msgs::CollisionObject> collision_objects;

  collision_objects.push_back(collision_object);



  ROS_INFO("Add an object into the world");



  do{



  // Now, let's add the collision object into the world



  planning_scene_interface.addCollisionObjects(collision_objects);



  /* Sleep so we have time to see the object in RViz */

  sleep(2.0);

........ the continue is useless for the problem

Yoan Mollard

unread,
Aug 20, 2015, 10:45:23 AM8/20/15
to Marcello Chiurazzi, MoveIt! Users
Hi Marcello,

In general, the field "frame_id" is the frame you're attaching this object to.
Just change:
collision_object.header.frame_id = "my_moving_frame"
Best,

Yoan Mollard
Research engineer – 3rd hand project

INRIA Research center, Flowers lab


Marcello Chiurazzi

unread,
Aug 20, 2015, 10:58:25 AM8/20/15
to MoveIt! Users
you're right,thanks

Solved ;)

Yoan Mollard

unread,
Aug 20, 2015, 11:16:11 AM8/20/15
to Marcello Chiurazzi, MoveIt! Users

Yoan Mollard
Research engineer – 3rd hand project

INRIA Research center, Flowers lab


From: "Marcello Chiurazzi" <chiurazzi...@gmail.com>
To: "Yoan Mollard" <yoan.m...@inria.fr>
Sent: Thursday, 20 August, 2015 4:55:37 PM
Subject: Re: attach a collision object to a frame

hi and thanks for your reply.
Ok,so asserting position=0,0,0 and orientation=0,0,0,1 a have it exactly the object at the position and orientation of the frame.
If i can advantage of your experience can i ask to you how i can attach a mech(STL or DAE) to this collision object??

Anyway thanks for your precious help

Regards
--
Marcello Chiurazzi

-----------------------------------------
Phone: 3356979421
Trav. Vincenzo Scala 30

Reply all
Reply to author
Forward
0 new messages