Skip to content

New super vision filter#379

Open
fourpenny wants to merge 36 commits intomainfrom
dev/christian/visionV2
Open

New super vision filter#379
fourpenny wants to merge 36 commits intomainfrom
dev/christian/visionV2

Conversation

@fourpenny
Copy link
Contributor

A simpler vision filter that just uses basic Kalman filtering and that's about it. It keeps the same interface as our previous filter but has a slimmed down design.

You can test it:
colcon test --packages-select new_vision_filter

Or run the sim (or real) launch file:
ros2 launch ateam_bringup bringup_simulation.launch.py

@fourpenny fourpenny requested review from barulicm and chachmu March 4, 2026 03:37
@fourpenny fourpenny self-assigned this Mar 4, 2026
Copy link
Contributor

@barulicm barulicm left a comment

Choose a reason for hiding this comment

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

Some interesting stuff in here. Excited to see a fresh start to this.
We should add more tests to fully exercise as much of the code and math as possible.
We may want to have a deeper conversation about architecture and object management in this at some point. There might be some simplifications we can make, especially on the robot tracking side where we know exactly how many robots we could be tracking.

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>new_vision_filter</name>
Copy link
Contributor

Choose a reason for hiding this comment

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

Package name should match the folder name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have a preference for which we should pick? I'll change them all to match.

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 made it "new_super_vision_filter" for now, since that's more fun, but if the length is a problem I can change it to "new_vision_filter".

PosMeasurement pos;
pos << ball_detection.pos.x,
ball_detection.pos.y;
timestamp = std::chrono::steady_clock::now();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we think about using one of the timestamps from the vision detection frame message? Not sure if you've already considered this, and not sure if the time difference would actually matter in practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, I think it depends on whether we think degradation in quality/lag might be more likely from our vision filter internally or from SSL vision. Do you think it would be worth checking both? I think that switching to the SSL time stamps or adding them as an additional quality check would be straightforward.

bot_detection.pose.position.y;
angle << bot_detection.pose.orientation.w;
robot_id = bot_detection.robot_id;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

timestamp appears to not be initialized or set anywhere. Am I missing something?

Copy link
Contributor Author

@fourpenny fourpenny Mar 16, 2026

Choose a reason for hiding this comment

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

This should be initialized now in the constructor for the RobotMeasurement!


#include <ssl_league_msgs/msg/vision_detection_ball.hpp>

class BallTrack {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider calling these types 'measurement' or 'detection'. At least in my mind, 'track' usually represents the internal filter state used to store detection history or correlate new detections to existing estimate instances.

Suggested change
class BallTrack {
class BallDetection {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed both this and the RobotTrack class to use the suffix "Measurement" instead.

++age;
}
if (health < maxHealth) {
health += 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does health just track the staleness of the ball detections? Seems like it might be useful to include some measure of filter confidence in that metric as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now it just checks the staleness. We could make this number a combination of multiple checks, or another idea I have is to rename this something related to its function ("staleness", maybe) and then add other explicit defined checks related to the filter quality. My thought is that's a good option, since we can continue adding more as we go for now, until we have a better idea of what the best quality checks are.

blue_robots.end(),
[bot_track](const FilteredRobot & bot){return bot_track.getId() == bot.getId();}
);
if (it != blue_robots.end()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this condition inverted? It looks like you're trying to create FilteredRobot instances on demand as new IDs pop up. iterator != end means that an existing element was found.

This should also segfault as written when it takes the else branch as it does not point to a valid object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops... this is fixed. I'm impressed (I think?) it never segfaulted in testing...

@fourpenny
Copy link
Contributor Author

Some interesting stuff in here. Excited to see a fresh start to this. We should add more tests to fully exercise as much of the code and math as possible. We may want to have a deeper conversation about architecture and object management in this at some point. There might be some simplifications we can make, especially on the robot tracking side where we know exactly how many robots we could be tracking.

I think at least as an initial test before the PTO this weekend, I'll plan to see what generally happens to the filter state in a few conditions we're likely to see:

  • If we have multiple balls and/or a very noisy ball
  • If we have robots dropping in and out of visibility
  • If we have two of the same robot on the field (like if we practice on a field with another team with Yellow Robot 1)... I think this is more of a stretch goal/we can rush to address it if needed.

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