Skip to content

Commit

Permalink
adding version v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bf-houshiar committed May 21, 2024
1 parent 279be5f commit 539949f
Show file tree
Hide file tree
Showing 27 changed files with 1,493 additions and 618 deletions.
34 changes: 31 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,34 @@ Add ticket numbers to all your change notes.

### Removed

## [2.1.0] - 2024.02.29

### Added
* [#53002] Added user management support to the driver

## [2.0.1] - 2024.02.13

### Fixed
* Fixed include issue for standalone build
* Fixed the unix socket connection issue introduced in v2.0.0 due to communication with system for scan patten watch

## [2.0.0] - 2024.02.08

### Added
* [#52246] Added heartbeat and frequency output to diagnostic
* [#52246] Added scan pattern watch and update/add scan pattern info to diagnostic
* [#52246,#50662] Added a watchdog to monitor the connection to Qb2
* [#51237] Added interface for point cloud reader and simplified the get/read from stream of frame

### Changed
* Updated internal module dependencies
* Changed snapshot_frequency with snapshot_frame_rate for compatibility with scan pattern frame_rate
* [#52209,#51091] Extracted the connection methods to Qb2 as a utility function to simplify the code base and allow for sleep between retries
* Expanded the driver status to be self contained and handle all driver status functions

### Removed
* [#51237] Removed duplicated and unnecessary info from diagnostic

## [1.1.3] - 2023.09.29

### Fixed
Expand All @@ -25,7 +53,7 @@ Add ticket numbers to all your change notes.
* [#51146] Adapt buffer size for publisher and subscriber to 1

### Fixed
* [#51052] Fix the documentation of the dependencies
* [#51052] Fix the documentation of the dependencies
* [#51074] Fixed the diagnostic updater re-declaration of period parameter for Yocto
* Fixed calculation of total dropped frames which would always show zero

Expand All @@ -48,10 +76,10 @@ Add ticket numbers to all your change notes.
### Changed
* [#50451] Adding deadline for grpc get api to avoid infinite wait in snapshot driver
* [#50451] Disconnect from the Qb2 if the get api is not successful to allow the system to reconnect during the next try
* [#50451] Fall back on reading one point cloud from stream in snapshot mode only if the get api throws an exception
* [#50451] Fall back on reading one point cloud from stream in snapshot mode only if the get api throws an exception

### Fixed
* [#50928] Fixes the crash of the snapshot driver on disconnect
* [#50928] Fixes the crash of the snapshot driver on disconnect
* [#50451] Fixed the buffering of timer / service call for snapshot if the previous snapshot is in progress, the driver will drop/ignore the request if one snapshot is already in progress

## [1.0.0] - 2023.08.09
Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,19 @@ else()
find_package(daedalus-core-processing REQUIRED)
# needed for connecting to device
find_package(daedalus-hardware REQUIRED)
set(blickfeld-protocol blickfeld-base daedalus-core_processing-protocol daedalus-hardware)
find_package(daedalus-system REQUIRED)
set(blickfeld-protocol blickfeld-base daedalus-core_processing-protocol daedalus-hardware daedalus-system-protocol)
endif()

add_library(qb2_lidar_ros SHARED src/qb2_ros2_utils.cpp src/qb2_lidar_ros.cpp)
add_library(qb2_lidar_ros SHARED
src/qb2_lidar_ros.cpp
src/qb2/point_cloud_getter.cpp
src/qb2/point_cloud_reader.cpp
src/qb2/point_cloud_streamer.cpp
src/qb2/scan_pattern_watcher.cpp
src/utility/qb2_connection_utils.cpp
src/utility/qb2_ros2_utils.cpp
)

target_include_directories(qb2_lidar_ros PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down
42 changes: 21 additions & 21 deletions doc/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ The main function of the Qb2 ROS2 driver is to convert the point cloud data from

Two nodes are available:

. *Qb2Driver*: The live node connects to one Qb2 and publishes the point cloud based on the scan pattern frequency set on the device.
. *Qb2SnapshotDriver*: The snapshot node can connect to multiple Qb2s and request single frames from all connected Qb2s based on the frequency configured for the node. The driver sequentially requests the point clouds from each device and publishes all point clouds onto their respective topics simultaneously and with the same timestamp.
. *Qb2Driver*: The live node connects to one Qb2 and publishes the point cloud based on the scan pattern frame rate set on the device.
. *Qb2SnapshotDriver*: The snapshot node can connect to multiple Qb2s and request single frames from all connected Qb2s based on the frame rate configured for the node. The driver sequentially requests the point clouds from each device and publishes all point clouds onto their respective topics simultaneously and with the same timestamp.

== Supported devices

Expand Down Expand Up @@ -193,9 +193,9 @@ IMPORTANT: The entry list for 'fqdns', 'fqdn_frame_ids' and 'fqdn_point_cloud_to
| `[]`
| The list of topics for publishing the point cloud of each fqdn.

| *snapshot_frequency*
| *snapshot_frame_rate*
| `0.1`
| The frequency (hz) to snapshot a point cloud from the Qb2s, this value should be something between [0, 0.1]. Use 0 to disable the snapshot frequency (the service call can still be used to manually trigger a snapshot).
| The frame rate (hz) to snapshot a point cloud from the Qb2s, this value should be something between [0, 0.1]. Use 0 to disable the snapshot frame rate (the service call can still be used to manually trigger a snapshot).

| *use_measurement_timestamp*
| `false`
Expand All @@ -217,7 +217,7 @@ IMPORTANT: The entry list for 'fqdns', 'fqdn_frame_ids' and 'fqdn_point_cloud_to

== Services

The snapshot driver offers a service call to manually trigger snapshots, in addition to the time based snapshots that can be configured using the 'snapshot_frequency' parameter.
The snapshot driver offers a service call to manually trigger snapshots, in addition to the time based snapshots that can be configured using the 'snapshot_frame_rate' parameter.
To manually trigger the snapshot, utilize the ROS2 service:

[source,bash,indent=1]
Expand All @@ -233,29 +233,29 @@ ros2 service call /trigger_snapshot std_srvs/srv/Trigger
| *device_fqdn*
| The fqdn of the Qb2.

| *connection_status*
| True if the driver is connected to the Qb2, otherwise False.
| *last_frame_success*
| True if the last frame was read successfully from the Qb2, otherwise False.

| *failed_connection_attempts*
| The number of failed connection attempts to Qb2 since the start of the driver.
| *last_frame_duration*
| The time duration for reading the last frame from the Qb2.

| *connection_attempts_since_last_connection*
| The number of connection attempts to Qb2 since the last successful connection.
| *horizontal_field_of_view*
| The horizontal field of view of Qb2 based on the set scan pattern.

| *stream_status*
| True if the point cloud stream channel is created between the driver and the Qb2, otherwise False. The snapshot driver does not open a stream.
| *vertical_field_of_view*
| The vertical field of view of Qb2 based on the set scan pattern.

| *failed_opening_stream_attempts*
| The number of failed attempts to open a point cloud stream to Qb2 since the start of the driver.
| *scanlines_up*
| The number of scanlines during the up-ramping phase of Qb2 based on the set scan pattern.

| *opening_stream_attempts_since_last_opened_stream*
| The number of attempts to open a point cloud stream to Qb2 since the last successful opened stream.
| *scanlines_down*
| The number of scanlines during the down-ramping phase of Qb2 based on the set scan pattern.

| *last_frame_success*
| True if the last frame was read successfully from the Qb2, otherwise False.
| *angle_spacing*
| The horizontal angle between two measurements on a scanline of Qb2 based on the set scan pattern.

| *last_frame_duration*
| The time duration for reading the last frame from the Qb2.
| *scan_pattern_frame_rate*
| The frame rate of Qb2 based on the set scan pattern.

| *total_frames_published*
| The total number of published point cloud frames by the driver since the start.
Expand Down
32 changes: 32 additions & 0 deletions include/qb2/point_cloud_getter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @file
* @copyright Copyright (C) 2024, Blickfeld GmbH
*/

#pragma once

#include "qb2/point_cloud_reader.h"

#include "qb2_driver_status.h"
#include "qb2_ros2_type.h"

#include <rclcpp/rclcpp.hpp>

namespace blickfeld {
namespace ros_interop {
namespace qb2 {

class PointCloudGetter : public PointCloudReader {
public:
using PointCloudReader::PointCloudReader;

/**
* @brief Read the Frame object from Qb2
*
* @return std::pair<CommunicationState, Qb2Frame> The state of communication and the new optional frame object
*/
std::pair<CommunicationState, std::optional<Qb2Frame>> readFrame() final;
};
} // namespace qb2
} // namespace ros_interop
} // namespace blickfeld
54 changes: 54 additions & 0 deletions include/qb2/point_cloud_reader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @file
* @copyright Copyright (C) 2024, Blickfeld GmbH
*/

#pragma once

#include "qb2_driver_status.h"
#include "qb2_ros2_type.h"

#include <rclcpp/rclcpp.hpp>

#include <memory>
#include <optional>
#include <utility>

namespace blickfeld {
namespace ros_interop {
namespace qb2 {

class PointCloudReader {
public:
PointCloudReader(rclcpp::Node::SharedPtr node, const Qb2Info& qb2);

virtual ~PointCloudReader();

/**
* @brief Read the Frame object from Qb2
*
* @return std::pair<CommunicationState, Qb2Frame> The state of communication and the new optional frame object
*/
virtual std::pair<CommunicationState, std::optional<Qb2Frame>> readFrame() = 0;

/**
* @brief Try to cancel the running getter
*
*/
virtual void cancel();

protected:
rclcpp::Node::SharedPtr node_;

/// Device info that we want to connect to
Qb2Info qb2_;

/// Connection channel to the Qb2 gRPC server
std::shared_ptr<grpc::Channel> qb2_channel_;

/// The gRPC client context for Qb2
std::unique_ptr<grpc::ClientContext> point_cloud_context_ = nullptr;
};
} // namespace qb2
} // namespace ros_interop
} // namespace blickfeld
66 changes: 66 additions & 0 deletions include/qb2/point_cloud_streamer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* @file
* @copyright Copyright (C) 2024, Blickfeld GmbH
*/

#pragma once

#include "qb2/point_cloud_reader.h"

#include "qb2_driver_status.h"
#include "qb2_ros2_type.h"

#include <rclcpp/rclcpp.hpp>

namespace blickfeld {
namespace ros_interop {
namespace qb2 {

class PointCloudStreamer : public PointCloudReader {
public:
using PointCloudReader::PointCloudReader;

/**
* @brief Read the Frame object from Qb2
*
* @return std::pair<CommunicationState, Qb2Frame> The state of communication and the new optional frame object
*/
std::pair<CommunicationState, std::optional<Qb2Frame>> readFrame() final;

private:

/**
* @brief Read the Frame object from Qb2.
* The method doesn't cleanup the internal state after connection issues
*
* @return std::pair<CommunicationState, Qb2Frame> The state of communication and the new optional frame object
*/
std::pair<CommunicationState, std::optional<Qb2Frame>> tryReadFrame();

/**
* @brief Attempts to open a point cloud stream if the qb2_channel is connected
*
* @return The state of communication with Qb2, if successful it should return
* CommunicationState::SUCCESS_OPEN_STREAM
*/
CommunicationState openPointCloudStream();

/**
* @brief Checks if the stream is open
*
* @return true
* @return false
*/
bool isStreamingPointCloud() const;

/**
* @brief disconnects from the server and cleans up all internal connection state
*/
void disconnect();

/// Unique pointers for Qb2 streams
std::unique_ptr<grpc::ClientReader<Qb2PointCloudStreamResponse>> point_cloud_stream_ = nullptr;
};
} // namespace qb2
} // namespace ros_interop
} // namespace blickfeld
87 changes: 87 additions & 0 deletions include/qb2/scan_pattern_watcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* @file
* @copyright Copyright (C) 2024, Blickfeld GmbH
*/

#pragma once

#include "qb2_driver_status.h"
#include "qb2_ros2_type.h"

#include <rclcpp/rclcpp.hpp>

#include <optional>

namespace blickfeld {
namespace ros_interop {
namespace qb2 {

class ScanPatternWatcher {
public:
ScanPatternWatcher(rclcpp::Node::SharedPtr node, const Qb2Info& qb2);

~ScanPatternWatcher();

/**
* @brief Watches the scan pattern changes on the Qb2
*
* @return std::pair<CommunicationState, std::optional<Qb2ScanPattern>> The state of communication and the optional
* new scan pattern object
*/
std::pair<CommunicationState, std::optional<Qb2ScanPattern>> watchScanPattern();

/**
* @brief Try to cancel the running watch stream
*
*/
void cancel();


private:
/**
* @brief tries opening a scan patter watch stream and returns a response of the stream.
* The method doesn't cleanup the internal state after connection issues
*
* @return std::pair<CommunicationState, std::optional<Qb2ScanPattern>> The state of communication and the optional
* new scan pattern object
*/
std::pair<CommunicationState, std::optional<Qb2ScanPattern>> tryWatchScanPattern();

/**
* @brief Attempts to open a scan pattern watch if the qb2_channel is connected
*
* @return The state of communication with Qb2, if successful it should return
* CommunicationState::SUCCESS_OPEN_STREAM
*/
CommunicationState openScanPatternWatch();

/**
* @brief disconnects from the server and cleans up all internal connection state
*/
void disconnect();

/**
* @brief Checks if the watch stream is open
*
* @return true
* @return false
*/
bool isWatchingScanPattern() const;

rclcpp::Node::SharedPtr node_;

/// Device info that we want to connect to
Qb2Info qb2_;

/// Connection channel to the Qb2 gRPC server
std::shared_ptr<grpc::Channel> qb2_channel_;

/// The gRPC client context for Qb2 streams
std::unique_ptr<grpc::ClientContext> scan_pattern_watch_context_ = nullptr;

/// Unique pointers for Qb2 streams
std::unique_ptr<grpc::ClientReader<Qb2ScanPatternWatchResponse>> scan_pattern_watch_ = nullptr;
};
} // namespace qb2
} // namespace ros_interop
} // namespace blickfeld
Loading

0 comments on commit 539949f

Please sign in to comment.