|
| 1 | +# pose_filtering |
| 2 | + |
| 3 | +ROS 2 package providing pose-based multi-target tracking using an IPDA |
| 4 | +filter for position together with independent orientation logic. |
| 5 | + |
| 6 | +This package transforms incoming pose-like messages into a common |
| 7 | +target frame, associates measurements to tracks using spatial and angular |
| 8 | +gating, maintains an IPDA filter per track for position estimation and |
| 9 | +existence management, and performs a separate orientation update by |
| 10 | +averaging measurement quaternions and applying spherical linear |
| 11 | +interpolation (slerp) to smoothly update the track orientation. |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +- Multi-target tracking using an IPDA (Integrated Probabilistic Data |
| 16 | + Association) filter for 3D position state estimation. |
| 17 | +- Separate orientation handling: angular gating, quaternion averaging and |
| 18 | + slerp-based smoothing so orientation updates remain numerically stable |
| 19 | + and physically meaningful. |
| 20 | +- TF2-aware subscriptions (message_filters + tf2 message filter) so |
| 21 | + incoming messages are automatically dropped until transform to the |
| 22 | + configured target frame is available. |
| 23 | +- Supports several ROS message inputs (see below) and publishes a |
| 24 | + `geometry_msgs/PoseArray` containing the current tracked poses. |
| 25 | + |
| 26 | +## Supported input messages |
| 27 | + |
| 28 | +The node accepts the following message types as input measurements: |
| 29 | + |
| 30 | +- `geometry_msgs/msg/PoseStamped` |
| 31 | +- `geometry_msgs/msg/PoseArray` |
| 32 | +- `geometry_msgs/msg/PoseWithCovarianceStamped` |
| 33 | +- `vortex_msgs/msg/LandmarkArray` |
| 34 | + |
| 35 | +The code uses a templated message type (PoseMsgT) and checks at |
| 36 | +compile-time which types are supported. Incoming measurements are |
| 37 | +transformed to the configured `target_frame` before being processed. |
| 38 | + |
| 39 | +## Outputs |
| 40 | + |
| 41 | +- `geometry_msgs/msg/PoseArray` — the current set of tracked poses in the |
| 42 | + configured target frame. Each Pose contains the track position and a |
| 43 | + quaternion orientation representing the track's current orientation. |
| 44 | +- (DEBUG) `vortex_msgs/msg/PoseEulerStamped` topics with |
| 45 | + measurement-level and track-state-level pose messages when debug mode |
| 46 | + is enabled. Only publishes the first element of incoming measurements and stored tracks. |
| 47 | + |
| 48 | + |
| 49 | +## How the filtering works |
| 50 | + |
| 51 | +Position (IPDA): |
| 52 | + |
| 53 | +- Each track runs a 3D IPDA filter instance (a Gaussian state: mean + |
| 54 | + covariance) where the motion model is a small constant-dynamics model |
| 55 | + and the sensor model maps state to direct position measurements. |
| 56 | +- IPDA takes care of measurement association probabilities, gating and |
| 57 | + existence management (confirmation / deletion thresholds). This |
| 58 | + provides robust data association for cluttered measurements and |
| 59 | + handles tracks appearing/disappearing over time. |
| 60 | + |
| 61 | +Orientation (SO(3) PDAF): |
| 62 | + |
| 63 | +Orientation is handled by a dedicated PDAF-style filter operating on |
| 64 | +the SO(3) manifold. Each track |
| 65 | +maintains: |
| 66 | + |
| 67 | +- a quaternion mean q (the track orientation), and |
| 68 | +- a small Gaussian error state in the 3D tangent space (so(3)) around |
| 69 | + that mean. |
| 70 | + |
| 71 | + |
| 72 | +The log and exp maps are mathematically defined for all unit quaternions |
| 73 | +but the Kalman/PDAF linearization on the tangent space assumes small |
| 74 | +errors. The implementation gates measurements and uses configurable |
| 75 | +covariances to keep tangent residuals small; if large-angle residuals |
| 76 | +occur they will either be gated out or yield small β (limited effect). |
| 77 | + |
| 78 | +## Library export and usage |
| 79 | + |
| 80 | +The core tracking logic (`PoseTrackManager`) is built and exported as a |
| 81 | +shared library by this package so other packages can reuse the track |
| 82 | +management functionality without pulling in the ROS node. |
| 83 | + |
| 84 | +CMake / ament usage |
| 85 | + |
| 86 | +In a consuming CMake-based package (ament_cmake) you can link against |
| 87 | +the library like this: |
| 88 | + |
| 89 | +```cmake |
| 90 | +find_package(pose_filtering REQUIRED) |
| 91 | +
|
| 92 | +add_executable(my_node src/my_node.cpp) |
| 93 | +
|
| 94 | +# Link to the exported library target (the package exports the target |
| 95 | +# with the same name as the package: `pose_filtering`) |
| 96 | +target_link_libraries(my_node PRIVATE pose_filtering) |
| 97 | +
|
| 98 | +``` |
| 99 | + |
| 100 | +The package installs its public headers under `include/` so simply |
| 101 | +including the header below in your code will work after linking: |
| 102 | + |
| 103 | +```cpp |
| 104 | +#include <pose_filtering/lib/pose_track_manager.hpp> |
| 105 | + |
| 106 | +int main() { |
| 107 | + vortex::filtering::TrackManagerConfig cfg; |
| 108 | + // configure cfg.ipda, cfg.dyn_mod, cfg.sensor_mod, cfg.existence, etc. |
| 109 | + |
| 110 | + vortex::filtering::PoseTrackManager manager(cfg); |
| 111 | + |
| 112 | + std::vector<vortex::utils::types::Pose> measurements; |
| 113 | + double dt = 0.1; // seconds |
| 114 | + manager.step(measurements, dt); |
| 115 | + |
| 116 | + const auto& tracks = manager.get_tracks(); |
| 117 | + // iterate tracks for id, pose, existence probability, etc. |
| 118 | +} |
| 119 | +``` |
0 commit comments