Skip to content

Omni wheel drive odometry update - #2286

Open
Devdoot57 wants to merge 9 commits into
ros-controls:masterfrom
Devdoot57:omni-drive-odom-update
Open

Omni wheel drive odometry update#2286
Devdoot57 wants to merge 9 commits into
ros-controls:masterfrom
Devdoot57:omni-drive-odom-update

Conversation

@Devdoot57

@Devdoot57 Devdoot57 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the omni_wheel_drive_controller odometry implementation to use double dt for integration instead of relying on rclcpp::Time (matching #1854). It also introduces a comprehensive gtest suite to verify the holonomic kinematics and integration math (matching #2099).

This rolls out the architectural improvements requested in #2039 for the omni-wheel base.

Changes:

  • Odometry API: Deprecated updateFromPos, updateFromVel, and updateOpenLoop. Replaced with update_from_pos, update_from_vel, and update_open_loop.
  • Controller Loop: Updated the main controller update to account for the above mentioned changes.
  • Testing: Added test_odometry.cpp covering:
    • Independent holonomic Y and X movements.
    • Exact arc integration for simultaneous X, Y, and rotational velocities.
    • Boundary checks for small dt rejection.

@codecov

codecov Bot commented Apr 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.08219% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.73%. Comparing base (c7b97ca) to head (8878ebe).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
omni_wheel_drive_controller/src/odometry.cpp 65.78% 9 Missing and 4 partials ⚠️
...ive_controller/src/omni_wheel_drive_controller.cpp 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2286      +/-   ##
==========================================
- Coverage   86.83%   86.73%   -0.11%     
==========================================
  Files         148      149       +1     
  Lines       16273    16338      +65     
  Branches     1368     1374       +6     
==========================================
+ Hits        14131    14171      +40     
- Misses       1635     1654      +19     
- Partials      507      513       +6     
Flag Coverage Δ
unittests 86.73% <78.08%> (-0.11%) ⬇️

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

Files with missing lines Coverage Δ
...r/include/omni_wheel_drive_controller/odometry.hpp 100.00% <ø> (ø)
omni_wheel_drive_controller/test/test_odometry.cpp 100.00% <100.00%> (ø)
...ive_controller/src/omni_wheel_drive_controller.cpp 83.64% <25.00%> (-0.38%) ⬇️
omni_wheel_drive_controller/src/odometry.cpp 63.80% <65.78%> (-22.11%) ⬇️

... and 2 files with indirect coverage changes

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

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions Bot added the stale label Jun 1, 2026
@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

This pull request is in conflict. Could you fix it @Devdoot57?

@github-actions github-actions Bot removed the stale label Jun 2, 2026
Comment thread omni_wheel_drive_controller/include/omni_wheel_drive_controller/odometry.hpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes omni_wheel_drive_controller odometry to integrate using an explicit double dt (instead of deriving it from rclcpp::Time in the core update path), and adds a new gtest/gmock suite to validate holonomic kinematics and integration behavior for an omni-wheel base.

Changes:

  • Added new dt-based odometry update APIs (update_from_pos, update_from_vel, update_open_loop) and deprecated the prior rclcpp::Time-based methods.
  • Updated the controller update loop to call the new dt-based odometry APIs using period.seconds().
  • Added test_odometry.cpp to validate straight-line motion, pure rotation, and exact-arc integration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
omni_wheel_drive_controller/test/test_odometry.cpp Adds unit tests for omni-wheel odometry integration and kinematics.
omni_wheel_drive_controller/src/omni_wheel_drive_controller.cpp Switches controller loop to new dt-based odometry APIs.
omni_wheel_drive_controller/src/odometry.cpp Implements new dt-based odometry updates and refactors integration to accept velocities + dt.
omni_wheel_drive_controller/include/omni_wheel_drive_controller/odometry.hpp Deprecates old APIs and declares the new dt-based methods.
omni_wheel_drive_controller/CMakeLists.txt Adds the odometry unit test target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +91
ament_add_gmock(test_odometry
test/test_odometry.cpp
src/odometry.cpp
)
Comment on lines +54 to 63
// Disable deprecated warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (updateFromVel(wheels_vel, time))
#pragma GCC diagnostic pop
{
return true;
}
return false;
}
Comment on lines +73 to +79
// Estimate angular velocity of wheels using old and current position [rads/s]:
std::vector<double> wheels_vel(wheels_pos.size());
for (size_t i = 0; i < static_cast<size_t>(wheels_pos.size()); ++i)
{
wheels_vel[i] = (wheels_pos[i] - wheels_old_pos_[i]) / dt;
wheels_old_pos_[i] = wheels_pos[i];
}
Comment on lines +105 to +108
if (std::fabs(dt) < 1e-6)
{
return false;
}
Comment on lines +168 to +180
bool Odometry::update_open_loop(
const double & linear_x_vel, const double & linear_y_vel, const double & angular_vel, double dt)
{
// Integrate odometry:
integrate(linear_x_vel, linear_y_vel, angular_vel, dt);

// Save last linear and angular velocity:
linear_x_vel_ = linear_x_vel;
linear_y_vel_ = linear_y_vel;
angular_vel_ = angular_vel;

return true;
}
Comment on lines +15 to +16
#include "gmock/gmock.h"
#include "omni_wheel_drive_controller/odometry.hpp"
Comment on lines +45 to +49
bool update_from_pos(const std::vector<double> & wheels_pos, double dt);
bool update_from_vel(const std::vector<double> & wheels_vel, double dt);
bool update_open_loop(
const double & linear_x_vel, const double & linear_y_vel, const double & angular_vel,
double dt);

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes LGTM, but copilot has some valid suggestions. Please address them, and we can merge this soon!

@christophfroehlich christophfroehlich moved this from Needs review to WIP in Review triage Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: WIP

Development

Successfully merging this pull request may close these issues.

4 participants