Skip to content

Commit cf5d2aa

Browse files
authored
Iron 2.10 (luxonis#589)
1 parent 361e79e commit cf5d2aa

File tree

134 files changed

+4940
-1422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+4940
-1422
lines changed

.github/workflows/main.workflow.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
steps:
3232
- uses: actions/[email protected]
33-
- uses: ros-tooling/setup-ros@0.6.2
33+
- uses: ros-tooling/setup-ros@0.7.8
3434
with:
3535
required-ros-distributions: ${{ env.ROS_DISTRO }}
3636
- uses: ros-tooling/[email protected]
@@ -52,7 +52,7 @@ jobs:
5252
linter: [xmllint, pep257, lint_cmake]
5353
steps:
5454
- uses: actions/[email protected]
55-
- uses: ros-tooling/setup-ros@0.6.2
55+
- uses: ros-tooling/setup-ros@0.7.8
5656
with:
5757
required-ros-distributions: ${{ env.ROS_DISTRO }}
5858
- uses: ros-tooling/[email protected]
@@ -119,4 +119,4 @@ jobs:
119119
no-cache: true
120120
tags: |
121121
luxonis/depthai-ros:${{ steps.vars.outputs.short_ref }}
122-
luxonis/depthai-ros:${{ env.ROS_DISTRO }}-latest
122+
luxonis/depthai-ros:${{ env.ROS_DISTRO }}-latest

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Depthai ROS Repository
22
Hi and welcome to the main depthai-ros respository! Here you can find ROS related code for OAK cameras from Luxonis. Don't have one? You can get them [here!](https://shop.luxonis.com/)
33

4-
You can find the newest documentation [here](https://docs-beta.luxonis.com/software/ros/depthai-ros/intro/).
4+
You can find the newest documentation [here](https://docs.luxonis.com/software/ros/depthai-ros/)

depthai-ros/CHANGELOG.rst

+27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
Changelog for package depthai-ros
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
Changelog for package depthai-ros
5+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
2.10.0 (2024-08-29)
8+
-------------------
9+
## What's Changed
10+
* Adding stl files for SR and LR models by @danilo-pejovic in https://github.com/luxonis/depthai-ros/pull/491
11+
* No imu fix Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/500
12+
* Tracking converter for ROS2 Humble by @daniqsilva25 in https://github.com/luxonis/depthai-ros/pull/505
13+
* Added Env Hooks so that depthai xacro can be used with gazebo sim by @r4hul77 in https://github.com/luxonis/depthai-ros/pull/507
14+
* Fix resource paths for Ignition Gazebo by @Nibanovic in https://github.com/luxonis/depthai-ros/pull/511
15+
* Use simulation flag to decide how to load meshes. by @destogl in https://github.com/luxonis/depthai-ros/pull/524
16+
* Add new launch file for starting multiple rgbd cameras on robots. by @destogl in https://github.com/luxonis/depthai-ros/pull/532
17+
* Missing fields in detection messages Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/574
18+
* Ip autodiscovery fix Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/561
19+
* RS Mode & Sync - Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/578
20+
* Compressed image publishers by @Serafadam in https://github.com/luxonis/depthai-ros/pull/580
21+
* ToF Support Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/581
22+
* WLS fix humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/582
23+
* Syncing & RS updates Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/586
24+
25+
## New Contributors
26+
* @r4hul77 made their first contribution in https://github.com/luxonis/depthai-ros/pull/507
27+
* @Nibanovic made their first contribution in https://github.com/luxonis/depthai-ros/pull/511
28+
* @destogl made their first contribution in https://github.com/luxonis/depthai-ros/pull/524
29+
30+
**Full Changelog**: https://github.com/luxonis/depthai-ros/compare/v2.9.0-humble...v2.10.0-humble
431

532
2.9.0 (2024-01-24)
633
-------------------

depthai-ros/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
cmake_minimum_required(VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS
22

3-
project(depthai-ros VERSION 2.9.0 LANGUAGES CXX C)
3+
project(depthai-ros VERSION 2.10.0 LANGUAGES CXX C)
44

55
set(CMAKE_CXX_STANDARD 14)
66

77
find_package(ament_cmake REQUIRED)
88

99

10-
ament_package()
10+
ament_package()

depthai-ros/package.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
22
<package format="3">
33
<name>depthai-ros</name>
4-
<version>2.9.0</version>
4+
<version>2.10.0</version>
55
<description>The depthai-ros package</description>
66

77
<!-- One maintainer tag required, multiple allowed, one person per tag -->
88
<!-- Example: -->
99
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
10-
<maintainer email="sachin@luxonis.com">sachin</maintainer>
10+
<maintainer email="adam.serafin@luxonis.com">Adam Serafin</maintainer>
1111
<author>Sachin Guruswamy</author>
1212

1313
<license>MIT</license>

depthai_bridge/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS
22
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
33

4-
project(depthai_bridge VERSION 2.9.0 LANGUAGES CXX C)
4+
project(depthai_bridge VERSION 2.10.0 LANGUAGES CXX C)
55

66
set(CMAKE_CXX_STANDARD 14)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -41,6 +41,7 @@ find_package(tf2_ros REQUIRED)
4141
find_package(tf2 REQUIRED)
4242
find_package(tf2_geometry_msgs REQUIRED)
4343
find_package(composition_interfaces REQUIRED)
44+
find_package(ffmpeg_image_transport_msgs REQUIRED)
4445

4546
set(dependencies
4647
camera_info_manager
@@ -56,6 +57,7 @@ set(dependencies
5657
tf2_geometry_msgs
5758
tf2
5859
composition_interfaces
60+
ffmpeg_image_transport_msgs
5961
)
6062

6163
include_directories(
@@ -72,6 +74,8 @@ file(GLOB LIB_SRC
7274
"src/ImuConverter.cpp"
7375
"src/TFPublisher.cpp"
7476
"src/TrackedFeaturesConverter.cpp"
77+
"src/TrackDetectionConverter.cpp"
78+
"src/TrackSpatialDetectionConverter.cpp"
7579
)
7680

7781
add_library(${PROJECT_NAME} SHARED ${LIB_SRC})

depthai_bridge/include/depthai_bridge/ImageConverter.hpp

+38-21
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
#include "depthai-shared/common/CameraBoardSocket.hpp"
1111
#include "depthai-shared/common/Point2f.hpp"
1212
#include "depthai/device/CalibrationHandler.hpp"
13+
#include "depthai/pipeline/datatype/EncodedFrame.hpp"
1314
#include "depthai/pipeline/datatype/ImgFrame.hpp"
15+
#include "ffmpeg_image_transport_msgs/msg/ffmpeg_packet.hpp"
1416
#include "rclcpp/time.hpp"
1517
#include "sensor_msgs/msg/camera_info.hpp"
18+
#include "sensor_msgs/msg/compressed_image.hpp"
1619
#include "sensor_msgs/msg/image.hpp"
1720
#include "std_msgs/msg/header.hpp"
1821

@@ -22,7 +25,10 @@ namespace ros {
2225

2326
namespace StdMsgs = std_msgs::msg;
2427
namespace ImageMsgs = sensor_msgs::msg;
28+
namespace FFMPEGMsgs = ffmpeg_image_transport_msgs::msg;
2529
using ImagePtr = ImageMsgs::Image::SharedPtr;
30+
using FFMPEGImagePtr = FFMPEGMsgs::FFMPEGPacket::SharedPtr;
31+
using CompImagePtr = ImageMsgs::CompressedImage::SharedPtr;
2632

2733
using TimePoint = std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>;
2834

@@ -47,7 +53,7 @@ class ImageConverter {
4753
* @param update: bool whether to automatically update the ROS base time on message conversion
4854
*/
4955
void setUpdateRosBaseTimeOnToRosMsg(bool update = true) {
50-
_updateRosBaseTimeOnToRosMsg = update;
56+
updateRosBaseTimeOnToRosMsg = update;
5157
}
5258

5359
/**
@@ -80,10 +86,20 @@ class ImageConverter {
8086
*/
8187
void setAlphaScaling(double alphaScalingFactor = 0.0);
8288

89+
/**
90+
* @brief Sets the encoding of the image when converting to FFMPEG message. Default is libx264.
91+
* @param encoding: The encoding to be used.
92+
*/
93+
void setFFMPEGEncoding(const std::string& encoding);
94+
8395
void toRosMsg(std::shared_ptr<dai::ImgFrame> inData, std::deque<ImageMsgs::Image>& outImageMsgs);
8496
ImageMsgs::Image toRosMsgRawPtr(std::shared_ptr<dai::ImgFrame> inData, const sensor_msgs::msg::CameraInfo& info = sensor_msgs::msg::CameraInfo());
8597
ImagePtr toRosMsgPtr(std::shared_ptr<dai::ImgFrame> inData);
8698

99+
FFMPEGMsgs::FFMPEGPacket toRosFFMPEGPacket(std::shared_ptr<dai::EncodedFrame> inData);
100+
101+
ImageMsgs::CompressedImage toRosCompressedMsg(std::shared_ptr<dai::ImgFrame> inData);
102+
87103
void toDaiMsg(const ImageMsgs::Image& inMsg, dai::ImgFrame& outData);
88104

89105
/** TODO(sachin): Add support for ros msg to cv mat since we have some
@@ -99,36 +115,37 @@ class ImageConverter {
99115
Point2f bottomRightPixelId = Point2f());
100116

101117
private:
118+
void planarToInterleaved(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
119+
void interleavedToPlanar(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
102120
static std::unordered_map<dai::RawImgFrame::Type, std::string> encodingEnumMap;
103121
static std::unordered_map<dai::RawImgFrame::Type, std::string> planarEncodingEnumMap;
104122

105123
// dai::RawImgFrame::Type _srcType;
106-
bool _daiInterleaved;
124+
bool daiInterleaved;
107125
// bool c
108-
const std::string _frameName = "";
109-
void planarToInterleaved(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
110-
void interleavedToPlanar(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
111-
std::chrono::time_point<std::chrono::steady_clock> _steadyBaseTime;
126+
const std::string frameName = "";
127+
std::chrono::time_point<std::chrono::steady_clock> steadyBaseTime;
112128

113-
rclcpp::Time _rosBaseTime;
114-
bool _getBaseDeviceTimestamp;
129+
rclcpp::Time rosBaseTime;
130+
bool getBaseDeviceTimestamp;
115131
// For handling ROS time shifts and debugging
116-
int64_t _totalNsChange{0};
132+
int64_t totalNsChange{0};
117133
// Whether to update the ROS base time on each message conversion
118-
bool _updateRosBaseTimeOnToRosMsg{false};
119-
dai::RawImgFrame::Type _srcType;
120-
bool _fromBitstream = false;
121-
bool _convertDispToDepth = false;
122-
bool _addExpOffset = false;
123-
bool _alphaScalingEnabled = false;
124-
dai::CameraExposureOffset _expOffset;
125-
bool _reverseStereoSocketOrder = false;
126-
double _baseline;
127-
double _alphaScalingFactor = 0.0;
134+
bool updateRosBaseTimeOnToRosMsg{false};
135+
dai::RawImgFrame::Type srcType;
136+
bool fromBitstream = false;
137+
bool dispToDepth = false;
138+
bool addExpOffset = false;
139+
bool alphaScalingEnabled = false;
140+
dai::CameraExposureOffset expOffset;
141+
bool reversedStereoSocketOrder = false;
142+
double baseline;
143+
double alphaScalingFactor = 0.0;
144+
int camHeight = -1;
145+
int camWidth = -1;
146+
std::string ffmpegEncoding = "libx264";
128147
};
129148

130149
} // namespace ros
131150

132-
namespace rosBridge = ros;
133-
134151
} // namespace dai

depthai_bridge/include/depthai_bridge/TFPublisher.hpp

+36-24
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44
#include "geometry_msgs/msg/quaternion.hpp"
55
#include "geometry_msgs/msg/transform_stamped.hpp"
66
#include "nlohmann/json.hpp"
7-
#include "rclcpp/node.hpp"
7+
#include "rclcpp/logger.hpp"
88
#include "rclcpp/parameter_client.hpp"
99
#include "tf2_ros/static_transform_broadcaster.h"
1010

11+
namespace rclcpp {
12+
class Node;
13+
} // namespace rclcpp
14+
1115
namespace dai {
1216
namespace ros {
1317
class TFPublisher {
1418
public:
15-
explicit TFPublisher(rclcpp::Node* node,
19+
explicit TFPublisher(std::shared_ptr<rclcpp::Node> node,
1620
const dai::CalibrationHandler& calHandler,
1721
const std::vector<dai::CameraFeatures>& camFeatures,
1822
const std::string& camName,
@@ -27,7 +31,8 @@ class TFPublisher {
2731
const std::string& camYaw,
2832
const std::string& imuFromDescr,
2933
const std::string& customURDFLocation,
30-
const std::string& customXacroArgs);
34+
const std::string& customXacroArgs,
35+
const bool rsCompatibilityMode);
3136
/**
3237
* @brief Obtain URDF description by running Xacro with provided arguments.
3338
*/
@@ -53,43 +58,50 @@ class TFPublisher {
5358
* Frame names are based on socket names and use following convention: [base_frame]_[socket_name]_camera_frame and
5459
* [base_frame]_[socket_name]_camera_optical_frame
5560
*/
56-
void publishCamTransforms(nlohmann::json camData, rclcpp::Node* node);
61+
void publishCamTransforms(nlohmann::json camData, std::shared_ptr<rclcpp::Node> node);
5762
/**
5863
* @brief Publish IMU transform based on calibration data.
5964
* Frame name is based on IMU name and uses following convention: [base_frame]_imu_frame.
6065
* If IMU extrinsics are not set, warning is printed out and imu frame is published with zero translation and rotation.
6166
*/
62-
void publishImuTransform(nlohmann::json json, rclcpp::Node* node);
67+
void publishImuTransform(nlohmann::json json, std::shared_ptr<rclcpp::Node> node);
6368
/**
6469
* @brief Check if model STL file is available in depthai_descriptions package.
6570
*/
6671
bool modelNameAvailable();
6772
std::string getCamSocketName(int socketNum);
68-
std::unique_ptr<rclcpp::AsyncParametersClient> _paramClient;
69-
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> _tfPub;
70-
std::string _camName;
71-
std::string _camModel;
72-
std::string _baseFrame;
73-
std::string _parentFrame;
74-
std::string _camPosX;
75-
std::string _camPosY;
76-
std::string _camPosZ;
77-
std::string _camRoll;
78-
std::string _camPitch;
79-
std::string _camYaw;
80-
std::string _imuFromDescr;
81-
std::string _customURDFLocation;
82-
std::string _customXacroArgs;
83-
std::vector<dai::CameraFeatures> _camFeatures;
84-
rclcpp::Logger _logger;
85-
const std::unordered_map<dai::CameraBoardSocket, std::string> _socketNameMap = {
73+
std::unique_ptr<rclcpp::AsyncParametersClient> paramClient;
74+
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> tfPub;
75+
std::string camName;
76+
std::string camModel;
77+
std::string baseFrame;
78+
std::string parentFrame;
79+
std::string camPosX;
80+
std::string camPosY;
81+
std::string camPosZ;
82+
std::string camRoll;
83+
std::string camPitch;
84+
std::string camYaw;
85+
std::string imuFromDescr;
86+
std::string customURDFLocation;
87+
std::string customXacroArgs;
88+
std::vector<dai::CameraFeatures> camFeatures;
89+
bool rsCompatibilityMode;
90+
rclcpp::Logger logger;
91+
const std::unordered_map<dai::CameraBoardSocket, std::string> socketNameMap = {
8692
{dai::CameraBoardSocket::AUTO, "rgb"},
8793
{dai::CameraBoardSocket::CAM_A, "rgb"},
8894
{dai::CameraBoardSocket::CAM_B, "left"},
8995
{dai::CameraBoardSocket::CAM_C, "right"},
9096
{dai::CameraBoardSocket::CAM_D, "left_back"},
9197
{dai::CameraBoardSocket::CAM_E, "right_back"},
9298
};
99+
const std::unordered_map<dai::CameraBoardSocket, std::string> rsSocketNameMap = {
100+
{dai::CameraBoardSocket::AUTO, "color"},
101+
{dai::CameraBoardSocket::CAM_A, "color"},
102+
{dai::CameraBoardSocket::CAM_B, "infra2"},
103+
{dai::CameraBoardSocket::CAM_C, "infra1"},
104+
};
93105
};
94106
} // namespace ros
95-
} // namespace dai
107+
} // namespace dai

0 commit comments

Comments
 (0)