Robotics StackExchange | Archived questions

Convert from RViz camera location (eye + focus points) to Gazebo (just pose)

I'm trying to control both the RViz and Gazebo cameras simultaneously. The RViz part is solved by using this code, but the pose it publishes for the camera makes sense only for the position; I don't really get what the orientation represents, but for sure is not what gazebo understands. Gazebo expects an orientation pointing from the camera location to the focus.

I have tried to compute such a pose, and got almost there (I think) by calculating a quaternion with the rotation from +x vector to the vector connecting eye and focus, but still I get weird behavior (video here)

Has anyone tried to do something like this, or knows how to to the vector - vector -> quaternion calculation properly?

Thanks!

Asked by jorge on 2021-04-18 08:04:31 UTC

Comments

Answers

I can answer myself now. Just need to

On RViz's camera orientation, +z axis points in the focus-to-eye vector's direction, but in Gazebo the camera's +x axis is expected to point towards the focus. So I Just need to rotate by 0, pi/2, pi/2 (ypr) Required changes

In case anyone needs something similar, the other component (modify Gazebo camera pose by the received pose) is here.

Asked by jorge on 2021-05-12 11:53:55 UTC

Comments