# How to Test my Camera?

**URL:** <https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702>\
**Category:** Pi Image\
**Created:** [January 11, 2021, 2:37pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702 "2021-01-11T14:37:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 11, 2021, 2:37pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/1 "2021-01-11T14:37:43Z")

</div>

I’ve just bought a Magni Robot. I’ve installed everything. I use a PC with installed Ubuntu 16.04.7 LTS. I have installed ROS according to your instructions. I have established a connection with the robot and I have tested the following programs:

`rosrun teleop_twist_keyboard teleop_twist_keyboard.py`  
`roslaunch magni_demos simple_navigation.launch`

Now I want to test the camera

1. Here is my ~/.bashrc file (two of the lines that I set)  
export ROS\_MASTER\_URI=http://ubiquityrobot.local:11311  
export ROS\_HOSTNAME=tiho.local

2. I made the following test:  
raspistill -o test.jpg  
There was no error

3. I made the folowing test:  
rosrun image\_view image\_view image:=/raspicam\_node/image  
There is a problem with the camera ([INFO] [1610375568.998749404]: Using transport “raw”)  
I have 2 terminals:  
Terminal 1: Connected to the robot and ROS started with roscore  
Terminal 2: Host PC and written instruction:  
rosrun image\_view image\_view image:=/raspicam\_node/image

There is something wrong in my work with the camera  
Please help!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 12, 2021, 1:44am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/2 "2021-01-12T01:44:31Z")

</div>

For step 2 the file you made called test.jpg can be viewed if you get it to a pc and use some form of jpg image viewer.

For your step 3: Take a look at section 4.1 of this page: [https://learn.ubiquityrobotics.com/verification](https://learn.ubiquityrobotics.com/verification)  
I think it will solve your problem with seeing live video from the raspicam.

In order to use image\_view you must start a process to publish the camera image to /raspicam\_node ROS topic. You are missing that step.  
A second problem with what you did is default is to assume a ‘raw’ image but it is compressed.  
So on above page in section 4.1 you will see this command:

```auto
rosrun image_view image_view image:=/raspicam_node/image _image_transport:=compressed 

```

Hope this helps,  
Mark

---

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 12, 2021, 11:13am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/3 "2021-01-12T11:13:24Z")

</div>

Hi

Thank you for your help!  
I’ve tested successfully my camera and it is working fine. Here is my screenshot. I have one warning related with the camera calibration. I didn’t execute this task because I don’t know how.  
Here is my work in step by step:

1. Terminal 1 - Connection to magni robot and starting roscore
2. Terminal 2 - Connection to magni robot and starting this command  
roslaunch raspicam\_node camerav2\_1280x960.launch
3. Terminal 3 - Connection to my workstation and starting this command  
rosrun image\_view image\_view image:=/raspicam\_node/image \_image\_transport:=compressed

