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

Binding RViz' view camera position and orientation to tf frame

asked 2012-07-18 02:09:56 -0500

updated 2012-07-20 20:23:17 -0500

Hello,

I am working on head-tracking application and utilizing RViz for visualization. I have 3 coordinate frames connected as /world -> /base -> /head.

  • /world - global frame
  • /base - head-tracker frame (fixed to /world)
  • /head - user's head frame in /base

The thing I am trying to achive is make user's head to be a 'camera' in 3D environment. Thus, I need to make /head frame to control RViz' viewport camera position and orientation. So far I managed only to bind /head frame position to the RViz camera by setting it to Target Frame. But frame orientation is ignored in this case.

Is there a way to control RViz camera orientation as well?

Thanks in advance,

Boris

UPDATE: Setting fixed frame to /world or /base does not help.

UPDATE 2:

$ rosrun tf tf_echo /world /base
At time 1342851117.156
- Translation: [0.000, 0.000, 0.500]
- Rotation: in Quaternion [0.500, 0.500, 0.500, 0.500]
            in RPY [1.570, -0.000, 1.570]
// -- duplicating messages -- //
$ rosrun tf tf_echo /base /head
At time 1342851130.635
- Translation: [-0.183, 0.029, -0.722]
- Rotation: in Quaternion [0.010, 0.269, -0.049, 0.962]
            in RPY [-0.008, 0.544, -0.104]
At time 1342851131.636
- Translation: [-0.176, 0.028, -0.732]
- Rotation: in Quaternion [0.037, 0.984, -0.176, 0.018]
            in RPY [-2.789, 0.049, 3.075]
At time 1342851132.631
- Translation: [-0.181, 0.020, -0.745]
- Rotation: in Quaternion [0.041, 0.978, -0.201, 0.025]
            in RPY [-2.739, 0.066, 3.072]
// -- and so on -- //
edit retag flag offensive close merge delete

Comments

What type of view do you have rviz set to? Orbit? FPS? etc?

Eric Perko gravatar image Eric Perko  ( 2012-07-20 20:40:37 -0500 )edit

I tried both Orbit and FPS, does make a big difference. I can see how /head frame is rotating with respect to RViz camera plane. However I need opposite effect - /head frame has to be completely fixed to RViz camera frame.

Boris gravatar image Boris  ( 2012-07-20 21:01:56 -0500 )edit

I am confused about your intention. Do you want the head and camera to stay fixed in rviz and the world to rotate as the head does?

joq gravatar image joq  ( 2012-07-21 07:47:14 -0500 )edit

@joq: Yes, that's exactly what I need. Sorry for confusion.

Boris gravatar image Boris  ( 2012-07-23 01:35:34 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-07-23 01:46:08 -0500

Looks like that "not recommended" option from Wiki suits my needs best, i.e. setting up both Target Frame and Fixed Frame to /head (moving frame).

P.S. I was ignoring this option thinking that view jittering is caused by such setup, but eventually it is because of head tracking errors.

edit flag offensive delete link more

Comments

saved my life, are there any "official" support from rviz for this kind of need?

jiaxin gravatar image jiaxin  ( 2020-08-25 21:34:47 -0500 )edit
0

answered 2012-07-18 03:52:48 -0500

joq gravatar image

updated 2012-07-19 03:35:18 -0500

In rviz, try setting the fixed frame to /world and the target frame to /head.

If that does not work, there is probably something wrong with your transform broadcaster.

EDIT: What do these commands display?

$ rosrun tf tf_echo /world /base
$ rosrun tf tf_echo /base /head
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-07-18 02:09:56 -0500

Seen: 4,369 times

Last updated: Jul 23 '12