Skip to content

Conversation

@vedh1234
Copy link
Contributor

@vedh1234 vedh1234 commented Jan 7, 2026

Fixes #2033

Description
This PR adds unit tests for the Odometry class in diff_drive_controller to verify the new mathematical logic introduced in #1854.

Changes

  • Added test/test_odometry.cpp covering:
    • Exact Arc integration (Curved motion)
    • Linear and Pure Rotation motion
    • Open Loop updates
    • Handling of small dt
  • Updated CMakeLists.txt to build the new test.

Testing

  • Verified locally with colcon test: 8 tests passed, 0 failures.

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.85%. Comparing base (c703235) to head (db70176).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2099      +/-   ##
==========================================
+ Coverage   84.79%   84.85%   +0.06%     
==========================================
  Files         151      152       +1     
  Lines       14607    14630      +23     
  Branches     1266     1266              
==========================================
+ Hits        12386    12415      +29     
+ Misses       1763     1757       -6     
  Partials      458      458              
Flag Coverage Δ
unittests 84.85% <100.00%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
diff_drive_controller/test/test_odometry.cpp 100.00% <100.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

@Amronos Amronos left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the tests! Some minor suggestions.


TEST_F(OdometryTest, TestOpenLoopUpdate)
{
// Test the new API: try_update_open_loop
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Test the new API: try_update_open_loop

I don't think this is needed.

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 have removed it.

// Directly feed v=2.0, w=0.5, dt=1.0
bool result = odometry_.try_update_open_loop(2.0, 0.5, 1.0);

EXPECT_TRUE(result);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add this to the other test cases also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestions, I have updated it at other places.

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.

Tests for New Odometry Implementation

2 participants