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

Obtaining Camera Pose via TF

asked 2019-03-06 04:23:50 -0500

Jägermeister gravatar image

updated 2019-03-06 04:24:26 -0500

I have the calibration board fixed on the work station, and I have its world coordinates, entered them in URDF, all good. I used OpenCV's pose estimation module to find the board's pose (rvecs and tvecs) from the camera frame as well. This also is OK. However, I want to get the camera pose (from the world frame) and to do that I think I need to use TF. So basically, we can formulate the problem as follows:

Given:

World -> Board (board in world frame)

Board -> Camera (board in camera frame)

Find:

World -> Camera (world in camera frame, and vice versa, camera in the world frame).

I have the world and board in my URDF, but since I don't have my camera (which is what I am trying to find out anyway), I don't know how I could utilise TF functionalities.

Does anyone have an experience with this setup?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-03-06 04:54:54 -0500

Delb gravatar image

You just have to create a tf listener between your two frames, there is a tutorial in the wiki showing you how to do that.

You can also take a look at the code of tf_echo.

edit flag offensive delete link more

Comments

1

This isn't really an answer tbh. Seeing linked ROS tutorial pages is not why I asked the question. If you have a concrete example showing slightly how this unestablished link between the camera and the world could be created, be my guest. Otherwise, anyone can Google these pages and source files.

Jägermeister gravatar image Jägermeister  ( 2019-03-06 05:12:30 -0500 )edit
1

Maybe I haven't understand your question but you said that your inputs are a link between world and board and a link between board and camera. So your tf tree is world -> board -> camera right ? The tf listener will make the calculation between each link...

Delb gravatar image Delb  ( 2019-03-06 07:24:19 -0500 )edit
1

... eventhough they are not directly connected. If you run :

rosrun tf tf_echo world camera

You will get the camera pose in relation to world.

Delb gravatar image Delb  ( 2019-03-06 07:25:54 -0500 )edit

You understood it well, that's exactly what I am after. Without having a direct connection, I want to get the camera pose with respect to world. In order words world -> camera.

Jägermeister gravatar image Jägermeister  ( 2019-03-06 09:08:08 -0500 )edit

That's the answer yes, we can add that to the answer's body.

Jägermeister gravatar image Jägermeister  ( 2019-03-06 09:08:55 -0500 )edit
1

For completeness, the line you were looking for in the tutorial was listener.lookupTransform("/camera", "/world", ros::Time(0), transform);, tf_echo just outputs the result to the command line.

fvd gravatar image fvd  ( 2019-03-19 06:25:34 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2019-03-06 04:23:50 -0500

Seen: 1,461 times

Last updated: Mar 06 '19