Skip to content

Commit

Permalink
Jazzy 2.10.2 (luxonis#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serafadam authored Oct 7, 2024
1 parent f136749 commit ab54d7e
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 52 deletions.
7 changes: 7 additions & 0 deletions depthai-ros/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Changelog for package depthai-ros
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.10.2 (2024-09-26)
-------------------
* Fix Stereo K matrix publishing
* Fix socket ID for NN detections
* Remove catching errors when starting the device since it introduced undefined behavior
* Add desqueeze to NN node

2.10.1 (2024-09-18)
-------------------
* Fix ToF synced publishing
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.10.1 LANGUAGES CXX C)
project(depthai-ros VERSION 2.10.2 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 14)

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

<!-- One maintainer tag required, multiple allowed, one person per tag -->
Expand Down
3 changes: 2 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.10.1 LANGUAGES CXX C)
project(depthai_bridge VERSION 2.10.2 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
2 changes: 1 addition & 1 deletion depthai_bridge/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai_bridge</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>The depthai_bridge package</description>

<maintainer email="[email protected]">Adam Serafin</maintainer>
Expand Down
2 changes: 1 addition & 1 deletion depthai_descriptions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(depthai_descriptions VERSION 2.10.1)
project(depthai_descriptions VERSION 2.10.2)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand Down
2 changes: 1 addition & 1 deletion depthai_descriptions/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai_descriptions</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>The depthai_descriptions package</description>

<maintainer email="[email protected]">Adam Serafin</maintainer>
Expand Down
2 changes: 1 addition & 1 deletion depthai_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10.2) # CMake version in Ubuntu 18.04 LTS
project(depthai_examples VERSION 2.10.1 LANGUAGES CXX C)
project(depthai_examples VERSION 2.10.2 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion depthai_examples/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai_examples</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>The depthai_examples package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
Expand Down
3 changes: 2 additions & 1 deletion depthai_filters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 3.8)
project(depthai_filters VERSION 2.10.1 LANGUAGES CXX C)
project(depthai_filters VERSION 2.10.2 LANGUAGES CXX C)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# find dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "message_filters/sync_policies/approximate_time.h"
#include "message_filters/synchronizer.h"
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/camera_info.hpp"
#include "sensor_msgs/msg/image.hpp"
#include "vision_msgs/msg/detection2_d_array.hpp"

Expand All @@ -27,4 +26,4 @@ class Detection2DOverlay : public rclcpp::Node {
"motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"};
};

} // namespace depthai_filters
} // namespace depthai_filters
6 changes: 4 additions & 2 deletions depthai_filters/launch/example_det2d_overlay.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def launch_setup(context, *args, **kwargs):
ComposableNode(
package="depthai_filters",
plugin="depthai_filters::Detection2DOverlay",
name=name+"detection_overlay",
remappings=[('rgb/preview/image_raw', name+'/nn/passthrough/image_raw'),
('nn/detections', name+'/nn/detections')]
('nn/detections', name+'/nn/detections')],
parameters=[params_file]
),
],
),
Expand All @@ -46,4 +48,4 @@ def generate_launch_description():

