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

Update subframe of collision object?

asked 2022-01-12 08:58:16 -0500

anonymous user

Anonymous

updated 2022-01-14 03:22:01 -0500

Hello everyone,

I'm trying to update the subframe of a collision object, but this gives me quite some struggles. To clarify a bit: I am simulating picking an apple. The apple is modelled as a sphere which has a subframe positioned at the spheres' center, with the z-axis always pointing upward towards the stem. To ease approach for the robot, I want to rotate the subframe around the z-axis and have one axis approximately pointing towards the robot base link. I am using ROS2 Foxy and MoveIt2 on Ubuntu 20.04, with Rviz for visualisation.

The situation is as follows:

  • I spawn a sphere-shaped collision object, with a certain orientation. I also give it a subframe with the exact same orientation. This works nicely and I can plan a path using this subframe.
  • After identifying the target apple, I want to rotate the subframe of the apple around its z-axis. I manage to extract the collision object and subframe information from the planning scene interface, and then do some linear algebra. This is not the problem. However, when I try to apply this subframe to the collision object again, this does not work, I can see that the path planning still uses the initial subframe.
  • It is possible to remove the apple from the planning scene and create a new one with the new subframe, but that seems quite a bit of unnecessary actions for what I aim to do.

So far, I tried to update the subframe using both object.operation = object.MOVE and object.operation = object.APPEND, but this does not rotate the frame. I also tried this with adding the current pose as well, and also with ADD, but all with no result.

moveit_msgs::msg::CollisionObject object;
object.header.frame_id = "base_link";
object.id = "object_name";
object.subframe_names.resize(1);
object.subframe_poses.resize(1);
object.subframe_names[0] = "middle";
object.subframe_poses[0].position.x = pos_x; 
object.subframe_poses[0].position.y = pos_y;
object.subframe_poses[0].position.z = pos_z; 
object.subframe_poses[0].orientation = tf2::toMsg(transformed_quaternion);
object.operation = object.MOVE;
psi.applyCollisionObject(object);

Does anyone have an idea whether this is possible and if so, how? I hope this question and information is clear enough, thanks a lot in advance!

edit retag flag offensive close merge delete

Comments

1

Hi @sabine in case you don’t get a response. Consider using the MoveIt Discord channel: https://discord.com/invite/RrySut8

osilva gravatar image osilva  ( 2022-01-13 16:39:58 -0500 )edit
1

For everyone interested: I did not find a solution to updating a subframe. However, I did manage a workaround, by keeping the subframe and sphere untouched and publishing the new frame using a TF broadcaster and using that frame for planning. This works basically the same as the planning by frame as shown in the subframes tutorial.

anonymous userAnonymous ( 2022-01-28 08:01:25 -0500 )edit

Great! Thank you for sharing.

osilva gravatar image osilva  ( 2022-01-28 09:01:10 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-02-18 15:32:22 -0500

tfoote gravatar image

Answer from comments:

For everyone interested: I did not find a solution to updating a subframe. However, I did manage a workaround, by keeping the subframe and sphere untouched and publishing the new frame using a TF broadcaster and using that frame for planning. This works basically the same as the planning by frame as shown in the subframes tutorial.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2022-01-12 07:03:29 -0500

Seen: 146 times

Last updated: Feb 18 '22