Ask Your Question
1

frame transformation (camera to base) in python

asked 2015-04-14 15:22:32 -0500

ekptwtos gravatar image

Good evening people,

First of all I would like to apologize for my limited understanding in ROS and Python, as I have been experimenting for almost 3 months now.

I am working with Baxter robot and to keep things short, what I am trying to do is to get the position of an object using augmented reality markers and move the hand to that position in order to grasp it.

I am using ar_tools package to get the position/orientation of the object, but that with respect to the head_camera which I am using. The last couple of days I've been experimenting with how to change that reference frame (head_camera) to the base frame as this frame is used by moveit to make the plans. I have tried to set frame_id of the header of the message I receive from the ar_tools manually to 'base' pose_target.header.frame_id = 'base' but the position and orientation I am getting is still WRT the head_camera. I also tried to do a self.tl.lookupTransform("/base", "/head_camera", self.t) where self.t = self.tl.getLatestCommonTime("/head_camera", "/base") but I was getting an extrapolation error. It was something like "the transformation requires to extrapolate in the past" I cant really remember now and Im not in the lab atm. Then I thought I might need to run the lookupTransform from the head_cam to head, from head to torso and from torso to Baxter's base.

My question then is, could someone guide me on how to change the frame of the marker of the ar_tools from head_camera to base. Also, for the extrapolation error, is there a way to do this in a static way?

Would you need more information please let me know.

Thanks in advance,

Mike

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-04-15 12:44:46 -0500

marcoesposito1988 gravatar image

Hi Mike,

ideally you don't need to transform it by hand; it will be automatically done by moveit.

In practice the system might be a bit "deaf" wrt the frame_id attribute of the target pose. In my experience this will help:

mgc.set_pose_reference_frame(pose_target.header.frame_id)
edit flag offensive delete link more

Comments

hello Marco,

and thanks for the reply. I tried this, but i had no luck. it still sees the reference frame as the "/head_camera" and not the "base".

ekptwtos gravatar imageekptwtos ( 2015-04-16 08:24:16 -0500 )edit

oh... now i get it, it changes the planning frame to the frame from ar_pose marker.. yes this way it kinda works.. when i try to set the end effector to go to the position of the object but follows "crazy" trajectories.. when i try to go to the pose , it returns: ABORTED: No motion plan found.

ekptwtos gravatar imageekptwtos ( 2015-04-16 09:50:53 -0500 )edit
1

a follow-up question, the python source doesn't have any set_planning_frame functions, and get_current_pose spits out the pose in the planning_frame. Is there a way to get it in the pose frame instead?

buckley.toby gravatar imagebuckley.toby ( 2017-05-19 13:12:47 -0500 )edit

In the c++ API it is in fact defined as set_reference_frame but in the python API it is called set_pose_reference_frame. Notice the pose difference!

tik0 gravatar imagetik0 ( 2019-08-19 10:04:31 -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

1 follower

Stats

Asked: 2015-04-14 15:22:32 -0500

Seen: 723 times

Last updated: Apr 15 '15