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

Commit 6ffb95a

Browse files
tonynajjarJohn Doeamr17
authored
Support humble (#257)
* fix declare_parameter * add angles to Cmakelist * Warning fixes * remove obsolete parameters * remove set parameter * add joint_state_publisher Co-authored-by: John Doe <[email protected]> Co-authored-by: amr17 <[email protected]>
1 parent 2b2b2df commit 6ffb95a

File tree

7 files changed

+26
-39
lines changed

7 files changed

+26
-39
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ find_package(tf2_ros REQUIRED)
3131
find_package(tf2_geometry_msgs REQUIRED)
3232
find_package(geometry_msgs REQUIRED)
3333
find_package(cv_bridge REQUIRED)
34+
find_package(angles REQUIRED)
3435

3536
###########
3637
## Build ##
@@ -53,7 +54,8 @@ ament_target_dependencies(${PROJECT_NAME}_node rclcpp
5354
tf2
5455
tf2_ros
5556
tf2_geometry_msgs
56-
cv_bridge)
57+
cv_bridge
58+
angles)
5759

5860
## Rename C++ executable without prefix
5961
## The above recommended prefix causes long target names, the following renames the

include/azure_kinect_ros_driver/k4a_ros_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class K4AROSDevice : public rclcpp::Node
165165
volatile bool running_;
166166

167167
// Last capture timestamp for synchronizing playback capture and imu thread
168-
std::atomic_int64_t last_capture_time_usec_;
168+
std::atomic_uint64_t last_capture_time_usec_;
169169

170170
// Last imu timestamp for synchronizing playback capture and imu thread
171171
std::atomic_uint64_t last_imu_time_usec_;

launch/rectify_test.launch

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Licensed under the MIT License.
9191
<param name="fps" value="5" />
9292
<param name="point_cloud" value="true" />
9393
<param name="rgb_point_cloud" value="true" />
94-
<param name="required" value="true" />
9594
</node>
9695

9796
</group>

launch/slam_rtabmap.launch

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Licensed under the MIT License.
4545
<param name="fps" value="30" />
4646
<param name="point_cloud" value="false" />
4747
<param name="rgb_point_cloud" value="false" />
48-
<param name="required" value="true" />
4948
<param name="imu_rate_target" value="100" />
5049

5150
</node>

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<depend>std_msgs</depend>
1919
<depend>sensor_msgs</depend>
2020
<depend>visualization_msgs</depend>
21+
<depend>joint_state_publisher</depend>
2122
<depend>image_transport</depend>
2223
<depend>tf2</depend>
2324
<depend>tf2_ros</depend>

src/k4a_calibration_transform_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <sensor_msgs/distortion_models.hpp>
1616
#include <tf2/LinearMath/Transform.h>
1717
#include <tf2/convert.h>
18-
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
18+
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
1919

2020
// Project headers
2121
//

src/k4a_ros_device.cpp

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,25 @@ K4AROSDevice::K4AROSDevice()
5858
static const std::string compressed_png_level = "/compressed/png_level";
5959

