From Zero to Image Robotics Edition

Check out a short tutorial for a ROS-Driver for Basler Cameras to publish images from the cam. Supported are Basler cameras with USB 3.0 and GigE and also the dart cameras. It is developed by Magazino GmbH.


A ROS-Driver for Basler Cameras

developed by Magazino GmbH, using the pylon Software Camera Suite by Basler AG, written for the ROS Wiki





This package offers many functions of the Basler-pylon API inside the ROS-Framwork.

The package supports Baslers USB 3.0, GigE as well as the DART cameras.

Images can continuously be published over _ /image_raw  or the  /image_rect _ topic. The latter just in case the intrinsic calibration matrices are provided through the  camera_info_url  parameter.

The camera-characteristic parameter such as hight, width, projection matrices and camera_frame were published over the _ /camera_info _ topic. Furthermore an action-based image grabbing with desired exposure, gain, gamma and / or brightness is provided. Hence one can grab a sequence of images with above target settings as well as a single image.

Adapting camera's settings regarding binning (in x and y direction), exposure, gain, gamma and brightness can be done using provided _ set_* _ services. These changes effect the continuous image acquisition and hence the images provided through the image topics.

The default node operates in Software-Trigger Mode. This means that the image acquisition is triggered with a certain rate and the camera is not running in the continuous mode.

The package opens either a predefined camera (using a given 'device_user_id' parameter) or, if no camera id is predefined the first camera device it can find.



The package has been tested for ROS-Indigo. For other ROS versions, please replace 'indigo' with your desired ROS-Version in the following install instructions.

The pylon_camera-pkg requires the pylonSDK to be installed on your system. In order to build the package, you need to configure rosdep (i.e. the ROS command-line tool for checking and installing system dependencies for ROS packages) such that it knows how to resolve this dependency. This can be achived by executing the following commands:


sudo sh -c 'echo "yaml\_camera/indigo-devel/rosdep/pylon\_sdk.yaml"; > /etc/ros/rosdep/sources.list.d/15-plyon_camera.list'


rosdep update

Then, clone the pylon_camera-pkg, and the camera_control_msgs-pkg and install the pylon SDK in your catkin_ws:


cd ~/catkin_ws/src/ && git clone\_camera.git && git clone\_control\_msgs.git


rosdep install --from-paths . --ignore-src --rosdistro=$ROS_DISTRO -y

Build the pylon_camera package as you would build a standard ROS-package unsing p.e.


cd ~/catkin_ws && catkin_make



All parameters are listed in the default config file:  config/default.yaml


Common parameters


  • The tf frame under which the images were published


  • The DeviceUserID of the camera. If empty, the first camera found in the device list will be used


The CameraInfo URL (Uniform Resource Locator) where the optional intrinsic camera calibration matrices are stored. This URL string will be parsed from the CameraInfoManager:

binning_x & binning_y

  • Binning factor to get downsampled images. It refers here to any camera setting which combines rectangular neighborhoods of pixels into larger "super-pixels." It reduces the resolution of the output image to (width / binning_x) x (height / binning_y). The default values binning_x = binning_y = 0 are considered the same as binning_x = binning_y = 1 (no subsampling).


The desired publisher frame rate if listening to the topics. This parameter can only be set once at start-up. Calling the GrabImages-Action can result in a higher frame rate.


Image Intensity Settings

The following settings do  NOT  have to be set. Each camera has default values which provide an automatic image adjustment resulting in valid images


  • The exposure time in microseconds to be set after opening the camera.


  • The target gain in percent of the maximal value the camera supports. For USB-Cameras, the gain is in dB, for GigE-Cameras it is given in so called 'device specific units'.


  • Gamma correction of pixel intensity. Adjusts the brightness of the pixel values output by the camera's sensor to account for a non-linearity in the human perception of brightness or of the display system (such as CRT).


  • The average intensity value of the images. It depends the exposure time as well as the gain setting. If '**exposure**' is provided, the interface will try to reach the desired brightness by only varying the gain. (What may often fail, because the range of possible exposure values is many times higher than the gain range). If '**gain**' is provided, the interface will try to reach the desired brightness by only varying the exposure time. If '**gain**' AND '**exposure**' are given, it is not possible to reach the brightness, because both are assumed to be fix.


