# Rotated camera and rviz problem

**URL:** <https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025>\
**Category:** General Questions\
**Created:** [December 17, 2022, 12:40pm UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025 "2022-12-17T12:40:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krzysztof](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@Krzysztof](https://forum.ubiquityrobotics.com/u/Krzysztof)\
**Post date:** [December 17, 2022, 12:40pm UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025/1 "2022-12-17T12:40:27Z")

</div>

Hello,  
The camera feed provided in RViz and rqt\_image\_view seems to be rotated by 90 degrees (on the photo below, I’m standing on the left side of the robot pointing forward). In the robot.yaml, the Raspicam’s position is configured as ‘upward’, as it should be. I’m using the default calibration files for the Raspberry Pi Camera 2.1. The Raspberry Pi Camera 2.1 is mounted upward and is oriented as per the instructions. I’m aware that the camera is rotated by default, but I’ve only seen a rotation of 180 degrees, not 90.

 ![mountedcamera](https://frm.ubiquityrobotics.com/uploads/default/original/1X/844e56cd13d170b38c62822d81f81996982cdcab.jpeg)

 ![RotatedCamera](https://frm.ubiquityrobotics.com/uploads/default/original/1X/a6cf26eb25e98410867fa4dbb744709d2f365b32.png)  
 ![upward](https://frm.ubiquityrobotics.com/uploads/default/original/1X/00f267b55c83a7c9ffb4004cd5b90e9a12f770eb.png)  
When trying to create map fiducials are displayed perpendicular to the ground level and while rotating, rviz starts to lose location of the fiducials and display them elsewhere as shown on the last picture. I’m assumng it’s due to camera rotation. Can someone help me with that?  
 ![rviz](https://frm.ubiquityrobotics.com/uploads/default/original/1X/b3db0c26c357f1f07601867bb178130c726bf969.png)  
 ![rviz2](https://frm.ubiquityrobotics.com/uploads/default/original/1X/7ae3eb3af561db759fff57793b8d1b0547914b5e.png)  
 ![rviz3](https://frm.ubiquityrobotics.com/uploads/default/original/1X/234b00fb2aeb9b9044f64f3fc798b8f41591e602.png)  
 ![rviz4](https://frm.ubiquityrobotics.com/uploads/default/original/1X/f375a677a3e105ff328c13ec1063ce54e7f50fa5.png)

---

<div class="post-metadata">

**Author:** ![MoffKalast](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/moffkalast/32/214_2.png) [@MoffKalast](https://forum.ubiquityrobotics.com/u/MoffKalast)\
**Post date:** [December 17, 2022, 6:20pm UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025/2 "2022-12-17T18:20:53Z")

</div>

Hmm, I think @anfederman had some similar issues recently, maybe he can help.

It definitely looks like the urdf is wrong there, but checking [the extrinsics file](https://github.com/UbiquityRobotics/magni_robot/blob/noetic-devel/magni_description/extrinsics/camera_extrinsics_upward.yaml) for upward it seems to be correct at least. The rotation should start off with the ribbon cable down, camera facing forward. So the specified `pitch: -1.57` and `yaw: -1.57` ought to rotate it up and to the side as you have it mounted.

It may be more that the launch config is ignoring the /etc yaml file and is still using the default forward config. I think we’ve had such problems before but it should’ve been fixed at some point. I would suggest editing [the default yaml file](https://github.com/UbiquityRobotics/magni_robot/blob/noetic-devel/magni_bringup/config/default_robot.yaml) in your cloned magni\_robot repo and set the value to upward there, and see if anything changes.

---

<div class="post-metadata">

**Author:** ![Krzysztof](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@Krzysztof](https://forum.ubiquityrobotics.com/u/Krzysztof)\
**Post date:** [December 19, 2022, 12:53pm UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025/3 "2022-12-19T12:53:29Z")

</div>

I forgot to mention that I’m using ROS Kinetic with Ubuntu 16.04, so I dont have any extrinsics directory or files. I added more permissions for robot.yaml and it resulted in a temporary rotation of aruco codes in rviz to the ceiling level (but tilted), but after some time the orientation suddenly changed back to the previous one. Could you give me some advice on where to find the default yamls file or extrenics file?

After launching simple\_navigation.launch it says “Parametr change detected” and it worries me.  
Also 2D NavGoal doesn’t work, and there is no respons from the robot, I assumed it could be fault of bad rotation of aruco codes but robot doesnt even move a little.

 ![simplenav](https://frm.ubiquityrobotics.com/uploads/default/original/1X/dbd1aab4a247b4fa377b7e173953e5e7201a7e69.png)  
 ![deafult](https://frm.ubiquityrobotics.com/uploads/default/original/1X/6c77c4ae791c18ac9fe398ac9c024a363dbc07d3.png)  
There is no camera rotation in configuration file and it cannot be added because it results in errors while launching simple\_navigation  
 ![camera](https://frm.ubiquityrobotics.com/uploads/default/original/1X/c809e55ec93cdb805a61f058b9005ce621b9e5b0.png)

---

<div class="post-metadata">

**Author:** ![anfederman](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/anfederman/32/141_2.png) [@anfederman](https://forum.ubiquityrobotics.com/u/anfederman)\
**Post date:** [December 19, 2022, 3:22pm UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025/4 "2022-12-19T15:22:17Z")

</div>

The easiest thing to try is using the Noetic image, but if that isn’t possible, using the upward parameters from the Noetic release.

---

<div class="post-metadata">

**Author:** ![MoffKalast](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/moffkalast/32/214_2.png) [@MoffKalast](https://forum.ubiquityrobotics.com/u/MoffKalast)\
**Post date:** [December 20, 2022, 11:08am UTC](https://forum.ubiquityrobotics.com/t/rotated-camera-and-rviz-problem/1025/5 "2022-12-20T11:08:40Z")

</div>

Hmm. Well as Alan points out, it would be recommended to switch over to noetic since we can only offer limited support for kinetic (none of us are really using it anymore), but if that’s not possible for you here’s what I can think of:

First make sure that all your repos are cloned to kinetic-devel or indigo-devel, the default branches are typically noetic-devel now and are often not backwards compatible due to the python 3 migration.

> There is no camera rotation in configuration file and it cannot be added because it results in errors while launching simple\_navigation

The system for defining that was indeed different back then, I think you should be able to find the rotation hardcoded in one of the xacro files in `magni_description`. Doing a `grep -r "upward" .` will probably find it faster than I can look it up.

Instead of changing the default\_yaml, the changes to the default need to be specified in the `default_conf` variable in [launch\_core.py script](https://github.com/UbiquityRobotics/magni_robot/blob/4c43300e4fc08a37f5206c9db85a6e11105f91d6/magni_bringup/scripts/launch_core.py#L15) in `magni_bringup`.

> After launching simple\_navigation.launch it says “Parametr change detected” and it worries me.

I think that’s a move\_basic setup message, probably just a red herring.