6060
// Declare node parameters
61-
this->declare_parameter("depth_enabled");
62-
this->declare_parameter("depth_mode");
63-
this->declare_parameter("color_enabled");
64-
this->declare_parameter("color_format");
65-
this->declare_parameter("color_resolution");
66-
this->declare_parameter("fps");
67-
this->declare_parameter("point_cloud");
68-
this->declare_parameter("rgb_point_cloud");
69-
this->declare_parameter("point_cloud_in_depth_frame");
70-
this->declare_parameter("required");
71-
this->declare_parameter("sensor_sn");
72-
this->declare_parameter("recording_file");
73-
this->declare_parameter("recording_loop_enabled");
74-
this->declare_parameter("body_tracking_enabled");
75-
this->declare_parameter("body_tracking_smoothing_factor");
76-
this->declare_parameter("rescale_ir_to_mono8");
77-
this->declare_parameter("ir_mono8_scaling_factor");
78-
this->declare_parameter("imu_rate_target");
79-
this->declare_parameter("wired_sync_mode");
80-
this->declare_parameter("subordinate_delay_off_master_usec");
81-
this->declare_parameter({depth_raw_topic + compressed_format});
82-
this->declare_parameter({depth_raw_topic + compressed_png_level});
83-
this->declare_parameter({depth_rect_topic + compressed_format});
84-
this->declare_parameter({depth_rect_topic + compressed_png_level});
61+
this->declare_parameter("depth_enabled", rclcpp::ParameterValue(true));
62+
this->declare_parameter("depth_mode", rclcpp::ParameterValue("NFOV_UNBINNED"));
63+
this->declare_parameter("color_enabled", rclcpp::ParameterValue(false));
64+
this->declare_parameter("color_format", rclcpp::ParameterValue("bgra"));
65+
this->declare_parameter("color_resolution", rclcpp::ParameterValue("720P"));
66+
this->declare_parameter("fps", rclcpp::ParameterValue(5));
67+
this->declare_parameter("point_cloud", rclcpp::ParameterValue(true));
68+
this->declare_parameter("rgb_point_cloud", rclcpp::ParameterValue(false));
69+
this->declare_parameter("point_cloud_in_depth_frame", rclcpp::ParameterValue(true));
70+
this->declare_parameter("sensor_sn", rclcpp::ParameterValue(""));
71+
this->declare_parameter("recording_file", rclcpp::ParameterValue(""));
72+
this->declare_parameter("recording_loop_enabled", rclcpp::ParameterValue(false));
73+
this->declare_parameter("body_tracking_enabled", rclcpp::ParameterValue(false));
74+
this->declare_parameter("body_tracking_smoothing_factor", rclcpp::ParameterValue(0.0f));
75+
this->declare_parameter("rescale_ir_to_mono8", rclcpp::ParameterValue(false));
76+
this->declare_parameter("ir_mono8_scaling_factor", rclcpp::ParameterValue(1.0f));
77+
this->declare_parameter("imu_rate_target", rclcpp::ParameterValue(0));
78+
this->declare_parameter("wired_sync_mode", rclcpp::ParameterValue(0));
79+
this->declare_parameter("subordinate_delay_off_master_usec", rclcpp::ParameterValue(0));
8580

8681
// Collect ROS parameters from the param server or from the command line
8782
#define LIST_ENTRY(param_variable, param_help_string, param_type, param_default_val) \
@@ -194,7 +189,7 @@ K4AROSDevice::K4AROSDevice()
194189
{
195190
device = k4a::device::open(i);
196191
}
197-
catch (exception)
192+
catch (exception const&)
198193
{
199194
RCLCPP_ERROR_STREAM(this->get_logger(),"Failed to open K4A device at index " << i);
200195
continue;
@@ -259,14 +254,6 @@ K4AROSDevice::K4AROSDevice()
259254
depth_raw_publisher_ = image_transport_->advertise("depth/image_raw", 1, true);
260255
depth_raw_camerainfo_publisher_ = this->create_publisher<CameraInfo>("depth/camera_info", 1);
261256

262-
if (params_.depth_unit == sensor_msgs::image_encodings::TYPE_16UC1) {
263-
// set lowest PNG compression for maximum FPS
264-
this->set_parameter({depth_raw_topic + compressed_format, "png"});
265-
this->set_parameter({depth_raw_topic + compressed_png_level, 1});
266-
this->set_parameter({depth_rect_topic + compressed_format, "png"});
267-
this->set_parameter({depth_rect_topic + compressed_png_level, 1});
268-
}
269-
270257
depth_raw_publisher_ = image_transport_->advertise(depth_raw_topic, 1, true);
271258
depth_raw_camerainfo_publisher_ = this->create_publisher<CameraInfo>("depth/camera_info", 1);
272259

@@ -863,7 +850,6 @@ void K4AROSDevice::framePublisherThread()
863850
{
864851
rclcpp::Rate loop_rate(params_.fps);
865852

866-
k4a_wait_result_t wait_result;
867853
k4a_result_t result;
868854

869855
CameraInfo rgb_raw_camera_info;

0 commit comments

Comments
 (0)