Search code examples
cameraros

Simulate a camera node on ros kinetic


Ros noob here.

I'm trying to create a fake camera node for ros kinetic, in order to test the downstream subscribers that will process the images.

Problem is I have no idea where to start, does this kind of module exist?

I already have the test images that I'll drop into a folder, the camera node have to pick those images and publish them on a topic.

The ultimate goal is test automation in an environment that has no camera USB/IP plugged in. The majority of the tutorials I found focus on real camera input processing, which is not my purpose here.


Solution

  • Cameras in ROS are defined by the image transport, which means not just publishing some images. To fulfill all requirements which allows usage of image transport features you should make use of the image publisher which deals with publishing the image_raw and camera_info topics.

    You can find a very good image transport sample code, which already shows almost a possible solution for your problem. The code loads an image of your device using OpenCV and publishes it as camera. By replacing the image file parameter argv[3] with a directory and some slight modifications, you should be able to load and publish several different images of a directory and publish not only one image.