[Documentation] [TitleIndex] [WordIndex



This package contains a ROS bridge for the VRMagic smart cameras. It includes a ROS server node named vrmagic_ros_bridge_server, and a firmware interface for VRMagic smart cams. The firmware interface is implemented as C++ class (VrMagicHandler_camhost) and needs to be included in the user's application. Smart cam images are transmitted to the vrmagic_ros_bridge_server via this interface. The camhost server provides a ROS multi-channel publisher for the multi-sensor devices.


Clone this package into your catkin workspace as follows.

 $ cd "Path_to_catkin_ws"/src/"
 $ git clone https://github.com/ohm-ros-pkg/vrmagic_drivers.git

ROS Node

The node receives from the VRMagic smart cam an image via the VrMagicHandler_camhost class. Each image must have an ID representing a specific channel. An individual publisher is instanciated for each ID. The node verifies for incoming images whether a publisher is already instanciated. New publishers are created during runtime with the following convention for the topic name: <base_topic> + ID, (e.g. base_topic:"topicname", ID:1 -> "topicname1").


Parameter Name


Default Values


Topic name of image publisher (topicname and ID are concatenated)



IP address of the VRMagic smart cam



PORT of the VRMagic smart cam


Running the ROS Node

Starting the node using rosrun with parameters:

 $ rosrun vrmagic_ros_bridge_server vrmagic_ros_bridge_server_node _pub_name:=<topicname> _ip_smartcam:=<ip> _port_smartcam:=<port>

Example with base_topic: "vrmagic_image_", ip: "", PORT: 1234

 $ rosrun vrmagic_ros_bridge_server vrmagic_ros_bridge_server_node _pub_name:=vrmagic_image_ _ip_smartcam:= _port_smartcam:=1234

Or use a launch file and roslaunch with the parameters described in Parameter

Firmware Interface

To use the ROS bridge you have to be familiar with the VRMagic camera user guide, which you can find on the VRMagic homepage.

The following steps need to be executed:

API Description

To use the ROS bridge in your applications, the folder VrMagicHandler_camhost in firmware/src/ has to be copied in your application's source folder. You have to add all .cpp files in VrMagicHandler_camhost to your Makefile.

The following image shows a uml class diagram for the API of the smart cam firmware


Note: the following explanations are extracted from demo_app.

In the first step a VrMagicHandler_camhost - object must be instanciated. For that the header file from the class needs to be included.

   1  #include "VrMagicHandler_camhost/VrMagicHandler_camhost.h"
   3  unsigned int port = 1234;
   4  ohm::VrMagicHandler_camhost rosBrige(port);

A connection to the ROS server can be established by calling the connect() method. This method blocks until a connection to the ROS server can be established.

   1  rosBrige.connect();

With the method writeImage(ohm::ImageType& image) an image is transmitted to the ROS server. Create and fill an instance of ohm::ImageType with information about the image format. Image data is passed via the pointer variable image_ptr.

IMPORTANT The ROS bridge can handle only monoscaled and BGR images, either with 8 or 16 Bit pixeldepth.

   1  rosImage.id                = sensor_port;                     
   2  rosImage.dataSize          = width * height * bytePerPixel;
   3  rosImage.dataType          = ohm::IMAGE;  //for now only IMAGE is supported
   4  rosImage.compressionType   = ohm::NONE;   //for now only no compression is supported
   5  rosImage.width             = width;
   6  rosImage.height            = height;
   7  rosImage.channels          = 3;
   8  rosImage.bytePerPixel      = 3;
   9  rosImage.data              = image_ptr;   //ensure image to have correct fromat




ID for a channel e.g. sensor port


size of the image data in [byte]


Type of data. For now just image type is available


Type of image compression. For now only uncompressed images are possible


Width of image in [pixel]


Height of image in [pixel]


Channels of image, e.g., MONO = 1, BGR = 3


Bytes used for one pixel (channels x pixeldepth)


Pointer to image data. If the image data is not in the format described in ImageType, then it must be copied in correct format

After filling the ohm::ImageType-object, it must be transmitted to the ROS bridge with the method writeImage(ohm::ImageType& image), see the following code:

   1  rosBrige.writeImage(rosImage);

Typically, this method has to be called after image grabbing.


To compile your application including the ROS bridge class, all source files in the folder VrMagicHandler_camhost(don't forget the TCP/TCP.cpp file) must be included in the Makefile. Don't forget to add the include path to the folder VrMagicHandler_camhost/.

Compile your VRMagic application on your host PC or virtual machine as it is described in the user guide of the smart cam.

Example Application

Note: The demo application is written for a D3-Multisensor smart cam from VRMagic.

This application is based on the simple grabbing example application of VRMagic. The demo application is extended with the ROS bridge interface.

The example application is located in the folder firmware/src/demp_app.

To build the demo application, copy the whole firmware folder to the location where the VRMagic SDK is installed (host PC or virtual machine). Type

 $ cd firmware/
 $ make

to build the demo application.

To execute the demo application, copy the binary in firmware/src/demo_app named ros_bridge_demo_app to your VRMagic smart cam. Now execute the demo application on the VRMagic smart cam:

 $ cd where_you_copied_the_binary/
 $ ./ros_bridge_demo_app

Start the ROS bridge server on the ROS host PC. Now you will find a publisher named <your_base_topicname>1

To visualize the image, the standard ROS image_view package can be used:

 $ rosrun image_view image_view image:=/<your_base_topicname>1

Note: The ROS bridge specific code in the demo application is labeled with the following comments:

   1 //===============================================================
   2     /* ROS bridge specific code here */
   3 //===============================================================

2024-07-06 14:32