Skip to content
This repository was archived by the owner on Jul 26, 2024. It is now read-only.

Commit 839c0cc

Browse files
authored
Merge branch 'melodic' into patch-2
2 parents 7b233d8 + e5520cf commit 839c0cc

File tree

13 files changed

+376
-224
lines changed

13 files changed

+376
-224
lines changed

.github/workflows/linux_ROS1.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: [ubuntu-latest]
13+
runs-on: [ubuntu-18.04]
1414
strategy:
1515
fail-fast: false
1616
matrix:
@@ -25,6 +25,7 @@ jobs:
2525
run: |
2626
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2727
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
28+
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
2829
sudo apt update
2930
sudo apt install ros-melodic-desktop-full
3031
env:

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: [windows-latest]
13+
runs-on: [windows-2019]
1414
strategy:
1515
fail-fast: false
1616
matrix:

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ find_package(catkin REQUIRED COMPONENTS
2121
geometry_msgs
2222
nodelet
2323
cv_bridge
24+
camera_info_manager
2425
)
2526

2627
###################################

cmake/Findk4abt.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
4747
if(EXISTS ${_sdk_dir})
4848
set(_k4abt_lib_path "${_sdk_dir}/${RELATIVE_WIN_K4ABT_LIB_PATH}")
4949
if(NOT EXISTS "${_k4abt_lib_path}")
50-
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4a.lib at ${_k4abt_lib_path}")
50+
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4abt.lib at ${_k4abt_lib_path}")
5151
return()
5252
endif()
5353

5454
set(_k4abt_bin_path "${_sdk_dir}/${RELATIVE_WIN_K4ABT_DLL_PATH}")
5555
if(NOT EXISTS "${_k4abt_bin_path}")
56-
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4arecord.lib at ${_k4abt_bin_path}")
56+
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4abt.dll at ${_k4abt_bin_path}")
5757
return()
5858
endif()
5959

6060
set(_dnn_model_path "${_sdk_dir}/${RELATIVE_WIN_DNN_MODEL_PATH}")
6161
if(NOT EXISTS "${_dnn_model_path}")
62-
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4arecord.lib at ${_dnn_model_path}")
62+
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find dnn_model.onnx at ${_dnn_model_path}")
6363
return()
6464
endif()
6565

