Skip to content

Commit

Permalink
Merge pull request #27 from FraunhoferIOSB/noetic-devel
Browse files Browse the repository at this point in the history
Noetic devel -> main
  • Loading branch information
boitumeloruf authored Jan 17, 2024
2 parents 1423c11 + 7627413 commit cfdd85d
Show file tree
Hide file tree
Showing 9 changed files with 458 additions and 34 deletions.
55 changes: 55 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package camera_aravis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.0.4 (2022-12-23)
------------------
* Update package maintainer
* Refactor node params (`#21 <https://github.com/FraunhoferIOSB/camera_aravis/issues/21>`_)
* Refactor node params
* Rename extended_camera_info\_ -> pub_ext_camera_info\_
* Move stream parameters to the top of onInit()
* fix: only reset PTP clock when in "Faulty" or "Disabled" state (`#23 <https://github.com/FraunhoferIOSB/camera_aravis/issues/23>`_)
* Update industrial_ci default branch to main
* Contributors: Dominik Kleiser, Peter Mortimer, Ruf, Boitumelo

4.0.3 (2022-07-08)
------------------
* Refactor image conversion (`#20 <https://github.com/FraunhoferIOSB/camera_aravis/issues/20>`_)
* Use plain file names for includes (`#17 <https://github.com/FraunhoferIOSB/camera_aravis/issues/17>`_)
* Add verbose flag for feature detection (default = false) (`#19 <https://github.com/FraunhoferIOSB/camera_aravis/issues/19>`_)
* Assume num_streams\_ = 1 if DeviceStreamChannelCount and GevStreamChannelCount unavailable (`#18 <https://github.com/FraunhoferIOSB/camera_aravis/issues/18>`_)
* Add Line0 to Line5 to TriggerSource Enum
* Fix: nodelet namespace
* Fix: onInit deadlock
* Contributors: Dominik Kleiser, Boitumelo Ruf, Thomas Emter, Peter Mortimer, tas, Geoff McIver

4.0.2 (2022-05-04)
------------------
* Add optional ExtendedCameraInfo message to publish additional camera acquisition parameters
* Fix: Set reasonable height and width when not given in the CameraInfo
* Contributors: Peter Mortimer

4.0.1 (2022-03-25)
------------------
* Add ROS getter/setter services for camera features
* Add support for multistream encoding conversion
* Fix: Pass on the correct encoding for the additional streams of multisource cameras
* Fix: Continuously check the spawning\_ flag
* Fix: Check spawning\_ flag only once during spawnStream
* Contributors: Peter Mortimer, Thomas Emter, Dominik Kleiser

4.0.0 (2021-10-27)
------------------
* Major refactoring
* Add support for ROS Noetic and aravis-0.6
* Fix several bugs (see git history)
* Add new features:

* Support for multisource cameras
* Zero-copy transport with ROS nodelets
* Camera time synchronization
* Example launch files

