dinsdag 9 juni 2015

The best webcam on ROS indigo

It is pretty hard to find a good list of 'known good' cameras on ROS.
However, as ROS supports UVC (USB video class) searching for a camera that supports this is great.

Also, a wide angle camera is a success factor to consider.
For many applications have a large field of view is perfect.

Testing cameras
a simple way to test cameras is using guvcview.
syntax:

guvcview
OR
guvcview -d /dev/video1  (or whichever device id the camera is connected to)

you can install guvcview with sudo apt-get install guvcview

Of course, you can also test the camera with the ROS usb_cam package as described in this post.

Cameras tested

  • Logitech C270
  • Logitech HD C615
  • Logitech HD C910
  • Logitech HD C920
  • Microsoft Lifecam Studio - Works with usb_cam but gives extremely bright images.   Functionally unusable.  It is labelled a widescreen camera and the field of view is almost as good as the Logitech C910
  • Media-tech MT4047 - Camera requires a different pixelformat setting (yuyv instead of mjpeg). However, after a few frames the camera seems to freeze
  • G-Cube compactcam
My personal absolute favorite is the Logitech HD C920. It is light sensitive, gives a clear picture and largest field-of-view of all cameras tested by me.

Field of view comparison


Simulate your turtlebot in Gazebo

Getting Gazebo up-and-running is described well on the ROS wiki. Here is a short summary.


Step 1: install turtlebot simulator
sudo apt-get install ros-indigo-turtlebot-simulator

Step 2: start gazebo
roslaunch turtlebot_gazebo turtlebot_world.launch


Step 3: start rviz
roslaunch turtlebot_rviz_launchers view_robot.launch


Step 4: launch your other nodes 
For example you can launch the teleop to control your turtlebot and drive it around in the simulator using:
roslaunch turtlebot_teleop keyboard_teleop.launch

Note on world files:
Gazebo can be launched with the world file as parameter.
they can be relative to the existing path, an absolute path or be located in /usr/share/gazebo-<version>/
a subfolder /worlds actually contains a few interesting ones

Stability
Gazebo is not the most stable product. ROS indigo comes with version 2. ROS jade comes with version 5. While ROS jade is available at the time of writing this post, the Turtlebot packages are not. I am axiously looking out for the Turtlebot packages for ROS jade so that I can see if Gazebo indeed deliveres the expected stability improvement.

Gazebo started ok on my machine but gave segmentation faults (exit code 139) later on. I found that this could be due to URDF parsing problems. The following line solved that for me:
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH"

Extra models in Gazebo
You can add extra elements to the Gazebo world. Gazebo has an option to import models from an online repository. You can also download this repository locally using :

hg clone https://bitbucket.org/osrf/gazebo_models

maandag 8 juni 2015

Webcam on ROS

For many applications having a webcam running on ROS makes a lot of sense. Getting it running is not very difficult. As always, there are some choices to make.

On ROS indigo, the default driver is libuvc_camera but this is not the best one. The package uvc_cam used to be excellent but is no longer maintained. The best package I know of is usb_cam which I'll be using here.

Here is how to get it working in five simple steps:
Step 1: 
in a catkin workspace / src folder do:
git clone https://github.com/bosch-ros-pkg/usb_cam.git

Step 2:
then run catkin_make from the catkin workspace root folder.

Step 3:
Make sure the <catkin_workspace>/devel/setup.bash file is sourced.

Step 4:
Create a .launch file with the following contents:
<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video1" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_raw"/>
    <param name="autosize" value="true" />
  </node>
</launch>

change the /dev/video1 to /dev/video0 if needed.
Mostly, on a laptop video0 would be the built-in device and video1 would be the external usb webcam.

Step 5:
roslaunch <newly created launchfile>