Archive for January 2011
Overlaying opencv on ROS
This post is a series of instructions on how to use your own version of the opencv library with ROS. If you’ve had trouble doing this then you’re probably familiar with these instructions — while they are good in general, they are misleading because they assume that you are using the latest version of ROS, which I’d guess is not true for most people. Anyway, here is the story in more detail if you have no idea what these terms refer to:
opencv is an open source computer vision library. It provides implementations of the most popular computer vision algorithms that have appeared in the vision research literature. Needless to say that it evolves very quickly. The latest version is 2.2 and provides support for a large number of feature detectors and descriptors, aside from the classical SIFT and SURF. In case you didn’t know, it also provides face detection and recognition classifiers, image segmentation, object recognition, tracking, and many other goodies.
ROS stands for Robot Operating System. I guess it’s fair to say that its aim is to become for robots what Linux became for computers. ROS is the software platform running on the PR2. It provides support for many sensors and offers abstraction layers that allow roboticists to share code more easily. Code in ROS is organized into entities that are called “nodes,” which communicate with each other by exchanging standardized messages. For instance, ROS offers a node for firewire cameras, which publishes image messages. An image viewing program listens for image messages and when it gets a message it displays it on the screen. The point here is that the communication between the publisher and the listener relies on a standard image message interface, which means that I can write the former and you can write the latter, and we won’t have problems sharing our code. ROS is designed to be distributed, its nodes may run on different machines in the same network. This is all good news, because for the first time (?) the robotics community has a software platform that is very well designed, takes care of most details, and is not going to die soon because of low contribution.
But anyway, I have digressed. This is not a fanboy post about ROS and opencv. My problem was that the latest stable distribution of ROS, called “cturtle,” comes with opencv 2.1, while I wanted 2.2. Since many nodes in ROS depend on opencv, changing its version means that you have to recompile a big part of the system. This page helped a lot, but it didn’t work for me, because it assumed that I was running the latest (unstable?) version of ROS. As a result, compilation was unsuccessful. Here’s what worked at the end:
- Create a file called something like cturtle_overlay.rosconfig and paste the following in it:
- svn: uri: https://code.ros.org/svn/ros-pkg/stacks/vision_opencv/tags/cturtle local-name: vision_opencv - svn: uri: https://code.ros.org/svn/ros-pkg/stacks/image_transport_plugins/tags/cturtle local-name: image_transport_plugins - svn: uri: https://code.ros.org/svn/ros-pkg/stacks/image_pipeline/tags/cturtle local-name: image_pipeline - svn: uri: https://code.ros.org/svn/wg-ros-pkg/stacks/web_interface/tags/cturtle local-name: web_interface
- Create a directory named something like cturtle_overlay on your local workspace.
- Run “rosinstall ~/some-path/cturtle_overlay /opt/ros/cturtle ~/some-path/cturtle_overlay.rosconfig”
- Edit “~/some-path/cturtle_overlay/vision_opencv/opencv2/Makefile” in order to specify the version of opencv source you’d like to fetch. In my case it was:
SVN_URL = https://code.ros.org/svn/opencv/branches/2.2/opencv
SVN_REVISION = -r4351
- Append “source ~/some-path/cturtle_overlay/setup.sh” in your bashrc file, and make sure that the paths in setup.sh are correct.
- Run “rosmake -a”
Hopefully, everything will go smoothly after this.
Cool courses
This semester the Computer Science department at McGill is offering a couple of courses for which my friends and I are very excited. The first one is Structure and Dynamics of Networks, which apparently is otherwise known as Network Science, but it really should be called Applied Graph Theory for Large Graphs. Naming aside, the lectures seem to be very promising, as examples will involve networks from different areas, such as biology, political and social science etc.
The second one is Topics in Game Theory, where I believe we’ll study algorithms for selecting strategies to minimize the probability of loss (or maximize the probability of winning) in games where there are many participants. Or at least, that’s what I am expecting — the syllabus doesn’t seem to be posted yet.
Last but not least, the graduate Mobile Robotics class is offered again this year. This course starts with lecture-style material in the first half, during which the students are exposed to motion planning algorithms, sensors, and some fundamental problems in algorithmic robotics. The second half consists of student presentations of research papers. The class is highly interactive and lots of fun.