* Update package author and maintainer
* Contributors: Dominik Klein, Floris van Breugel, Gaël Écorchard, Thomas Emter, Peter Mortimer, Dominik Kleiser
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ find_package(catkin REQUIRED COMPONENTS
nodelet
std_msgs
sensor_msgs
diagnostic_msgs
message_generation
image_transport
camera_info_manager
Expand All @@ -28,12 +29,14 @@ find_package(catkin REQUIRED COMPONENTS
)
find_package(Aravis REQUIRED)
find_package(GLIB2 REQUIRED)
find_package(yaml-cpp REQUIRED)

generate_dynamic_reconfigure_options(cfg/CameraAravis.cfg)

add_message_files(
FILES
CameraAutoInfo.msg
CameraDiagnostics.msg
ExtendedCameraInfo.msg
)

Expand All @@ -53,6 +56,7 @@ generate_messages(
DEPENDENCIES
std_msgs
sensor_msgs
diagnostic_msgs
)

catkin_package(
Expand All @@ -66,14 +70,17 @@ include_directories(cfg
include
${catkin_INCLUDE_DIRS}
${Aravis_INCLUDE_DIRS}
${GLIB2_INCLUDE_DIRS})
${GLIB2_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIRS}
)

set(LIBRARIES
${catkin_LIBRARIES}
${Aravis_LIBRARIES}
glib-2.0
gmodule-2.0
gobject-2.0
${YAML_CPP_LIBRARY_DIRS}
)

add_library(${PROJECT_NAME}
Expand Down
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ a variety of camera features via the ROS reconfigure_gui, including the followin
* FocusPos (integer)
* mtu (integer)

Note that if the camera parameters are to be initialized from the parameters from the dynamic
reconfigure server, the launch parameter ```init_params_from_dyn_reconfigure``` needs to be set
to ```true``` (Default: ```false```);

Note that the above are also the ROS parameter names of their respective feature. You may
set initial values for the camera by setting ROS parameters in the camera's namespace.

Expand Down Expand Up @@ -101,7 +105,71 @@ with the ROS clock on the PC, and furthermore since it comes from a different pi
the two clock's rates are slightly different.

The solution is to start with a base of ROS time, and to accumulate the dt's from the camera clock.
To accomodate the difference in clock rates, a PID controller gently pulls the result toward
To accommodate the difference in clock rates, a PID controller gently pulls the result toward
ROS time.

### Activating PTP Timestamp

Some cameras support the use of the Precision Time Protocol (PTP) to set the timestamps of the
captured images. To activate it using camera_aravis a couple of launch parameters are available:

- ```use_ptp_timestamp```: General switch to activate the use of the PTP timestamp within
camera_aravis. Set to ```true``` to activate.
- Type: ```bool```
- Default: ```false```
- ```ptp_enable_feature_name```: Feature name on the camera device to enable the use of PTP.
- Type: ```string```
- Default: ```"GevIEEE1588"```
- ```ptp_status_feature_name```: Feature name on the camera device to access the status of the PTP.
This is needed to monitor, whether camera_aravis needs to reset the PTP clock.
- Type: ```string```
- Default: ```"GevIEEE1588Status"```
- ```ptp_set_cmd_feature_name```: Feature name of the 'Set-Command' on the camera device for PTP.
On some cameras a 'set' or 'synchronization' command needs to be executed after setting the features
above for the PTP to be activated. If this launch parameter is set, the corresponding command will
be executed after the parameters above are set.
- Type: ```string```
- Default: ```""```

## Publishing camera diagnostics / status

Camera_aravis allows to periodically monitor custom camera features and publish them in a designated
topic named ```~/diagnostics``` in a message type as specified in
[CameraDiagnostics.msg](msg/CameraDiagnostics.msg). In order to configure and customize this
status monitoring, two launch parameters are provided:

- ```diagnostic_publish_rate```: Rate at which to read and publish the diagnostic data.
- Type: ```double```
- Default: ```0.1``` (10 seconds)
- ```diagnostic_yaml_url```: URL to yaml file specifying the camera features which are to be
monitored. If left empty (as default) no diagnostic features will be read and published.
- Type: ```string```
- Default: ```""```

An example of such a diagnostic yaml file is given in
[camera_diagnostics.yaml](launch/camera_diagnostics.yaml). This file should hold a list of
```FeatureName``` together with a corresponding ```Type``` (bool, float, int, or string) for each
feature which is to be monitored. If a feature is associated with a feature selector, one can
additionally specify a list of ```Selectors```. Each entry in this list should again have a
```FeatureName``` and ```Type```, as well as a ```Value``` to set.

For each feature a key-value pair is constructed and published in the ```data``` field of the
message stated above. If a feature as a list of selectors, one key-value pair is constructed for
each Feature-Selector pair.

## Known Issues

### Slow read of white balance and black level values

From [PR#22](https://github.com/FraunhoferIOSB/camera_aravis/pull/22): The white balance and black
level values of some cameras (e.g. Basler acA2440-20gc & JAI FS-3200D-10GE ) can be read more
efficiently by reading from the exact memory locations of the camera instead of using the Selector
features.

However, since we are not sure on how stable these optimizations based on exact memory locations are
in terms of firmware updates and how well they generalize to other camera models, we have refrained
from merging the pull request into the main repository.

For more information and details on the implementation, please look into the changes and the
comments inside the pull request.

17 changes: 17 additions & 0 deletions include/camera_aravis/camera_aravis_nodelet.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ extern "C" {
#include <camera_info_manager/camera_info_manager.h>
#include <boost/algorithm/string/trim.hpp>

#include <yaml-cpp/yaml.h>

#include <dynamic_reconfigure/server.h>
#include <dynamic_reconfigure/SensorLevels.h>
#include <tf/transform_listener.h>
#include <tf2_ros/static_transform_broadcaster.h>
#include <tf2_ros/transform_broadcaster.h>
#include <camera_aravis/CameraAravisConfig.h>
#include <camera_aravis/CameraAutoInfo.h>
#include <camera_aravis/CameraDiagnostics.h>
#include <camera_aravis/ExtendedCameraInfo.h>

#include <camera_aravis/get_integer_feature_value.h>
Expand Down Expand Up @@ -89,7 +92,12 @@ class CameraAravisNodelet : public nodelet::Nodelet
private:
bool verbose_ = false;
std::string guid_ = "";

bool use_ptp_stamp_ = false;
std::string ptp_enable_feature_ = "GevIEEE1588";
std::string ptp_status_feature_ = "GevIEEE1588Status";
std::string ptp_set_cmd_feature_ = "";

bool pub_ext_camera_info_ = false;
bool pub_tf_optical_ = false;

Expand Down Expand Up @@ -168,6 +176,8 @@ class CameraAravisNodelet : public nodelet::Nodelet

void publishTfLoop(double rate);

void readAndPublishCameraDiagnostics(double rate) const;

void discoverFeatures();

static void parseStringArgs(std::string in_arg_string, std::vector<std::string> &out_args);
Expand Down Expand Up @@ -196,6 +206,13 @@ class CameraAravisNodelet : public nodelet::Nodelet
std::thread tf_dyn_thread_;
std::atomic_bool tf_thread_active_;

std::string diagnostic_yaml_url_ = "";
double diagnostic_publish_rate_ = 0.1;
YAML::Node diagnostic_features_;
ros::Publisher diagnostic_pub_;
std::thread diagnostic_thread_;
std::atomic_bool diagnostic_thread_active_;

CameraAutoInfo auto_params_;
ros::Publisher auto_pub_;
ros::Subscriber auto_sub_;
Expand Down
9 changes: 7 additions & 2 deletions launch/camera_aravis.launch
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
<param name="camera_info_url" value="$(arg camera_info_url)"/>
<param name="frame_id" value="$(arg sensor_name)"/>

<param name="publish_tf" value="true"/>
<param name="tf_publish_rate" value="$(arg fps)"/>
<param name="diagnostic_yaml_url" value="camera_diagnostics.yaml"/>

<!-- use GenICam SFNC names as stream control parameters -->
<param name="PixelFormat" value="$(arg pixel_format)"/>
Expand All @@ -46,6 +45,12 @@
<param name="GainAuto" value="Continuous"/>
<param name="BalanceWhiteAuto" value="Continuous"/>

<param name="use_ptp_timestamp" value="true"/>
<param name="ptp_enable_feature_name" value="PtpEnable"/>
<param name="ptp_status_feature_name" value="PtpStatus"/>
<param name="ptp_set_cmd_feature_name" value="PtpDataSetLatch"/>
<param name="PtpOperationMode" value="Slave"/>

</node>

<!-- Debayer the image -->
Expand Down
18 changes: 18 additions & 0 deletions launch/camera_diagnostics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- FeatureName: DeviceTemperature
Type: float
Selectors:
- FeatureName: DeviceTemperatureSelector
Type: string
Value: Mainboard
- FeatureName: DeviceTemperatureSelector
Type: string
Value: Sensor
- FeatureName: PtpEnable
Type: bool
- FeatureName: PtpClockAccuracy
Type: string
- FeatureName: PtpOperationMode
Type: string
- FeatureName: PtpStatus
Type: string

6 changes: 6 additions & 0 deletions msg/CameraDiagnostics.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Camera diagnostics message

std_msgs/Header header

# Array of key-value pairs holding the diagnostic data
diagnostic_msgs/KeyValue[] data
3 changes: 2 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>camera_aravis</name>
<version>4.0.0</version>
<version>4.0.4</version>
<description>camera_aravis: A complete and comfortable GenICam (USB3Vision and GigEVision) based camera driver for ROS (ethernet and usb).</description>

<maintainer email="[email protected]">Boitumelo Ruf, Fraunhofer IOSB</maintainer>
Expand All @@ -24,6 +24,7 @@
<depend>nodelet</depend>
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>
<depend>diagnostic_msgs</depend>
<depend>image_transport</depend>
<depend>camera_info_manager</depend>
<depend>dynamic_reconfigure</depend>
Expand Down
Loading

0 comments on commit cfdd85d

Please sign in to comment.