Only relevant, if  'brightness' is set: The brightness_continuous flag controls the auto brightness function. If it is set to false, the brightness will only be reached once. Hence changing light conditions lead to changing brightness values. If it is set to true, the given brightness will be reached continuously, trying to adapt to changing light conditions. This is only possible for values in the possible auto range of the pylon API which is e.g. [50 - 205] for acA2500-14um and acA1920-40gm

exposure_auto & gain_auto

Only relevant, if  'brightness' is set: If the camera should try to reach and / or keep the brightness, hence adapting to changing light conditions, at least one of the following flags must be set. If both are set, the interface will use the profile that tries to keep the gain at minimum to reduce white noise. The exposure_auto flag indicates, that the desired brightness will be reached by adapting the exposure time. The gain_auto flag indicates, that the desired brightness will be reached by adapting the gain.


Optional and device specific parameter


  • The MTU size. Only used for GigE cameras. To prevent lost frames configure the camera has to be configured with the MTU size the network card supports. A value greater 3000 should be good (1500 for RaspberryPI)


  • The inter-package delay in ticks. Only used for GigE cameras. To prevent lost frames it should be greater 0. For most of GigE-Cameras, a value of 1000 is reasonable. For GigE-Cameras used on a RaspberryPI this value should be set to 11772.



The pylon_camera_node can be started over the launch file which includes a config file with desired parameters as frame rate or exposure time


roslaunch pylon_camera pylon_camera_node.launch


rosrun pylon_camera pylon_camera_node

Images were only published if another node connects to the image topic. The published images can be seen using the image_view node from the image_pipeline stack:


rosrun image_view image_view image:=/pylon_camera_node/image_raw



Please provide your qustions via and tag them with  'pylon_camera'


GitHub Repository


