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

Adding MecanumDrive plugin with Odom and Tf, with Tests. #2297

Open
wants to merge 15 commits into
base: gz-sim8
Choose a base branch
from

Conversation

muttistefano
Copy link

@muttistefano muttistefano commented Jan 24, 2024

🎉 New feature

Summary

Adding MecanumDrive plugin with Odom and Tf, with Tests.
Relative to #1665 , but targets gz-sim8, fixes an include error in the plugin and add tests.

Checklist

  • [ x] Signed all commits for DCO
  • [ x] Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Jan 24, 2024
@azeey
Copy link
Contributor

azeey commented Feb 2, 2024

Thanks for your contribution @muttistefano. Do you mind fixing the linter issues and signing off on your commit (see https://github.com/gazebosim/gz-sim/pull/2297/checks?check_run_id=20866188364).

@muttistefano
Copy link
Author

Hi @azeey , thanks for the answer.
I signed the commits but I don't understand the linter issue.

@azeey
Copy link
Contributor

azeey commented Feb 12, 2024

There are some trailing white spaces in the code (see https://github.com/gazebosim/gz-sim/actions/runs/7765649621/job/21405089973?pr=2297).

Stefano Mutti and others added 9 commits March 5, 2024 10:54
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
Signed-off-by: Stefano Mutti <[email protected]>
@will-44
Copy link

will-44 commented May 24, 2024

Hello !
I'm very interested in this PR (as I think a lot of people are). Do you think it could be merged into the main version?
Thank you very much for your help

@muttistefano
Copy link
Author

If I'm not mistaken, the checks are fine, the only thing missing is the review from @mjcarroll .
Thanks :)

Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

@muttistefano I think you've accidentally checked in a few files and directories (e.g. log, .vscode) to the pull request. Could you please remove them?

@muttistefano
Copy link
Author

My bad; it should be fixed now.

@azeey azeey self-requested a review June 10, 2024 18:55
@azeey
Copy link
Contributor

azeey commented Jun 18, 2024

Can you fix DCO?

Signed-off-by: Stefano Mutti <[email protected]>
@azeey azeey added the beta Targeting beta release of upcoming collection label Jul 29, 2024
@@ -0,0 +1,537 @@
/*
* Copyright (C) 2018 Open Source Robotics Foundation
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
* Copyright (C) 2018 Open Source Robotics Foundation
* Copyright (C) 2024 Open Source Robotics Foundation

using namespace std::chrono_literals;

/// \brief Test MecanumDrive system
class MecanumDriveTest : public InternalFixture<::testing::TestWithParam<int>>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to run this multiple times. Can you change this to

Suggested change
class MecanumDriveTest : public InternalFixture<::testing::TestWithParam<int>>
class MecanumDriveTest : public InternalFixture<::testing::Test>

and change all the TEST_P in this file to TEST_F

#include "gz/sim/components/Model.hh"
#include "gz/sim/components/Pose.hh"
#include "gz/sim/Server.hh"
#include "gz/sim/SystemLoader.hh"
Copy link
Contributor

Choose a reason for hiding this comment

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

This header seems to be unused. Can you remove?

Comment on lines +194 to +195
// EXPECT_NEAR(poses.back().Pos().X(), finalModelFramePose.Pos().X(), 1e-2);
// EXPECT_NEAR(poses.back().Pos().Y(), finalModelFramePose.Pos().Y(), 1e-2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for commenting these out? finalModelFramePose is now an unused variable.

/////////////////////////////////////////////////
// See: https://github.com/gazebosim/gz-sim/issues/1175
// See: https://github.com/gazebosim/gz-sim/issues/630
TEST_P(MecanumDriveTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(PublishCmd))
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is copied from the DiffDrive test, but can we first try to enable it and see if it doesn't work on the other platforms?

Comment on lines +212 to +213
testCmdVel(true /*test forward movement*/);
testCmdVel(false /*test backward movement*/);
Copy link

Choose a reason for hiding this comment

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

I was unaware that this MR existed and basically did the exact same work two weeks ago. I also refactored the TestPublishCmd function to also test the sideways, diagonal and rotational movement of the drive instead of only forward and backward, which is what the diff drive test does.

Feel free to grab the function code from my changes in here to improve the coverage.

Comment on lines +159 to +168
// Odometry calculates the pose of a point that is located half way
// between the two wheels, not the origin of the model. For example,
// if the vehicle is commanded to rotate in place, the vehicle will
// rotate about the point half way between the two wheels, thus,
// the odometry position will remain zero.
// However, since the model origin is offset, the model position will
// change. To find the final pose of the model, we have to do the
// following similarity transformation

math::Pose3d tOdomModel(0.554283,0,-0.325,0,0,0);
Copy link

Choose a reason for hiding this comment

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

This transform is correct for the differential drive model, but not for the mecanum one. The mecanum math derivation places the origin at the center of the four wheels, which for the model in the xml is at math::Pose3d tOdomModel(-0.2, 0., 0., 0., 0., 0.);

This is not noticed in the test probably because no rotation is being applied to the drive.

@azeey azeey removed the beta Targeting beta release of upcoming collection label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

4 participants