0
$\begingroup$

I have a quaternion coming from a ros tf tree that is representing the orientation of my camera. I am trying to set these values for a blender script to render a scene, but the camera looks into the wrong direction, compared to when I visualize the quaternion within rviz(ros visualization tool). So I assume there is some fixed rotation that I need to apply between the tf exported quaternions and the beldner quaternions, but I'm not sure which one. Example pictures will make clear what I mean:

The box I'm trying to render is where box_corner_tracker is enter image description here

The camera in rviz looks along the z(blue) axis. The perspective here is slightly changed, but imaging the box being there where the camera frame is looking with the z(blue) axis. enter image description here

Now when I enter some example values into blender you can see that the camera look completely into the wrong direction: enter image description here The tooltip in blender for quaternions says wxyz am I right to assume that this is the order the values need to be entered(I did it this way)?

I'm not sure what the problem is but I assume that my question is what is the transformation between the looking direction of the blender camera and it's z-vector?

$\endgroup$
1
$\begingroup$

If you have a look at any camera in Blender with local transformation orientation selected, you will see that in Blender cameras look at negative z direction, up is positive y and right is positive x: enter image description here

You will need to match whatever camera orientation is used in the software you are importing from. It might even be that some axis is inverted in another software.

$\endgroup$
  • $\begingroup$ Funny just found out the same, that was it thank you :) $\endgroup$ – Hakaishin Sep 10 '18 at 10:48
  • $\begingroup$ Actually any idea what the benefit of an inverted z axis is? x,y,z all positive seems to be the natural case, so why did they change it? $\endgroup$ – Hakaishin Sep 10 '18 at 11:05
  • $\begingroup$ I have no idea, to be honest. It might make sense to have positive x go from left to right and y from bottom to top. But I don't know. I guess it is a random choice that made sense to someone at the time of programming. It seems to me Blender is made as if you were looking down to your scene so up is behind the camera. I discussed it in depth with a colleague once and we came to a conclusion that it is possible to find reasons for pretty much any way of arranging the axis. I don't think any one way makes more sense than the others. $\endgroup$ – Martin Z Sep 10 '18 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.