Nikolas Engelhard
pushed dec893b2023e0188f83776edf5f20b6000185540
Removed basler-logos, added link to new official driver
2019-10-07 13:31:08 UTC
Mehdi Tlili
pushed 2a7a06803e04ce1658ed423eab63491b5892dc7c
2019-03-14 09:14:42 UTC
Mehdi Tlili
pushed 41f6288c30c555a4d50d4d71b7baa80574431759
Merged in unstable/regionofinterest (pull request #12)
2019-03-14 09:13:22 UTC
Mehdi Tlili
pushed 3bd28b8a44c2b988b1b6c5827734c98f410f166b
2019-03-13 17:11:30 UTC
Mehdi Tlili
pushed 8b1d2c22b7929cd1dc14f3064bf4cd3770440377
Merged in unstable/finddevice (pull request #11)
2019-03-13 17:09:34 UTC
Mehdi Tlili
pushed 33fb6ec21cf8097fe64d864b112bbaa76ad33c6b
If no device id is given, loop over all available devices until finding a valid one
2019-03-07 16:09:11 UTC
Mehdi Tlili
pushed 0aa636fb191982be52c41b9e7b9affc3e8fca592
Add support or area of interest selection through service call
2019-03-06 15:34:58 UTC
Nikolas Engelhard
pushed 4ebf175616dbc0a36d2e3f5928b051e1a52e7bc7
2019-02-07 16:37:25 UTC
Nikolas Engelhard
pushed 263a2434dd9cf79ceb2208bdc9331a9599a0b3ce
Merged in unstable/diagnostics (pull request #10)
2019-02-07 16:36:41 UTC
Nikolas Engelhard
pushed 317d58790cda2bf85d982e82e6ad2d863b30cd6e
aded diagnostics
2019-02-07 15:44:20 UTC
Ulrich Klank
pushed e1660323ba48e4d8b5dd833557c3f89c9c873731
2018-12-20 11:00:36 UTC
Mehdi Tlili
pushed 2a48605b439a314f019647b15dc5a7ef56450891
Merged in unstable/succeedSetBool (pull request #9)
2018-12-20 10:55:16 UTC
Mehdi Tlili
pushed 34156dbafad6fe90be6737e48c74ade0ae6b79c3
Set success to true before returning result
2018-12-19 14:39:32 UTC
Uli Klank
pushed 4954c86442e53ef637d5b04b97f750fd87916d72
Merged in unstable/auto_flash (pull request #8)
2018-12-14 12:40:38 UTC
Nikolas Engelhard
pushed feccb96aa482234cd3ca21af57601b74a519c5f7
some fixes
2018-12-12 15:16:37 UTC
Nikolas Engelhard
pushed 4f4893fb05b4aab8041d4388646a0a0812f5fa4a
fixed +2 offset for activate_flash-services
2018-12-12 14:19:08 UTC
Nikolas Engelhard
pushed c132f05fd7938c13572c406755546350f66b4e65
exceptions for servies
2018-12-12 13:40:44 UTC
Nikolas Engelhard
pushed 5e339b69296eadfc542cf4c761bf2bd86b83ce2b
first version for script to collect images with different flashes
2018-12-12 12:33:27 UTC
Nikolas Engelhard
pushed d22f3f40e984406afcd3c7eff8bbec6b393ccc14
filling auto_flash_line_2_ (3) parameter from parameter server
2018-12-12 10:33:29 UTC
Ulrich Klank
pushed 18120347739ee3c4458f4226691d9279e82fcf4b
Fix for vector exception, better default parameters
2018-12-11 15:25:01 UTC
Ulrich Klank
pushed 2e7d2c5cdbbdb3f2a7917e2d43b99a016ef57659
Support for online change of autoflash
2018-11-02 15:58:44 UTC
Ulrich Klank
pushed ced4d4fb1b1a68877eddb2e8b6be8590dad606ec
Removed maintainer
2018-07-13 13:53:52 UTC
Ulrich Klank
pushed cf3b209208a1a3634cef10cb4f41f223744c51b0
2018-06-19 10:52:42 UTC
Uli Klank
pushed 0ae919b8727316c85a63daf3a611faf139b06b96
Merged in unstable/toru31 (pull request #7)
2018-05-30 14:57:13 UTC
Uli Klank
pushed 41ff5106e6d9abe5489b01f803bc2f7d2aab48a2
Merged in unstable/SW-1912 (pull request #6)
2018-05-30 14:52:22 UTC
Nikolas Engelhard
pushed 97e5579afb847552a482bc262da2081c6aacb6e1
possible fix for setting device_user_id if it was not set by user
2018-05-25 11:36:27 UTC
Ulrich Klank
pushed 78582fb6f5679a5f816d0bb0e7d20515a5cab497
Parameter for auto flash control
2018-05-25 07:30:33 UTC
Ulrich Klank
pushed d4d810c88e89a30460e7ab1928761b8cc38083fd
Propagating the device user id back to ros params server, if not set
2018-05-22 13:53:23 UTC
Ulrich Klank
pushed c465dbad2d3d57a12c9e4fc8c9b393eceb322766
Publish camera info when requested, but deactivate images grabbed when not
2018-05-17 11:50:25 UTC
Ulrich Klank
pushed d1b7d18b0c4467015b5f05369153a547616ef6f1
testing hack
2018-05-17 10:37:07 UTC

Project State

Public Project


Software Licence: Project has no software
Hardware Licence: Project has no hardware

Project Tags




Does this project pique your interest?

Login or register to join or follow this project.

Back to top

Your comments, please!

Want to comment this ... Show more