6666
set(_onnx_runtime_bin_path "${_sdk_dir}/${RELATIVE_WIN_ONNX_RUNTIME_DLL_PATH}")
6767
if(NOT EXISTS "${_onnx_runtime_bin_path}")
68-
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find k4a.dll at ${_onnx_runtime_bin_path}")
68+
quiet_message(WARNING "Rejecting SDK located at ${_sdk_dir}: Could not find onnxruntime.dll at ${_onnx_runtime_bin_path}")
6969
return()
7070
endif()
7171

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Follow the [installation instructions](https://github.com/microsoft/Azure-Kinect
1717

1818
The Azure Kinect ROS Driver includes CMake files which will try to locate the Azure Kinect Sensor SDK. Installing the SDK in a non-default location will result in compile failures when CMake is unable to locate the SDK.
1919

20-
The Azure Kinect ROS Driver requires version of v1.1.0 of the Azure Kinect Sensor SDK to compile.
20+
The Azure Kinect ROS Driver requires version of v1.3.0 of the Azure Kinect Sensor SDK to compile.
2121

2222
#### Alternate SDK Installation
2323

docs/usage.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The Azure Kinect ROS Driver node exposes Azure Kinect DK sensor streams to ROS.
44

5+
## Starting the Driver
6+
7+
The ROS package contains two main launch files to start the driver:
8+
- `driver.launch` starts the driver as a separate node which publishes the raw images and the factory calibration. **The published images are not rectified.**
9+
- `kinect_rgbd.launch` starts the driver as a nodelet in a nodelet manager and starts the RGB-D processing from `rgbd_launch` which will load additional nodelets for image rectification and registration. This will publish raw (unrectified) as well as rectified images.
10+
511
## Setup and Building
612

713
Please see the [building guide](building.md).
@@ -27,7 +33,7 @@ The node accepts the following parameters:
2733
- `body_tracking_smoothing_factor` (float) : Defaults to `0.0`. Controls the temporal smoothing across frames. Set between `0` for no smoothing and `1` for full smoothing. Less smoothing will increase the responsiveness of the detected skeletons but will cause more positional and oriantational jitters.
2834
- `rescale_ir_to_mono8` (bool) : Defaults to `false`. Whether to rescale the IR image to an 8-bit monochrome image for visualization and further processing. A scaling factor (`ir_mono8_scaling_factor`) is applied.
2935
- `ir_mono8_scaling_factor` (float) : Defaults to `1.0`. Scaling factor to apply when converting IR to mono8 (see rescale_ir_to_mono8). If using illumination, use the value 0.5-1. If using passive IR, use 10.
30-
- `imu_rate_target` (int) : Defaults to `0`. Controls the desired IMU message rate, which is rounded to the closest allowable value. IMU samples from the device are integrated and a mean sample is published at this rate. A value of `0` is interpreted to mean a request for the maximum rate from the sensor (approx. 1.6 kHz).
36+
- `imu_rate_target` (int) : Defaults to `0`. Controls the desired IMU message rate, which is rounded to the closest allowable value. IMU samples from the device are integrated and a mean sample is published at this rate. A value of `0` is interpreted to mean a request for the maximum rate from the sensor (approx. 1.6 kHz).
3137
- `wired_sync_mode` (int) : Defaults to `0`. Sets the external wired synchronization mode. The modes are: `0: OFF (STANDALONE)`, `1: MASTER`, `2: SUBORDINATE`.
3238
- `subordinate_delay_off_master_usec` (int) : Defaults to `0`. Delay subordinate camera off master camera by specified amount in usec. Recommended minimum value is 160.
3339
#### Parameter Restrictions
@@ -66,3 +72,5 @@ Unlike previous ROS Kinect drivers, the Azure Kinect ROS Driver provides calibra
6672

6773
- tf2 : The relative offsets of the cameras and IMU are loaded from the Azure Kinect DK extrinsics calibration information. The various co-ordinate frames published by the node to TF2 are based on the calibration data. Please note that the calibration information only provides the relative positions of the IMU, color and depth cameras. It does not provide the offset between the sensors and the mechanical housing of the camera. The transform between the `camera_base` frame and `depth_camera_link` frame are based on the mechanical specifications of the Azure Kinect DK, and are not corrected by calibration.
6874
- sensor_msgs::CameraInfo : Intrinsics calibration data for the cameras is converted into a ROS-compatible format. Fully populated CameraInfo messages are published for both the depth and color cameras, allowing ROS to undistort the images using image_proc and project them into point clouds using depth_image_proc. Using the point cloud functions in this node will provide GPU-accelerated results, but the same quality point clouds can be produced using standard ROS tools.
75+
76+
The driver integrates the `camera_info_manager` and provides the `set_camera_info` service to override the factory RGB and IR intrinsics in the ROS node. This is useful for a [manual calibration](http://wiki.ros.org/camera_calibration). Note that this will not override the factory calibration stored on the device.

include/azure_kinect_ros_driver/k4a_ros_device.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <sensor_msgs/Temperature.h>
2424
#include <k4a/k4a.hpp>
2525
#include <k4arecord/playback.hpp>
26+
#include <camera_info_manager/camera_info_manager.h>
2627

2728
#if defined(K4A_BODY_TRACKING)
2829
#include <visualization_msgs/MarkerArray.h>
@@ -47,11 +48,6 @@ class K4AROSDevice
4748
void stopCameras();
4849
void stopImu();
4950

50-
// Get camera calibration information for the depth camera
51-
void getDepthCameraInfo(sensor_msgs::CameraInfo& camera_info);
52-
53-
void getRgbCameraInfo(sensor_msgs::CameraInfo& camera_info);
54-
5551
k4a_result_t getDepthFrame(const k4a::capture& capture, sensor_msgs::ImagePtr& depth_frame, bool rectified);
5652

5753
k4a_result_t getPointCloud(const k4a::capture& capture, sensor_msgs::PointCloud2Ptr& point_cloud);
@@ -86,6 +82,9 @@ class K4AROSDevice
8682
sensor_msgs::PointCloud2Ptr& point_cloud);
8783

8884
void framePublisherThread();
85+
#if defined(K4A_BODY_TRACKING)
86+
void bodyPublisherThread();
87+
#endif
8988
void imuPublisherThread();
9089

9190
// Gets a timestap from one of the captures images
@@ -112,6 +111,8 @@ class K4AROSDevice
112111
// ROS Node variables
113112
ros::NodeHandle node_;
114113
ros::NodeHandle private_node_;
114+
ros::NodeHandle node_rgb_;
115+
ros::NodeHandle node_ir_;
115116

116117
image_transport::ImageTransport image_transport_;
117118

@@ -135,6 +136,8 @@ class K4AROSDevice
135136

136137
ros::Publisher pointcloud_publisher_;
137138

139+
std::shared_ptr<camera_info_manager::CameraInfoManager> ci_mngr_rgb_, ci_mngr_ir_;
140+
138141
#if defined(K4A_BODY_TRACKING)
139142
ros::Publisher body_marker_publisher_;
140143

@@ -144,6 +147,8 @@ class K4AROSDevice
144147
// Parameters
145148
K4AROSDeviceParams params_;
146149

150+
std::string serial_number_;
151+
147152
// K4A device
148153
k4a::device k4a_device_;
149154
K4ACalibrationTransformData calibration_data_;
@@ -155,6 +160,8 @@ class K4AROSDevice
155160
#if defined(K4A_BODY_TRACKING)
156161
// Body tracker
157162
k4abt::tracker k4abt_tracker_;
163+
std::atomic_int16_t k4abt_tracker_queue_size_;
164+
std::thread body_publisher_thread_;
158165
#endif
159166

160167
std::chrono::nanoseconds device_to_realtime_offset_{0};

include/azure_kinect_ros_driver/k4a_ros_device_params.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#define ROS_PARAM_LIST \
3434
LIST_ENTRY(sensor_sn, "The serial number of the sensor this node should connect to.", std::string, std::string("")) \
3535
LIST_ENTRY(depth_enabled, "True if depth camera should be enabled", bool, true) \
36+
LIST_ENTRY(depth_unit, "Depth distance units. Options are: "+ \
37+
sensor_msgs::image_encodings::TYPE_32FC1+" (32 bit float metre) or "+ \
38+
sensor_msgs::image_encodings::TYPE_16UC1+" (16 bit integer millimetre)", \
39+
std::string, sensor_msgs::image_encodings::TYPE_16UC1) \
3640
LIST_ENTRY(depth_mode, \
3741
"The mode of the depth camera. Options are: NFOV_2X2BINNED, NFOV_UNBINNED, WFOV_2X2BINNED, " \
3842
"WFOV_UNBINNED, PASSIVE_IR", \
@@ -53,6 +57,8 @@
5357
"Whether the RGB pointcloud is rendered in the depth frame (true) or RGB frame (false). Will either " \
5458
"match the resolution of the depth camera (true) or the RGB camera (false)", \
5559
bool, true) \
60+
LIST_ENTRY(calibration_url, 'URL to folder with calibration files (default: "file://$HOME/.ros/camera_info/").', \
61+
std::string, {}) \
5662
LIST_ENTRY(tf_prefix, "The prefix prepended to tf frame ID's", std::string, std::string()) \
5763
LIST_ENTRY(recording_file, "Path to a recording file to open instead of opening a device", std::string, \
5864
std::string("")) \

launch/driver.launch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Licensed under the MIT License.
99

1010
<group if="$(arg overwrite_robot_description)">
1111
<param name="robot_description"
12-
command="xacro $(find azure_kinect_ros_driver)/urdf/azure_kinect.urdf.xacro tf_prefix:=$(arg tf_prefix)/" />
12+
command="xacro $(find azure_kinect_ros_driver)/urdf/azure_kinect.urdf.xacro tf_prefix:=$(arg tf_prefix)" />
1313
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
1414
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
1515
</group>
1616

1717
<group unless="$(arg overwrite_robot_description)">
1818
<param name="azure_description"
19-
command="xacro $(find azure_kinect_ros_driver)/urdf/azure_kinect.urdf.xacro tf_prefix:=$(arg tf_prefix)/" />
19+
command="xacro $(find azure_kinect_ros_driver)/urdf/azure_kinect.urdf.xacro tf_prefix:=$(arg tf_prefix)" />
2020
<node name="joint_state_publisher_azure" pkg="joint_state_publisher" type="joint_state_publisher">
2121
<remap from="robot_description" to="azure_description" />
2222
</node>
@@ -27,6 +27,7 @@ Licensed under the MIT License.
2727

2828
<arg name="depth_enabled" default="true" /> <!-- Enable or disable the depth camera -->
2929
<arg name="depth_mode" default="WFOV_UNBINNED" /> <!-- Set the depth camera mode, which affects FOV, depth range, and camera resolution. See Azure Kinect documentation for full details. Valid options: NFOV_UNBINNED, NFOV_2X2BINNED, WFOV_UNBINNED, WFOV_2X2BINNED, and PASSIVE_IR -->
30+
<arg name="depth_unit" default="16UC1" /> <!-- Depth distance units. Options are: "32FC1" (32 bit float metre) or "16UC1" (16 bit integer millimetre) -->
3031
<arg name="color_enabled" default="true" /> <!-- Enable or disable the color camera -->
3132
<arg name="color_format" default="bgra" /> <!-- The format of RGB camera. Valid options: bgra, jpeg -->
3233
<arg name="color_resolution" default="1536P" /> <!-- Resolution at which to run the color camera. Valid options: 720P, 1080P, 1440P, 1536P, 2160P, 3072P -->
@@ -49,6 +50,7 @@ Licensed under the MIT License.
4950
<node pkg="azure_kinect_ros_driver" type="node" name="azure_kinect_ros_driver" output="screen" required="$(arg required)">
5051
<param name="depth_enabled" type="bool" value="$(arg depth_enabled)" />
5152
<param name="depth_mode" type="string" value="$(arg depth_mode)" />
53+
<param name="depth_unit" type="string" value="$(arg depth_unit)" />
5254
<param name="color_enabled" type="bool" value="$(arg color_enabled)" />
5355
<param name="color_format" type="string" value="$(arg color_format)" />
5456
<param name="color_resolution" type="string" value="$(arg color_resolution)" />

0 commit comments

Comments
 (0)