Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ackermann steering odometry #921

Merged
merged 8 commits into from
Dec 30, 2023

Conversation

franzrammerstorfer
Copy link
Contributor

This is IMHO a quick and easy fix for

#878

@christophfroehlich christophfroehlich linked an issue Dec 12, 2023 that may be closed by this pull request
@christophfroehlich christophfroehlich changed the title Ackermann steering fix. issue #878 Fix ackermann steering odometry Dec 12, 2023
@christophfroehlich christophfroehlich added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Dec 12, 2023
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (dcd15ee) 46.86% compared to head (5181b95) 48.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #921      +/-   ##
==========================================
+ Coverage   46.86%   48.03%   +1.16%     
==========================================
  Files          41       41              
  Lines        3862     3862              
  Branches     1816     1816              
==========================================
+ Hits         1810     1855      +45     
+ Misses        792      745      -47     
- Partials     1260     1262       +2     
Flag Coverage Δ
unittests 48.03% <100.00%> (+1.16%) ⬆️

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

Files Coverage Δ
...ring_controllers_library/src/steering_odometry.cpp 62.27% <100.00%> (+13.17%) ⬆️

... and 2 files with indirect coverage changes

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Hi @franzrammerstorfer! Thanks for the PR.

Some first comments from my side:

To fix the linter issues, you can check it locally by

  • install pre-commit by pip3 install pre-commit
  • pre-commit run--all

Why do you use EXPECT_FLOAT_EQ instead of EXPECT_DOUBLE_EQ?

Does it make sense to check these cases also with update_from_velocity and update_from_position, i.e., for params_.open_loop=false?

@franzrammerstorfer
Copy link
Contributor Author

Hi @christophfroehlich!
Sorry for not listen to pre-commit checks, I did not read the instructions carefully enough. I think I fixed that with my last few commits. I misused EXPECT_FLOAT_EQ, bad habit, thanks for the hint.

Yes, you're right, there are a lot of things open to test -- but right now I just wanted to provide a quick fix for the Ackermann odometry, only rudimentary tested. Maybe we should open a new issue, tagged "help wanted" for proper testing of the steering lib -- starting with tests for the integrator functions, etc. But maybe first we should check for a redesign cf. #692

BTW, I just added this file 'test_steering_odometry.cpp', with some hard-coded tests. Is that the way to go, or do we want to have a more advanced testing style?

@christophfroehlich
Copy link
Contributor

christophfroehlich commented Dec 12, 2023

Yes, you're right, there are a lot of things open to test -- but right now I just wanted to provide a quick fix for the Ackermann odometry, only rudimentary tested. Maybe we should open a new issue, tagged "help wanted" for proper testing of the steering lib -- starting with tests for the integrator functions, etc. But maybe first we should check for a redesign cf. #692

ok, I'll create a new issue then.

BTW, I just added this file 'test_steering_odometry.cpp', with some hard-coded tests. Is that the way to go, or do we want to have a more advanced testing style?

Should the expectations of the FW kinematics be true for all the different kinematic configurations? Then we could change this to a parameterized test as we have with JTC

// From the tutorial: https://www.sandordargo.com/blog/2019/04/24/parameterized-testing-with-gtest
class TrajectoryControllerTestParameterized
: public TrajectoryControllerTest,
public ::testing::WithParamInterface<
std::tuple<std::vector<std::string>, std::vector<std::string>>>
{
public:
virtual void SetUp()
{
TrajectoryControllerTest::SetUp();
command_interface_types_ = std::get<0>(GetParam());
state_interface_types_ = std::get<1>(GetParam());
}
static void TearDownTestCase() { TrajectoryControllerTest::TearDownTestCase(); }
};

// position controllers
INSTANTIATE_TEST_SUITE_P(
PositionTrajectoryControllers, TrajectoryControllerTestParameterized,
::testing::Values(
std::make_tuple(std::vector<std::string>({"position"}), std::vector<std::string>({"position"})),
std::make_tuple(
std::vector<std::string>({"position"}), std::vector<std::string>({"position", "velocity"})),
std::make_tuple(
std::vector<std::string>({"position"}),
std::vector<std::string>({"position", "velocity", "acceleration"}))));

@christophfroehlich
Copy link
Contributor

But we can for now just fix the CI and extend the tests in a follow-up PR.

@christophfroehlich
Copy link
Contributor

@aleksandrsizmailovs and @roncapat, as you have commented on the issue: Is this PR fine for you?

@christophfroehlich christophfroehlich enabled auto-merge (squash) December 14, 2023 07:52
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

LGTM

@roncapat
Copy link
Contributor

Seems fine IMHO :)

@aleksandrsizmailovs
Copy link

@aleksandrsizmailovs and @roncapat, as you have commented on the issue: Is this PR fine for you?

Looks good to me.

@christophfroehlich christophfroehlich merged commit d915497 into ros-controls:master Dec 30, 2023
12 of 13 checks passed
mergify bot pushed a commit that referenced this pull request Dec 30, 2023
* fix Ackermann steering odometry bug issue #878

---------

Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit d915497)
mergify bot pushed a commit that referenced this pull request Dec 30, 2023
* fix Ackermann steering odometry bug issue #878

---------

Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit d915497)
bmagyar pushed a commit that referenced this pull request Jan 3, 2024
bmagyar pushed a commit that referenced this pull request Jan 3, 2024
henrygerardmoore pushed a commit to henrygerardmoore/ros2_controllers that referenced this pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ackermann steering odometry bug?
5 participants