Change orientation of RViz plugin visualization marker

asked 2023-01-17 21:43:27 -0500

hunterlineage1 gravatar image

I am working with the jsk-rviz-plugins package to visualize a camera frustum, particularly the one shown called CameraInfo, as shown here.

In the camera_info_display.cpp file, the PinholeCameraModel class from the image_geometry library provides a simple way to project 2D image points into 3D space, but it assumes a specific orientation of the camera in 3D space. By default, the camera is assumed to be oriented with its optical axis pointing along the positive Z-axis, and its image plane parallel to the XY-plane. I need to change the orientation of the camera in 3D space such that the camera optical axis is along the positive Y-axis and its image plane is parallel to the XZ-plane.

I am guessing I will need to create a transformation matrix that represents the desired orientation and apply it to the 3D points before displaying them in RViz. One of the ways I can do this is to use the Ogre::Matrix4 class to create a transformation matrix and the Ogre::Vector3 class to represent the 3D points. I can then transform the 3D points by first rotating by 90 degrees clockwise along X-axis (-pi/2 radians along X-axis) and then 90 degrees counter-clockwise along the Y axis (+pi/2 radians along Y-axis). How do I perform this change of orientation?

edit retag flag offensive close merge delete