Skip to content

Pose filtering#655

Merged
jorgenfj merged 34 commits intomainfrom
ipda-pose-filtering
Mar 7, 2026
Merged

Pose filtering#655
jorgenfj merged 34 commits intomainfrom
ipda-pose-filtering

Conversation

@jorgenfj
Copy link
Contributor

@jorgenfj jorgenfj commented Jan 6, 2026

Pose filtering ros package plus track manager library.
Mainly used for testing and development.
Intended use case is to have the landmark server include the library and do the landmark filtering

@jorgenfj jorgenfj self-assigned this Jan 6, 2026
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 40.44444% with 268 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.38%. Comparing base (eebcf9b) to head (2e49c7b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ring/pose_filtering/src/ros/pose_filtering_ros.cpp 0.00% 108 Missing ⚠️
...ltering/src/ros/pose_filtering_ros_conversions.cpp 0.00% 76 Missing ⚠️
...ose_filtering/src/ros/pose_filtering_ros_debug.cpp 0.00% 40 Missing ⚠️
...tering/pose_filtering/test/test_pose_filtering.cpp 75.32% 2 Missing and 17 partials ⚠️
...ring/pose_filtering/src/lib/pose_track_manager.cpp 89.25% 8 Missing and 5 partials ⚠️
.../include/pose_filtering/lib/pose_track_manager.hpp 73.68% 2 Missing and 3 partials ⚠️
..._filtering/include/pose_filtering/lib/typedefs.hpp 33.33% 3 Missing and 1 partial ⚠️
.../include/pose_filtering/ros/pose_filtering_ros.hpp 0.00% 2 Missing ⚠️
.../pose_action_server/src/pose_action_server_ros.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #655      +/-   ##
==========================================
+ Coverage   33.49%   34.38%   +0.88%     
==========================================
  Files          44       52       +8     
  Lines        3003     3452     +449     
  Branches      780      922     +142     
==========================================
+ Hits         1006     1187     +181     
- Misses       1814     2056     +242     
- Partials      183      209      +26     
Flag Coverage Δ
unittests 34.38% <40.44%> (+0.88%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../pose_action_server/src/pose_action_server_ros.cpp 0.00% <0.00%> (ø)
.../include/pose_filtering/ros/pose_filtering_ros.hpp 0.00% <0.00%> (ø)
..._filtering/include/pose_filtering/lib/typedefs.hpp 33.33% <33.33%> (ø)
.../include/pose_filtering/lib/pose_track_manager.hpp 73.68% <73.68%> (ø)
...ring/pose_filtering/src/lib/pose_track_manager.cpp 89.25% <89.25%> (ø)
...tering/pose_filtering/test/test_pose_filtering.cpp 75.32% <75.32%> (ø)
...ose_filtering/src/ros/pose_filtering_ros_debug.cpp 0.00% <0.00%> (ø)
...ltering/src/ros/pose_filtering_ros_conversions.cpp 0.00% <0.00%> (ø)
...ring/pose_filtering/src/ros/pose_filtering_ros.cpp 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@Andeshog Andeshog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part1

Comment on lines +3 to +5
pose_sub_topic: "/aruco_detector/board"
pose_array_pub_topic: "/filtered_pose_array"
landmark_pub_topic: "/filtered_landmarks"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason these topics are not part of the topic list in orca.yaml, like the rest of the packages in vortex-auv?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package is not supposed to be used in production. Only for tuning/testing and debugging. The plan is to have the landmark server import the /lib part of this package. So this package will mainly be used to tune for various different obejcts etc.

Comment on lines +49 to +53
/**
* @brief Get the list of currently maintained tracks.
* @return const reference to internal track vector
*/
const std::vector<Track>& get_tracks() { return tracks_; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also add const at the end to signal that the function does not modify

const std::vector<Track>& get_tracks() const;

Comment on lines +121 to +122
// Internal bookkeeping
int track_id_counter_ = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would use brace init for consistency

Comment on lines +80 to +82
void setup_debug_publishers();
void publish_meas_debug();
void publish_state_debug();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picky, but nice to group methods/member variables

Comment on lines +21 to +22
output='screen',
parameters=[config, {'use_sim_time': True}],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is use_sim_time default to true? Do we even have a \clock topic in sim?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used this for testing with a rosbag and then tf2 is very quick to complain about timestamps. I can add a comment explaining its use case

Comment on lines +22 to +23

Eigen::Matrix<double, 3, Eigen::Dynamic> Z(3, measurements.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Z? Perhaps a more descriptive name? 😅

Comment on lines +43 to +51
if (q.w() < 0.0) {
q.coeffs() *= -1.0;
}

double norm_v = q.vec().norm();

if (norm_v < 1e-6) {
return 2.0 * q.vec();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for these "magic operations" maybe a comment would be nice

Comment on lines +14 to +18
initial_position_std_ = config.initial_position_std;
initial_orientation_std_ = config.initial_orientation_std;
ipda_config_ = config.ipda;
existence_config_ = config.existence;
max_angle_gate_threshold_ = config.max_angle_gate_threshold;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps have the config as a member instead of the individual fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might become more cluttered if i do that as the code is now. The most structured solution would probably be to refactor and separate out a position filter similar to the orientation filter class. I will work on that later if I have time.

I should probably add some dynamic reconfiguration of ros parameters to aid in the tuning process and that might reveal a more intuitive struct setup.

Comment on lines +23 to +24
config,
# {'use_sim_time': True} # If testing with rosbags sim_time might be preferred if bag is looped
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other pr, that this could just be default to false instead of commented out

Comment on lines +34 to +37

int timer_rate_ms = this->declare_parameter<int>("timer_rate_ms");

filter_dt_seconds_ = static_cast<double>(timer_rate_ms) / 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a case where auto is nice, since you already declare it as int so its not necessary to type it twice

const auto timer_rate_ms = this->declare_parameter<int>("timer_rate_ms");

Also consider using chrono for time, as it is safer and more expressive when both handing and converting between units (you use chrono in the pub timer anyway)

Comment on lines +41 to +42
std::bind(&PoseFilteringNode::timer_callback, this));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lambda 🙏

Comment on lines +53 to +54
const std::string pose_sub_topic =
this->declare_parameter<std::string>("pose_sub_topic");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too regarding using auto for repetitive type-typing

Comment on lines +85 to +87
RCLCPP_WARN(
this->get_logger(), "TF transform failed from '%s' to '%s': %s",
msg->header.frame_id.c_str(), target_frame_.c_str(), ex.what());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not spdlog?

Copy link
Contributor

@Andeshog Andeshog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jorgenfj
Copy link
Contributor Author

jorgenfj commented Feb 14, 2026

Summary of changes:

Added landmark type and subtype based pre-filtering.
Removed orientation filter in favor of a unified pose filter.
Added custom gating function for the pose filter.

This PR is now blocked by this vortexntnu/vortex-vkf#34

@jorgenfj jorgenfj requested a review from Andeshog February 14, 2026 12:08
@jorgenfj jorgenfj merged commit 678c9f7 into main Mar 7, 2026
14 checks passed
@jorgenfj jorgenfj deleted the ipda-pose-filtering branch March 7, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants