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

Thruster plugin: add tests and velocity control #1190

Merged
merged 9 commits into from
Nov 15, 2021

Conversation

chapulina
Copy link
Contributor

@chapulina chapulina commented Nov 11, 2021

Summary

The Thruster plugin was added in #749 without tests. This PR adds tests, and while at it, I also:

  • Documentation
    • Documented examples/worlds/auv_controls.sdf
    • Documented missing XML fields in Thruster.hh
    • Updated variables and docs that mentioned RPM, because the plugin uses SI for angular velocity (rad / s)
  • XML params
    • Some parameters were listed as "required", but also offered a default value. I made the implementation consistent with documentation by making parameters that have default values be optional.
    • Fail loading the plugin if the user gives a joint name that doesn't exist
    • Default the namespace to the model name instead of empty; empty is weird because the topic becomes /model/joint/... - this can potentially break users that are currently leaving the namespace empty.
  • Implementation
    • Compute the desired propeller angular velocity only when the desired thrust changes
    • I think the cmd_pos topic is very confusing for this plugin, because the commands are forces in Newtons. So I'm proposing changing the topic to cmd_thrust. I didn't remove cmd_pos for backwards compatibility, but I think we should tick-tock it out.
    • Take the <joint><pose> into account
  • Velocity control
    • Ported the alternative joint velocity control from downstream (osrf/lrauv@c20b44c).
    • The motivation for this feature was that the PID was accumulating errors that made the propellers drift over time
    • While writing tests, it became clear that using JointVelocityCmd makes the vehicle much more unstable than directly applying the wrench to the link. So there's a trade-off.

Test it

Follow the instructions in auv_controls.sdf.

Here are some handy commands to run the test worlds too:

ign gazebo -r -v 4 src/ign-gazebo/test/worlds/thruster_pid.sdf
ign topic -t /model/sub/joint/propeller_joint/cmd_thrust  -m ignition.msgs.Double -p 'data: 0.3'
ign gazebo -r -v 4 src/ign-gazebo/test/worlds/thruster_vel_cmd.sdf
ign topic -t /model/custom/joint/propeller_joint/cmd_thrust  -m ignition.msgs.Double -p 'data: 0.3'

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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

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

Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
@github-actions github-actions bot added the 🏢 edifice Ignition Edifice label Nov 11, 2021
@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #1190 (0908925) into ign-gazebo5 (ba53127) will increase coverage by 0.13%.
The diff coverage is 90.90%.

Impacted file tree graph

@@               Coverage Diff               @@
##           ign-gazebo5    #1190      +/-   ##
===============================================
+ Coverage        65.87%   66.00%   +0.13%     
===============================================
  Files              254      255       +1     
  Lines            20026    20127     +101     
===============================================
+ Hits             13192    13285      +93     
- Misses            6834     6842       +8     
Impacted Files Coverage Δ
src/systems/thruster/Thruster.cc 92.07% <90.90%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba53127...0908925. Read the comment docs.

Signed-off-by: Louise Poubel <louise@openrobotics.org>
arjo129
arjo129 previously approved these changes Nov 12, 2021
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

We should be OK to merge this as most of the issues are experienced at low velocities and I suspect due to issues with the hydrostatics. Appologies I've not yet tested this this review was for another PR.

@arjo129 arjo129 self-requested a review November 12, 2021 03:16
@arjo129 arjo129 dismissed their stale review November 12, 2021 03:17

facepalm commented on wrong PR!!!

@matosinho
Copy link

I see that @chapulina added TODO to configure max and min thrust in the sdf. This means that it will be done in another PR? I think that would be a good addition.

@chapulina
Copy link
Contributor Author

I see that @chapulina added TODO to configure max and min thrust in the sdf. This means that it will be done in another PR? I think that would be a good addition.

I wasn't planning on tackling it anytime soon, but I agree it would be a nice addition

Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! The tests and up-streaming are looking good. I've run it on my computer and it works.

test/integration/thruster.cc Outdated Show resolved Hide resolved
test/integration/thruster.cc Show resolved Hide resolved
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
@chapulina chapulina merged commit ab2ef6c into ign-gazebo5 Nov 15, 2021
@chapulina chapulina deleted the chapulina/5/thruster_test branch November 15, 2021 22:23
@iche033
Copy link
Contributor

iche033 commented Feb 2, 2022

I see that @chapulina added TODO to configure max and min thrust in the sdf. This means that it will be done in another PR? I think that would be a good addition.

here's a pull request for this: #1318

@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-04-13-fortress-edifice/1367/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏢 edifice Ignition Edifice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants