Skip to content

Commit 55dec73

Browse files
RoseFlunderStuart Alldritt
authored andcommitted
Add parameter body_tracking_smoothing_factor to control the smoothing factor between frames. (opencv#80)
1 parent 60789f0 commit 55dec73

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

docs/usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The node accepts the following parameters:
2323
- `recording_file` (string) : No default value. If this parameter contains a valid absolute path to a k4arecording file, the node will use the playback api with this file instead of opening a device.
2424
- `recording_loop_enabled` (bool) : Defaults to `false`. If this parameter is set to `true`, the node will rewind the recording file to the beginning after reaching the last frame. Otherwise the node will stop working after reaching the end of the recording file.
2525
- `body_tracking_enabled` (bool) : Defaults to `false`. If this parameter is set to `true`, the node will generate visualization_msgs::MarkerArray messages for the body tracking data. This requires that the `depth_enabled` parameter is set to `true` and an installed azure kinect body tracking sdk.
26+
- `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.
2627

2728
#### Parameter Restrictions
2829

include/azure_kinect_ros_driver/k4a_ros_device_params.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
LIST_ENTRY(recording_file, "Path to a recording file to open instead of opening a device", std::string, std::string("")) \
4141
LIST_ENTRY(recording_loop_enabled, "True if the recording should be rewound at EOF", bool, false) \
4242
LIST_ENTRY(body_tracking_enabled, "True if body joints should be published as a marker array message", bool, false) \
43+
LIST_ENTRY(body_tracking_smoothing_factor, "Controls the temporal smoothing of joints across frames. Set between 0 for no smoothing and 1 for full smoothing.", float, 0.0f) \
4344

4445
class K4AROSDeviceParams
4546
{

launch/driver.launch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ Licensed under the MIT License.
1616
<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 -->
1717
<arg name="color_enabled" default="true" /> <!-- Enable or disable the color camera -->
1818
<arg name="color_resolution" default="1536P" /> <!-- Resolution at which to run the color camera. Valid options: 720P, 1080P, 1440P, 1536P, 2160P, 3072P -->
19-
<arg name="fps" default="5" /> <!-- FPS to run both cameras at. Valid options are 5, 15, and 30 -->
19+
<arg name="fps" default="5" /> <!-- FPS to run both cameras at. Valid options are 5, 15, and 30 -->
2020
<arg name="point_cloud" default="true" /> <!-- Generate a point cloud from depth data. Requires depth_enabled -->
2121
<arg name="rgb_point_cloud" default="true" /> <!-- Colorize the point cloud using the RBG camera. Requires color_enabled and depth_enabled -->
2222
<arg name="required" default="false" /> <!-- Argument which specified if the entire launch file should terminate if the node dies -->
2323
<arg name="sensor_sn" default="" /> <!-- Sensor serial number. If none provided, the first sensor will be selected -->
2424
<arg name="recording_file" default="" /> <!-- Absolute path to a mkv recording file which will be used with the playback api instead of opening a device -->
2525
<arg name="recording_loop_enabled" default="false" /> <!-- If set to true the recording file will rewind the beginning once end of file is reached -->
26-
<arg name="body_tracking_enabled" default="false" /> <!-- If set to true the joint positions will be published as marker arrays -->
26+
<arg name="body_tracking_enabled" default="false" /> <!-- If set to true the joint positions will be published as marker arrays -->
27+
<arg name="body_tracking_smoothing_factor" default="0.0" /> <!-- Set between 0 for no smoothing and 1 for full smoothing -->
2728

2829
<node pkg="azure_kinect_ros_driver" type="node" name="node" output="screen" required="$(arg required)">
2930
<param name="depth_enabled" type="bool" value="$(arg depth_enabled)" />
@@ -37,6 +38,7 @@ Licensed under the MIT License.
3738
<param name="tf_prefix" type="string" value="$(arg tf_prefix)" />
3839
<param name="recording_file" type="string" value="$(arg recording_file)" />
3940
<param name="recording_loop_enabled" type="bool" value="$(arg recording_loop_enabled)" />
40-
<param name="body_tracking_enabled" type="bool" value="$(arg body_tracking_enabled)" />
41+
<param name="body_tracking_enabled" type="bool" value="$(arg body_tracking_enabled)" />
42+
<param name="body_tracking_smoothing_factor" type="double" value="$(arg body_tracking_smoothing_factor)" />
4143
</node>
4244
</launch>

src/k4a_ros_device.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ k4a_result_t K4AROSDevice::startCameras()
291291
if (params_.body_tracking_enabled)
292292
{
293293
k4abt_tracker_ = k4abt::tracker::create(calibration_data_.k4a_calibration_);
294+
k4abt_tracker_.set_temporal_smoothing(params_.body_tracking_smoothing_factor);
294295
}
295296
#endif
296297

0 commit comments

Comments
 (0)