Now I can see a live video from raspicam.  
The warning is in terminal 2, telling me that the camera calibration file /home/ubuntu/ .ros/camera\_info/camerav2\_1280x960.yaml not found.  
How can I resolve this problem? Could you please help?

 ![Screenshot from 2021-01-12 13-01-37](https://frm.ubiquityrobotics.com/uploads/default/original/1X/3e5fbfb84b144e32916b06531f0c1ed92c56677b.png)  
Thank you in advance!

---

<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:** [January 12, 2021, 3:12pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/4 "2021-01-12T15:12:58Z")

</div>

Well there’s two options that could cause that warning: either the yaml is actually missing (you can generate one using the [camera calibrator](http://wiki.ros.org/camera_calibration)) or the launch file may be having problems parsing the path.

The latter has happened to me once or twice, the quick workaround is to replace the dynamic package syntax (i.e. package://etc.) to an absolute path that you can get with pwd. Using $(find raspicam\_node) should also work.

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 13, 2021, 4:16am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/5 "2021-01-13T04:16:24Z")

</div>

As a general point, you will likely very much want to know what is on our document site not just for this but for a great many other things. That site will likely be extremely helpful for many reasons. Please be sure you know about and have looked here: [https://learn.ubiquityrobotics.com/](https://learn.ubiquityrobotics.com/)

Besides the link MoffKalast has supplied also if you really feel you need a camera calibration then see midway into our camera page here: [https://learn.ubiquityrobotics.com/camera\_sensors](https://learn.ubiquityrobotics.com/camera_sensors) another link that I feel is more specific and with pictures that are directly for the cal required with raspicam for camera calibration is at the end of our discussion of Camera Calibration and is thus: [http://wiki.ros.org/camera\_calibration/Tutorials/MonocularCalibration](http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration)

That warning only matters if you want to use the camera frames to precisely measure or inspect things like Fiducials. If you are not using fiducials for navigation it is likely you are just fine because it defaults to some fairly close cal defaults. Making your own camera calibration data is quite involved frankly. So if you don’t need it, don’t go there is my advice. Do you really need a calibrated camera?

---

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 13, 2021, 12:21pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/6 "2021-01-13T12:21:02Z")

</div>

Thank you for your help!

I’ve started to calibrate my camera.  
I followed the instructions from github, made in my PC not in magni robot

1. I didn’t try the installation instructions but I jumped to the Build instructions
2. Go to cd ~/catkin\_ws/src
3. git clone [https://github.com/UbiquityRobotics/raspicam\_node.git](https://github.com/UbiquityRobotics/raspicam_node.git)
4. Go to /etc/ros/rosdep/sources.list.d/ - creating 30-ubiquity.list and adding: yaml [https://raw.githubusercontent.com/UbiquityRobotics/rosdep/master/raspberry-pi.yaml](https://raw.githubusercontent.com/UbiquityRobotics/rosdep/master/raspberry-pi.yaml)
5. rosdep update
6. cd ~/catkin\_ws
7. rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y

Here I received the following error:

ERROR: the following packages/stacks could not have their rosdep keys resolved  
to system dependencies:  
rqt\_mypkg: Cannot locate rosdep definition for [rqt\_gui plugin="${prefix} /plugin.xml"/\>]

Then I have deleted the directory rqt\_mypkg. I received the following error:  
E: Unable to locate package libraspberrypi0  
ERROR: the following rosdeps failed to install  
apt: command [sudo -H apt-get install -y libraspberrypi0] failed

Please, help to resolve this problem!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 14, 2021, 8:12am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/7 "2021-01-14T08:12:05Z")

</div>

If you use our image there is zero need to pull and compile the raspicam\_node, it is all there on the image already. Try not to overcomplicate your dev. Please tell me what part of our learn pages told you to pull and remake raspicam\_node. I want to fix this by removing that part of the instructions.

At this time because the image is now in some unknown state I suggest you get a clean image from Nov 2020 and then go right to this page: [http://wiki.ros.org/camera\_calibration/Tutorials/MonocularCalibration](http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration)

Mark

---

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 15, 2021, 1:08pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/8 "2021-01-15T13:08:27Z")

</div>

Hi

How I can get a clean image from Nov 2020? I have a PC with ubuntu 16.04.7 LTS and ROS installed. I tried to launch the fiducial follow application. Here is my step by step work:

1. Print the marker 49
2. Log in magni robot
3. Open Terminal 1 for magni robot and check the robot software:  
rosnode list

Here is the result:  
/controller\_spawner  
/joint\_state\_publisher  
/joy\_node  
/motor\_node  
/robot\_state\_publisher  
/rosbridge\_ws/rosapi  
/rosbridge\_ws/rosbridge\_websocket  
/rosbridge\_wss/rosapi  
/rosbridge\_wss/rosbridge\_websocket  
/rosout  
/teleop\_twist\_joy  
/tf2\_web\_republisher

1. Start the application  
roslaunch magni\_demos fiducial\_follow.launch

The magni robot started to look for the marker rotating around. I put the marker in front of the robot but the robot was rotating again. I’ve checked the camera starting the image viewer:  
roslaunch raspicam\_node camerav2\_1280x960.launch - Terminal 1 (magni robot)  
rosrun image\_view image\_view image:=/raspicam\_node/image \_image\_transport:=compressed - Terminal 2 (workstation)

There is a live view of the camera.

I checked the camera with  
raspistill -o cam.jpg

It was OK, without errors

Could you please help? Thank you again!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 17, 2021, 11:26am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/9 "2021-01-17T11:26:11Z")

</div>

Hello,  
You have likely done this but because you have not stated it exactly let me make clear this point.

The only reason for the PC on 16.04 is to be able to monitor what the robot is doing perhaps from viewing video images in this case.

The fiducial\_follow application must be launched on the robot itself.   
This means you must do something like an ssh session to the Magni robot from your workstation.

You cannot run fiducial follow on the PC.

Next: The magni robot must have the proper IP address of your laptop and your laptop name in the magni robot /etc/hosts file. This is a common issue of confusion.

Hope this helps,  
Mark

---

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 18, 2021, 1:04pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/10 "2021-01-18T13:04:21Z")

</div>

The application fiducial\_follow doesn’t work.  
Here is my step by step work:

1. Print the marker 49
2. Switch on magni robot and log in to its network
3. Open Terminal 1 for magni robot and check the robot software:  
rosnode list
4. Start the application roslaunch magni\_demos foducial\_follow.launch

The magni robot started to look for the marker rotating around. I put the marker in front of the camera but without success.

I know that I have to control the robot via ssh session through my workstation. I can see the camera images in real time. I can control the robot using the phone application. I can control the robot by the PC keyboard too. But I can’t control the magni robot using fiducials. I think that the configuration related with the laptop IP and the magni robot is OK once I can launch the application with keyboard control.

Please help!

---

<div class="post-metadata">

**Author:** ![tiho\_bg](https://forum.ubiquityrobotics.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@tiho\_bg](https://forum.ubiquityrobotics.com/u/tiho_bg)\
**Post date:** [January 19, 2021, 12:20pm UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/11 "2021-01-19T12:20:40Z")

</div>

When I show the marker to the magni robot he is starting to go to the marker and stops when it is 1 meter from the robot. On this way it can follow me. I think that the application is working now. If I use better camera is it possible to use the same application? Could you please advise? Thank you!

---

<div class="post-metadata">

**Author:** ![mjstn2011](https://forum.ubiquityrobotics.com/user_avatar/forum.ubiquityrobotics.com/mjstn2011/32/30_2.png) [@mjstn2011](https://forum.ubiquityrobotics.com/u/mjstn2011)\
**Post date:** [January 22, 2021, 9:29am UTC](https://forum.ubiquityrobotics.com/t/how-to-test-my-camera/702/12 "2021-01-22T09:29:28Z")

</div>

Glad you were able to get it going now.  
Using a different camera gets very complex for config, calibration and config files and so on.  
I will say that if you wanted to mess around with that on your own you would learn a great deal if you get it to work. We have experimented and used assorted cameras for different things from time to time so yes it is certainly ‘possible’ but rather involved frankly.

The pieces at a very high level are at least these things:

- have a proper camera driver to be able to generate a ROS topic with an image stream
- Optionally generate a camera calibration file although for fiducial follow that is not super important
- Change several ROS launch files so that correct camera resolution is specified for the image topic

I will say that EVERY time I do it I get confused and I have done it at least 6 times.  
So beware and do not try that unless you really really need to do it or you very much want to do a deep dive into ROS and learn a lot of things on your own.

Have fun and good luck,  
Mark