return LaunchDescription(
declared_arguments + [OpaqueFunction(function=launch_setup)]
)
)
2 changes: 1 addition & 1 deletion depthai_filters/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>depthai_filters</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>Depthai filters package</description>
<maintainer email="[email protected]">Adam Serafin</maintainer>
<license>MIT</license>
Expand Down
5 changes: 2 additions & 3 deletions depthai_filters/src/detection2d_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ void Detection2DOverlay::onInit() {

void Detection2DOverlay::overlayCB(const sensor_msgs::msg::Image::ConstSharedPtr& preview,
const vision_msgs::msg::Detection2DArray::ConstSharedPtr& detections) {
cv::Mat previewMat = utils::msgToMat(this->get_logger(), preview, sensor_msgs::image_encodings::BGR8);

cv::Mat previewMat = utils::msgToMat(this->get_logger(), preview, sensor_msgs::image_encodings::BGR8);
auto blue = cv::Scalar(255, 0, 0);

for(auto& detection : detections->detections) {
Expand All @@ -44,4 +43,4 @@ void Detection2DOverlay::overlayCB(const sensor_msgs::msg::Image::ConstSharedPtr

} // namespace depthai_filters
#include "rclcpp_components/register_node_macro.hpp"
RCLCPP_COMPONENTS_REGISTER_NODE(depthai_filters::Detection2DOverlay);
RCLCPP_COMPONENTS_REGISTER_NODE(depthai_filters::Detection2DOverlay);
2 changes: 1 addition & 1 deletion depthai_ros_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(depthai_ros_driver VERSION 2.10.1)
project(depthai_ros_driver VERSION 2.10.2)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_SHARED_LIBS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Detection : public BaseNode {
if(ph->getParam<bool>("i_disable_resize")) {
width = ph->getOtherNodeParam<int>(socketName, "i_preview_width");
height = ph->getOtherNodeParam<int>(socketName, "i_preview_height");
} else if(ph->getParam<bool>("i_desqueeze_output")) {
width = ph->getOtherNodeParam<int>(socketName, "i_width");
height = ph->getOtherNodeParam<int>(socketName, "i_height");
} else {
width = imageManip->initialConfig.getResizeConfig().width;
height = imageManip->initialConfig.getResizeConfig().height;
Expand All @@ -84,9 +87,11 @@ class Detection : public BaseNode {
convConf.updateROSBaseTimeOnRosMsg = ph->getParam<bool>("i_update_ros_base_time_on_ros_msg");

utils::ImgPublisherConfig pubConf;
pubConf.width = width;
pubConf.height = height;
pubConf.daiNodeName = getName();
pubConf.topicName = "~/" + getName();
pubConf.topicSuffix = "passthrough";
pubConf.topicName = "~/" + getName() + "/passthrough";
pubConf.infoSuffix = "/passthrough";
pubConf.socket = static_cast<dai::CameraBoardSocket>(ph->getParam<int>("i_board_socket_id"));

ptPub->setup(device, convConf, pubConf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class SpatialDetection : public BaseNode {
if(ph->getParam<bool>("i_disable_resize")) {
width = ph->getOtherNodeParam<int>(socketName, "i_preview_width");
height = ph->getOtherNodeParam<int>(socketName, "i_preview_height");
} else if(ph->getParam<bool>("i_desqueeze_output")) {
width = ph->getOtherNodeParam<int>(socketName, "i_width");
height = ph->getOtherNodeParam<int>(socketName, "i_height");
} else {
width = imageManip->initialConfig.getResizeConfig().width;
height = imageManip->initialConfig.getResizeConfig().height;
Expand All @@ -76,8 +79,8 @@ class SpatialDetection : public BaseNode {
pubConf.width = width;
pubConf.height = height;
pubConf.daiNodeName = getName();
pubConf.topicName = "~/" + getName();
pubConf.topicSuffix = "passthrough";
pubConf.topicName = "~/" + getName() + "/passthrough";
pubConf.infoSuffix = "/passthrough";
pubConf.socket = static_cast<dai::CameraBoardSocket>(ph->getParam<int>("i_board_socket_id"));

ptPub->setup(device, convConf, pubConf);
Expand All @@ -97,8 +100,8 @@ class SpatialDetection : public BaseNode {
pubConf.width = ph->getOtherNodeParam<int>(sensor_helpers::getNodeName(getROSNode(), sensor_helpers::NodeNameEnum::Stereo), "i_width");
pubConf.height = ph->getOtherNodeParam<int>(sensor_helpers::getNodeName(getROSNode(), sensor_helpers::NodeNameEnum::Stereo), "i_height");
pubConf.daiNodeName = getName();
pubConf.topicName = "~/" + getName();
pubConf.topicSuffix = "/passthrough_depth";
pubConf.topicName = "~/" + getName() + "/passthrough_depth";
pubConf.infoSuffix = "/passthrough_depth";
pubConf.socket = socket;

ptDepthPub->setup(device, convConf, pubConf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class NNParamHandler : public BaseParamHandler {
template <typename T>
void declareParams(std::shared_ptr<T> nn, std::shared_ptr<dai::node::ImageManip> imageManip) {
declareAndLogParam<bool>("i_disable_resize", false);
declareAndLogParam<bool>("i_desqueeze_output", false);
declareAndLogParam<bool>("i_enable_passthrough", false);
declareAndLogParam<bool>("i_enable_passthrough_depth", false);
declareAndLogParam<bool>("i_get_base_device_timestamp", false);
Expand Down Expand Up @@ -104,7 +105,7 @@ class NNParamHandler : public BaseParamHandler {
json data = json::parse(f);
if(data.contains("model") && data.contains("nn_config")) {
auto modelPath = getModelPath(data);
declareAndLogParam("i_model_path", modelPath);
modelPath = declareAndLogParam("i_model_path", modelPath);
if(!getParam<bool>("i_disable_resize")) {
setImageManip(modelPath, imageManip);
}
Expand Down
1 change: 1 addition & 0 deletions depthai_ros_driver/include/depthai_ros_driver/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct ImgPublisherConfig {
dai::CameraBoardSocket rightSocket = dai::CameraBoardSocket::CAM_C;
std::string calibrationFile = "";
std::string topicSuffix = "/image_raw";
std::string infoSuffix = "";
std::string compressedTopicSuffix = "/image_raw/compressed";
std::string infoMgrSuffix = "";
bool rectified = false;
Expand Down
2 changes: 1 addition & 1 deletion depthai_ros_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>depthai_ros_driver</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>Depthai ROS Monolithic node.</description>
<maintainer email="[email protected]">Adam Serafin</maintainer>

Expand Down
19 changes: 5 additions & 14 deletions depthai_ros_driver/src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,11 @@ void Camera::diagCB(const diagnostic_msgs::msg::DiagnosticArray::SharedPtr msg)
}

void Camera::start() {
bool success = false;
while(!success) {
try {
RCLCPP_INFO(this->get_logger(), "Starting camera.");
if(!camRunning) {
onConfigure();
} else {
RCLCPP_INFO(this->get_logger(), "Camera already running!.");
}
success = true;
} catch(const std::exception& e) {
RCLCPP_ERROR(this->get_logger(), "Exception occurred: %s. Retry", e.what());
camRunning = false;
}
RCLCPP_INFO(this->get_logger(), "Starting camera.");
if(!camRunning) {
onConfigure();
} else {
RCLCPP_INFO(this->get_logger(), "Camera already running!.");
}
}

Expand Down
6 changes: 3 additions & 3 deletions depthai_ros_driver/src/dai_nodes/nn/nn_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ NNWrapper::NNWrapper(const std::string& daiNodeName,
auto family = ph->getNNFamily();
switch(family) {
case param_handlers::nn::NNFamily::Yolo: {
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::YoloDetectionNetwork>>(getName(), getROSNode(), pipeline);
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::YoloDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
break;
}
case param_handlers::nn::NNFamily::Mobilenet: {
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::MobileNetDetectionNetwork>>(getName(), getROSNode(), pipeline);
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::MobileNetDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
break;
}
case param_handlers::nn::NNFamily::Segmentation: {
nnNode = std::make_unique<dai_nodes::nn::Segmentation>(getName(), getROSNode(), pipeline);
nnNode = std::make_unique<dai_nodes::nn::Segmentation>(getName(), getROSNode(), pipeline, socket);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions depthai_ros_driver/src/dai_nodes/nn/spatial_nn_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ SpatialNNWrapper::SpatialNNWrapper(const std::string& daiNodeName,
auto family = ph->getNNFamily();
switch(family) {
case param_handlers::nn::NNFamily::Yolo: {
nnNode = std::make_unique<dai_nodes::nn::SpatialDetection<dai::node::YoloSpatialDetectionNetwork>>(getName(), getROSNode(), pipeline);
nnNode = std::make_unique<dai_nodes::nn::SpatialDetection<dai::node::YoloSpatialDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
break;
}
case param_handlers::nn::NNFamily::Mobilenet: {
nnNode = std::make_unique<dai_nodes::nn::SpatialDetection<dai::node::MobileNetSpatialDetectionNetwork>>(getName(), getROSNode(), pipeline);
nnNode = std::make_unique<dai_nodes::nn::SpatialDetection<dai::node::MobileNetSpatialDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
break;
}
case param_handlers::nn::NNFamily::Segmentation: {
Expand Down
7 changes: 4 additions & 3 deletions depthai_ros_driver/src/dai_nodes/sensors/img_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ void ImagePublisher::setup(std::shared_ptr<dai::Device> device, const utils::Img
ffmpegPub = node->create_publisher<ffmpeg_image_transport_msgs::msg::FFMPEGPacket>(
pubConfig.topicName + pubConfig.compressedTopicSuffix, rclcpp::QoS(10), pubOptions);
}
infoPub = node->create_publisher<sensor_msgs::msg::CameraInfo>(pubConfig.topicName + "/camera_info", rclcpp::QoS(10), pubOptions);
infoPub =
node->create_publisher<sensor_msgs::msg::CameraInfo>(pubConfig.topicName + pubConfig.infoSuffix + "/camera_info", rclcpp::QoS(10), pubOptions);
} else if(ipcEnabled) {
imgPub = node->create_publisher<sensor_msgs::msg::Image>(pubConfig.topicName + pubConfig.topicSuffix, rclcpp::QoS(10), pubOptions);
infoPub = node->create_publisher<sensor_msgs::msg::CameraInfo>(pubConfig.topicName + "/camera_info", rclcpp::QoS(10), pubOptions);
infoPub =
node->create_publisher<sensor_msgs::msg::CameraInfo>(pubConfig.topicName + pubConfig.infoSuffix + "/camera_info", rclcpp::QoS(10), pubOptions);
} else {
imgPubIT = image_transport::create_camera_publisher(node.get(), pubConfig.topicName + pubConfig.topicSuffix);
}
Expand Down Expand Up @@ -124,7 +126,6 @@ void ImagePublisher::createInfoManager(std::shared_ptr<dai::Device> device) {
auto info = sensor_helpers::getCalibInfo(node->get_logger(), converter, device, pubConfig.socket, pubConfig.width, pubConfig.height);
if(pubConfig.rectified) {
std::fill(info.d.begin(), info.d.end(), 0.0);
std::fill(info.k.begin(), info.k.end(), 0.0);
info.r[0] = info.r[4] = info.r[8] = 1.0;
}
infoManager->setCameraInfo(info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ SensorWrapper::SensorWrapper(const std::string& daiNodeName,
converter = std::make_unique<dai::ros::ImageConverter>(true);
setNames();
setXinXout(pipeline);
socketID = ph->getParam<int>("i_board_socket_id");
}

socketID = ph->getParam<int>("i_board_socket_id");
if(ph->getParam<bool>("i_disable_node") && ph->getParam<bool>("i_simulate_from_topic")) {
RCLCPP_INFO(getROSNode()->get_logger(), "Disabling node %s, pipeline data taken from topic.", getName().c_str());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void SensorParamHandler::declareCommonParams(dai::CameraBoardSocket socket) {
declareAndLogParam<std::string>("i_simulated_topic_name", "");
declareAndLogParam<bool>("i_disable_node", false);
declareAndLogParam<bool>("i_get_base_device_timestamp", false);
socketID = static_cast<dai::CameraBoardSocket>(declareAndLogParam<int>("i_board_socket_id", static_cast<int>(socket), 0));
socketID = static_cast<dai::CameraBoardSocket>(declareAndLogParam<int>("i_board_socket_id", static_cast<int>(socket), false));
declareAndLogParam<bool>("i_update_ros_base_time_on_ros_msg", false);
declareAndLogParam<bool>("i_enable_feature_tracker", false);
declareAndLogParam<bool>("i_enable_nn", false);
Expand Down
2 changes: 1 addition & 1 deletion depthai_ros_msgs/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_msgs VERSION 2.10.1)
project(depthai_ros_msgs VERSION 2.10.2)

if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
Expand Down
2 changes: 1 addition & 1 deletion depthai_ros_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="3">
<name>depthai_ros_msgs</name>
<version>2.10.1</version>
<version>2.10.2</version>
<description>Package to keep interface independent of the driver</description>

<maintainer email="[email protected]">Adam Serafin</maintainer>
Expand Down

0 comments on commit ab54d7e

Please sign in to comment.