Skip to content

Commit

Permalink
Noetic 2.10.1 (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serafadam authored Sep 19, 2024
1 parent e4e7013 commit 10ce437
Show file tree
Hide file tree
Showing 83 changed files with 3,100 additions and 1,250 deletions.
23 changes: 23 additions & 0 deletions depthai-ros/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
Changelog for package depthai-ros
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.10.1 (2024-09-18)
-------------------
* Fix ToF synced publishing
* Add camera_info publishing when publishing compressed images
* Catch errors when starting the device

2.10.0 (2024-08-29)
-------------------
* Adding stl files for SR and LR models by @danilo-pejovic in https://github.com/luxonis/depthai-ros/pull/491
* No imu fix Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/500
* Tracking converter for ROS2 Humble by @daniqsilva25 in https://github.com/luxonis/depthai-ros/pull/505
* Added Env Hooks so that depthai xacro can be used with gazebo sim by @r4hul77 in https://github.com/luxonis/depthai-ros/pull/507
* Fix resource paths for Ignition Gazebo by @Nibanovic in https://github.com/luxonis/depthai-ros/pull/511
* Use simulation flag to decide how to load meshes. by @destogl in https://github.com/luxonis/depthai-ros/pull/524
* Add new launch file for starting multiple rgbd cameras on robots. by @destogl in https://github.com/luxonis/depthai-ros/pull/532
* Missing fields in detection messages Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/574
* Ip autodiscovery fix Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/561
* RS Mode & Sync - Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/578
* Compressed image publishers by @Serafadam in https://github.com/luxonis/depthai-ros/pull/580
* ToF Support Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/581
* WLS fix humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/582
* Syncing & RS updates Humble by @Serafadam in https://github.com/luxonis/depthai-ros/pull/586

2.9.0 (2024-01-24)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion depthai-ros/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS

project(depthai-ros VERSION 2.9.0 LANGUAGES CXX C)
project(depthai-ros VERSION 2.10.1 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 14)

Expand Down
7 changes: 2 additions & 5 deletions depthai-ros/package.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai-ros</name>
<version>2.9.0</version>
<version>2.10.1</version>
<description>The depthai-ros package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
<maintainer email="[email protected]">sachin</maintainer>
<maintainer email="[email protected]">Adam Serafin</maintainer>
<author>Sachin Guruswamy</author>

<license>MIT</license>
Expand Down
5 changes: 4 additions & 1 deletion depthai_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
cmake_minimum_required (VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

project(depthai_bridge VERSION 2.9.0 LANGUAGES CXX C)
project(depthai_bridge VERSION 2.10.1 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Update the policy setting to avoid an error when loading the ament_cmake package
# at the current cmake version level
Expand Down Expand Up @@ -55,6 +56,8 @@ FILE(GLOB LIB_SRC
"src/ImuConverter.cpp"
"src/TFPublisher.cpp"
"src/TrackedFeaturesConverter.cpp"
"src/TrackedDetectionConverter.cpp"
"src/TrackedSpatialDetectionConverter.cpp"
)

catkin_package(
Expand Down
54 changes: 36 additions & 18 deletions depthai_bridge/include/depthai_bridge/ImageConverter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
#include "depthai-shared/common/CameraBoardSocket.hpp"
#include "depthai-shared/common/Point2f.hpp"
#include "depthai/device/CalibrationHandler.hpp"
#include "depthai/pipeline/datatype/EncodedFrame.hpp"
#include "depthai/pipeline/datatype/ImgFrame.hpp"
#include "depthai_ros_msgs/FFMPEGPacket.h"
#include "ros/time.h"
#include "sensor_msgs/CameraInfo.h"
#include "sensor_msgs/CompressedImage.h"
#include "sensor_msgs/Image.h"
#include "std_msgs/Header.h"

Expand All @@ -21,8 +24,11 @@ namespace ros {

namespace StdMsgs = std_msgs;
namespace ImageMsgs = sensor_msgs;
namespace DepthAiRosMsgs = depthai_ros_msgs;
using ImagePtr = ImageMsgs::ImagePtr;
using TimePoint = std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>;
using FFMPegImagePtr = DepthAiRosMsgs::FFMPEGPacketPtr;
using CompImagePtr = ImageMsgs::CompressedImagePtr;

class ImageConverter {
public:
Expand All @@ -44,7 +50,7 @@ class ImageConverter {
* @param update: bool whether to automatically update the ROS base time on message conversion
*/
void setUpdateRosBaseTimeOnToRosMsg(bool update = true) {
_updateRosBaseTimeOnToRosMsg = update;
updateRosBaseTimeOnToRosMsg = update;
}

/**
Expand Down Expand Up @@ -77,10 +83,20 @@ class ImageConverter {
*/
void setAlphaScaling(double alphaScalingFactor = 0.0);

/**
* @brief Sets the encoding of the image when converting to FFMPEG message. Default is libx264.
* @param encoding: The encoding to be used.
*/
void setFFMPEGEncoding(const std::string& encoding);

ImageMsgs::Image toRosMsgRawPtr(std::shared_ptr<dai::ImgFrame> inData, const sensor_msgs::CameraInfo& info = sensor_msgs::CameraInfo());
void toRosMsg(std::shared_ptr<dai::ImgFrame> inData, std::deque<ImageMsgs::Image>& outImageMsgs);
ImagePtr toRosMsgPtr(std::shared_ptr<dai::ImgFrame> inData);

DepthAiRosMsgs::FFMPEGPacket toRosFFMPEGPacket(std::shared_ptr<dai::EncodedFrame> inData);

ImageMsgs::CompressedImage toRosCompressedMsg(std::shared_ptr<dai::ImgFrame> inData);

void toDaiMsg(const ImageMsgs::Image& inMsg, dai::ImgFrame& outData);

/** TODO(sachin): Add support for ros msg to cv mat since we have some
Expand All @@ -99,29 +115,31 @@ class ImageConverter {
static std::unordered_map<dai::RawImgFrame::Type, std::string> encodingEnumMap;
static std::unordered_map<dai::RawImgFrame::Type, std::string> planarEncodingEnumMap;

// dai::RawImgFrame::Type _srcType;
bool _daiInterleaved;
bool daiInterleaved;
// bool c
const std::string _frameName = "";
const std::string frameName = "";
void planarToInterleaved(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
void interleavedToPlanar(const std::vector<uint8_t>& srcData, std::vector<uint8_t>& destData, int w, int h, int numPlanes, int bpp);
std::chrono::time_point<std::chrono::steady_clock> _steadyBaseTime;
std::chrono::time_point<std::chrono::steady_clock> steadyBaseTime;

::ros::Time _rosBaseTime;
bool _getBaseDeviceTimestamp;
::ros::Time rosBaseTime;
bool getBaseDeviceTimestamp;
// For handling ROS time shifts and debugging
int64_t _totalNsChange{0};
int64_t totalNsChange{0};
// Whether to update the ROS base time on each message conversion
bool _updateRosBaseTimeOnToRosMsg{false};
dai::RawImgFrame::Type _srcType;
bool _fromBitstream = false;
bool _convertDispToDepth = false;
bool _addExpOffset = false;
dai::CameraExposureOffset _expOffset;
bool _reverseStereoSocketOrder = false;
double _baseline;
bool _alphaScalingEnabled = false;
double _alphaScalingFactor = 0.0;
bool updateRosBaseTimeOnToRosMsg{false};
dai::RawImgFrame::Type srcType;
bool fromBitstream = false;
bool dispToDepth = false;
bool addExpOffset = false;
dai::CameraExposureOffset expOffset;
bool reversedStereoSocketOrder = false;
double baseline;
bool alphaScalingEnabled = false;
double alphaScalingFactor = 0.0;
int camHeight = -1;
int camWidth = -1;
std::string ffmpegEncoding = "libx264";
};

} // namespace ros
Expand Down
36 changes: 18 additions & 18 deletions depthai_bridge/include/depthai_bridge/TFPublisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ class TFPublisher {
*/
bool modelNameAvailable();
std::string getCamSocketName(int socketNum);
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> _tfPub;
std::shared_ptr<robot_state_publisher::RobotStatePublisher> _rsp;
std::string _camName;
std::string _camModel;
std::string _baseFrame;
std::string _parentFrame;
std::string _camPosX;
std::string _camPosY;
std::string _camPosZ;
std::string _camRoll;
std::string _camPitch;
std::string _camYaw;
std::string _imuFromDescr;
std::string _customURDFLocation;
std::string _customXacroArgs;
std::vector<dai::CameraFeatures> _camFeatures;
const std::unordered_map<dai::CameraBoardSocket, std::string> _socketNameMap = {
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> tfPub;
std::shared_ptr<robot_state_publisher::RobotStatePublisher> rsp;
std::string camName;
std::string camModel;
std::string baseFrame;
std::string parentFrame;
std::string camPosX;
std::string camPosY;
std::string camPosZ;
std::string camRoll;
std::string camPitch;
std::string camYaw;
std::string imuFromDescr;
std::string customURDFLocation;
std::string customXacroArgs;
std::vector<dai::CameraFeatures> camFeatures;
const std::unordered_map<dai::CameraBoardSocket, std::string> socketNameMap = {
{dai::CameraBoardSocket::AUTO, "rgb"},
{dai::CameraBoardSocket::CAM_A, "rgb"},
{dai::CameraBoardSocket::CAM_B, "left"},
Expand All @@ -91,4 +91,4 @@ class TFPublisher {
};
};
} // namespace ros
} // namespace dai
} // namespace dai
56 changes: 56 additions & 0 deletions depthai_bridge/include/depthai_bridge/TrackDetectionConverter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

#include <deque>
#include <memory>
#include <tuple>

#include "depthai/pipeline/datatype/Tracklets.hpp"
#include "depthai_ros_msgs/TrackDetection2DArray.h"
#include "ros/time.h"
#include "vision_msgs/Detection2DArray.h"

namespace dai {

namespace ros {

class TrackDetectionConverter {
public:
TrackDetectionConverter(std::string frameName, int width, int height, bool normalized, float thresh, bool getBaseDeviceTimestamp = false);
~TrackDetectionConverter() = default;

/**
* @brief Handles cases in which the ROS time shifts forward or backward
* Should be called at regular intervals or on-change of ROS time, depending
* on monitoring.
*
*/
void updateRosBaseTime();

/**
* @brief Commands the converter to automatically update the ROS base time on message conversion based on variable
*
* @param update: bool whether to automatically update the ROS base time on message conversion
*/
void setUpdateRosBaseTimeOnToRosMsg(bool update = true) {
_updateRosBaseTimeOnToRosMsg = update;
}

void toRosMsg(std::shared_ptr<dai::Tracklets> trackData, std::deque<depthai_ros_msgs::TrackDetection2DArray>& opDetectionMsgs);

depthai_ros_msgs::TrackDetection2DArray::Ptr toRosMsgPtr(std::shared_ptr<dai::Tracklets> trackData);

private:
int _width, _height;
const std::string _frameName;
bool _normalized;
float _thresh;
std::chrono::time_point<std::chrono::steady_clock> _steadyBaseTime;
::ros::Time _rosBaseTime;
bool _getBaseDeviceTimestamp;
// For handling ROS time shifts and debugging
int64_t _totalNsChange{0};
// Whether to update the ROS base time on each message conversion
bool _updateRosBaseTimeOnToRosMsg{false};
};
} // namespace ros
} // namespace dai
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#pragma once

#include <deque>
#include <memory>
#include <string>

#include "depthai/pipeline/datatype/Tracklets.hpp"
#include "depthai_ros_msgs/TrackDetection2DArray.h"
#include "ros/time.h"
#include "vision_msgs/Detection2DArray.h"

namespace dai {

namespace ros {

class TrackSpatialDetectionConverter {
public:
TrackSpatialDetectionConverter(std::string frameName, int width, int height, bool normalized, bool getBaseDeviceTimestamp = false);
~TrackSpatialDetectionConverter() = default;

/**
* @brief Handles cases in which the ROS time shifts forward or backward
* Should be called at regular intervals or on-change of ROS time, depending
* on monitoring.
*
*/
void updateRosBaseTime();

/**
* @brief Commands the converter to automatically update the ROS base time on message conversion based on variable
*
* @param update: bool whether to automatically update the ROS base time on message conversion
*/
void setUpdateRosBaseTimeOnToRosMsg(bool update = true) {
_updateRosBaseTimeOnToRosMsg = update;
}

void toRosMsg(std::shared_ptr<dai::Tracklets> trackData, std::deque<depthai_ros_msgs::TrackDetection2DArray>& opDetectionMsgs);

depthai_ros_msgs::TrackDetection2DArray::Ptr toRosMsgPtr(std::shared_ptr<dai::Tracklets> trackData);

private:
int _width, _height;
const std::string _frameName;
bool _normalized;
float _thresh;
std::chrono::time_point<std::chrono::steady_clock> _steadyBaseTime;
::ros::Time _rosBaseTime;
bool _getBaseDeviceTimestamp;
// For handling ROS time shifts and debugging
int64_t _totalNsChange{0};
// Whether to update the ROS base time on each message conversion
bool _updateRosBaseTimeOnToRosMsg{false};
};

} // namespace ros

namespace rosBridge = ros;

} // namespace dai
4 changes: 2 additions & 2 deletions depthai_bridge/package.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai_bridge</name>
<version>2.9.0</version>
<version>2.10.1</version>
<description>The depthai_bridge package</description>

<maintainer email="sachin@luxonis.com">Sachin Guruswamy</maintainer>
<maintainer email="adam.serafin@luxonis.com">Adam Serafin</maintainer>
<author>Sachin Guruswamy</author>

<license>MIT</license>
Expand Down
Loading

0 comments on commit 10ce437

Please sign in to comment.