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

Change kinect orientation in Rviz

asked 2017-06-30 10:22:16 -0500

Thadeu Brito gravatar image

I'm using a Kinect in my project. I was able to open the image obtained by it in Rviz, however the image that appears in the viewer looks on an axis that I want to change.

Apparently the image reproduction is in the Z plane, as if the kinect was installed in the X plane. image description

I used the commands:

roslaunch openni_launch openni.launch

rosrun rviz rviz

Can anyone help me which file should I find to change the playback position of the kinect image?

edit retag flag offensive close merge delete


Can you add more information about your setup? Do you just want to be able to view the point clouds differently in RViz or do you want to actually change the orientation of the point cloud?

velveteenrobot gravatar image velveteenrobot  ( 2017-06-30 13:49:29 -0500 )edit

If you just want to view the point cloud differently, you may be able to get what you want just by changing the Global Options->Fixed Frame in Rviz.

velveteenrobot gravatar image velveteenrobot  ( 2017-06-30 13:56:13 -0500 )edit

If you want to transform the point cloud to a new frame then you can look at the pcl_ros API for transforming point clouds.

velveteenrobot gravatar image velveteenrobot  ( 2017-06-30 13:56:50 -0500 )edit

Thank you for the tips. The image is currently appearing on the YZ plane. I would like to get the image in the XY plane. However changing to Fixed Frame, this does not happen.

Thadeu Brito gravatar image Thadeu Brito  ( 2017-07-02 10:56:05 -0500 )edit

Do you just want to view the point cloud differently in Rviz then? What is the current Fixed Frame in your Rviz? What are the other possible options? You could also just change your viewpoint in the Views Panel

velveteenrobot gravatar image velveteenrobot  ( 2017-07-02 12:31:01 -0500 )edit

I am using the Camera Link option in the Fixed Frame.

Thadeu Brito gravatar image Thadeu Brito  ( 2017-07-03 08:28:55 -0500 )edit

My frame settings are default to openni_launch. I just did: I connected the kinect to my computer; I used the commands: rosrun rviz rviz and roslaunch openni_launch openni.launch; I put the fixed fram in camera link; I added PointCloud2 and I marked the topic as / camera / depth_registered / points

Thadeu Brito gravatar image Thadeu Brito  ( 2017-07-03 08:30:40 -0500 )edit

And now I want to change the point cloud plan. Even if I change the Fixed Frame, the point cloud does not change place. And I would not like to change the view in Rviz.

Thadeu Brito gravatar image Thadeu Brito  ( 2017-07-03 08:31:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-03 16:20:20 -0500

velveteenrobot gravatar image

It sounds like to do what you want, you need to know the desired pose of your viewpoint relative to the current pose of your Kinect (at least approximately depending on how accurate you want this transformation to be). What you want to do is create a new frame that is offset from the camera_link in such a way that it gives the "above" viewpoint of the point cloud that you are looking for. I would recommend trying to estimate where you would want the viewpoint to be and figuring out the offset between that and your current camera_link. Then you could run the following on the command line:

rosrun tf static_transform_publisher x y z yaw pitch roll camera_link new_frame_id 10

This creates a TF frame using the static_transform_publisher. The "x y z yaw pitch roll" arguments are the amounts in each of those dimensions that your desired frame is from your camera_link frame. More details are at that link. It's hard for me to guess at an approximate transform from the image in your question but if you update with an image that has the TF frames shown I might be able to be more specific. Maybe try something like:

rosrun tf static_transform_publisher 0 0 2.0 0 -3.14/4 3.14 camera_link new_frame_id 10

Then change your Fixed Frame in Rviz to the "new_frame_id" and see if you get something similar to the viewpoint you want. If so, then you can take the next step if necessary and transform your point cloud into that frame so that when you access it programmatically it will have the values you want. You can do this using the pcl_ros API.

edit flag offensive delete link more


Thank you very much for your attention! It worked!

Thadeu Brito gravatar image Thadeu Brito  ( 2017-07-04 09:41:33 -0500 )edit

I have a problem after following this method. After rosrun, the point cloud cannot show up.

Dongdong gravatar image Dongdong  ( 2018-11-19 19:12:13 -0500 )edit

Question Tools

1 follower


Asked: 2017-06-30 10:22:16 -0500

Seen: 977 times

Last updated: Jul 03 '17