Home

Awesome

libcaer_driver

A ROS2 driver for event based cameras using Inilab's Libcaer (Davis, DvXplorer). This driver is not written or supported by Inilabs.

banner image

This driver is intended to be a successor to the University of Zuerich ROS1 driver. The ROS2 port addresses some deficiencies of the ROS1 driver, in particular the performance problems due to the message format. Usage of the event_camera_msgs format allows for higher bandwidth and more efficient storage.

The events can be decoded and displayed using the following ROS/ROS2 packages:

Supported platforms

Tested on the following platforms:

Tested with the following hardware:

There is some code in place for the Davis 346 but that one has never been tested (hardware not available) and thus will not work out of the box. Continuous integration testing covers ROS2 versions Humble and later.

Installation

From packages

sudo apt install ros-${ROS_DISTRO}-libcaer-driver

From source

The build instructions follow the standard procedure for ROS2. Set the following shell variables:

repo=libcaer_driver
url=https://github.com/ros-event-camera/${repo}.git

and follow the ROS2 build instructions here

Make sure to source your workspace's install/setup.bash afterwards.

This driver provides its own version of libcaer (via the libcaer_vendor package), but you still need to copy the udev file into place and modify the group permissions:

sudo cp src/libcaer/lib/udev/rules.d/65-inivation.rules /etc/udev/rules.d/
sudo usermod -aG video ${USER}
sudo usermod -aG plugdev ${USER}
sudo udevadm trigger
sudo service udev restart

Now you need to log out and back in to the host in order for the updated group permissions to take hold.

Driver Features

Driver parameters (besides biases and other device-specific parameters):

How to use:

Use the standard ROS launch procedure to start the driver, for instance:

ros2 launch libcaer_driver driver_node.launch.py device_type:=davis

Edit driver_node.launch.py to set various parameters, or use rqt_reconfigure to modify the parameters on the fly.

For efficient recording of the events you need to run the driver and the recorder in the same address space using ROS2 composable nodes. For this you will need to install the composable recorder into your workspace as well (see below). There are some example launch files provided for launching the combined driver/recorder:

ros2 launch libcaer_driver recording_dvxplorer_composition.launch.py # (run as composable node)

Once the combined driver/record is running, start the recording like so:

ros2 service call /start_recording std_srvs/srv/Trigger

To stop the recording you have to kill (Ctrl-C) the recording driver.

To visualize the events, run a renderer node from the event_camera_renderer package:

ros2 launch event_camera_renderer renderer.launch.py

The renderer node publishes an image that can be visualized with e.g. rqt_image_view

Clock synchronized camera operation

  1. Connect the output sync of the master to the input sync of the slave
  2. When launching the driver, first launch the slave camera, second launch the master. Pass the corresonding parameter master to both drivers, set to True for the master, set to False for the slave.
  3. Check the time synchronization with the sync_test tool from the event_camera_tools package. The base-stamp shift value of both cameras should be small, and the two values should agree to within less than 1ms when both sensors are non-idle, i.e. produce events at a reasonable rate.

Performance comparison to the ROS1 driver

Here are some approximate performance numbers on a 16 thread (8-core) AMD Ryzen 7480h laptop with max clock speed of 2.9GHz. The below numbers were obtained with a DvXplorer (bias sensitivity set to 4, sensor illuminated uniformly with square wave at 600Hz, delivering about 130-145 MeVs, 1150MB/s). Note that at this data rate, the decoding of the USB packets by libcaer saturates the CPU, so some data is lost before it even reaches the driver. ROS event_message_time_threshold was set to 1ms.

ROSconfigurationencodingCPU loadevent rate (*)note
ROS2driver no subscriberlibcaer_cmp100%139 Mev/stopic not publ., libcaer saturates CPU
ROS2driver + recorder (composable)libcaer_cmp188%136 Mev/sno message transport involved
ROS2driver + recorder (nodes)libcaer_cmp172%+25%139 Mev/sFASTRTPS rmw inter-process comm.
ROS2driver + recorder (composable)libcaer253%129 Mev/sno message transport involved
ROS2driver + recorder (nodes)libcaer156%+156%119 Mev/sFASTRTPS rmw inter-process comm.
ROS1driver no subscriberdvs_msgs200%28 Mev/sROS1 libcaer + driver saturate CPU (**)
ROS1driver + recorder (nodelet)dvs_msgs250%26 Mev/sno message transport involved

Notes:

(*) event rates are incoming event rates. (**) the ROS1 driver marshals a ROS message even if there are no subscribers

Storage requirements:

About time stamps

The libcaer event cameras have their own clock which will here be called camera clock. When the driver starts up, it sends a command to the camera to reset the camera clock to zero, but at the same time the driver also records the host time (ROS system clock). Subsequently it always adds that initial host time to the camera clock. This sum of host time and camera clock will be referred to as sensor time. Note that although initially sensor time and host time coincide, they can drift arbitrarily far away from each other due to clock skew.

The time stamps in the different messages refer to different clocks as follows:

Note that the header.stamp for EventPacket messages follows a different(!) convention than the header stamps for IMU and image messages. The reason is that time_base of the EventPacket message already has the sensor time, so header.stamp is used to capture the actual host time. This permits estimation of the clock drift between sensor time and host time, which in turn allows synchronization with data (captured from other sensors) that refers to host time only.

In summary, IMU, image, and individual event times all refer sensor time and can be directly compared to each other. The header stamp in the event packets however does not refer to sensor time.

License

This software is issued under the Apache License Version 2.0.