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

Feature/hydrodynamics #749

Merged
merged 18 commits into from
Apr 26, 2021
Merged

Feature/hydrodynamics #749

merged 18 commits into from
Apr 26, 2021

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Apr 8, 2021

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

🎉 New feature

Closes #

Summary

This PR adds support for hydrodynamic simulation of underwater vehicles. It does so by introducing two new plugins. The first consists of a new Hydrodynamics system and a new Thruster system. These systems are based on the equations described in Fossen's "Guidance and Control of Ocean Vehicles".
loop
I've added an example world and tutorial giving more details of how to use the new plugins.

Test it

An example configuration is provided in the examples folder. The example uses the LiftDrag plugin to apply steering controls. It also uses the thruster plugin to propel the craft and the buoyancy plugin for buoyant force. To run the example run.

ign gazebo auv_controls.sdf

To control the rudder of the craft run the following

ign topic -t /model/tethys/joint/vertical_fins_joint/0/cmd_pos -m ignition.msgs.Double -p 'data: -0.17'

To apply a thrust you may run the following command

ign topic -t /model/tethys/joint/propeller_joint/cmd_pos -m ignition.msgs.Double -p 'data: -31'

The vehicle should move in a circle.

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

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

@arjo129 arjo129 requested a review from chapulina as a code owner April 8, 2021 10:31
@github-actions github-actions bot added 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress labels Apr 8, 2021
@caguero caguero self-requested a review April 8, 2021 14:33
@chapulina chapulina removed the 🏯 fortress Ignition Fortress label Apr 19, 2021
Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

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

This looks pretty good! Thanks for the tutorial and examples. I added some minor suggestions but it's very close.

src/systems/hydrodynamics/Hydrodynamics.cc Show resolved Hide resolved
src/systems/hydrodynamics/Hydrodynamics.hh Show resolved Hide resolved
src/systems/hydrodynamics/Hydrodynamics.cc Outdated Show resolved Hide resolved
if (!_ecm.Component<ignition::gazebo::components::WorldPose>(
_entity))
{
_ecm.CreateComponent(_entity,
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, do you need to create this component and the angular velocity one? I don't see where you consume them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

src/systems/hydrodynamics/Hydrodynamics.cc Outdated Show resolved Hide resolved
src/systems/thruster/Thruster.hh Show resolved Hide resolved
src/systems/thruster/Thruster.cc Show resolved Hide resolved
src/systems/thruster/Thruster.hh Show resolved Hide resolved
src/systems/thruster/Thruster.cc Outdated Show resolved Hide resolved
@caguero
Copy link
Contributor

caguero commented Apr 22, 2021

I took the liberty of adding a few commits (22c0f13 and 057d9e2) to tweak the style and minor typos.

arjo129 and others added 15 commits April 23, 2021 17:44
* init integration setup

Signed-off-by: Mabel Zhang <[email protected]>

* add custom protobuf messages; need to fix include and lib paths

Signed-off-by: Mabel Zhang <[email protected]>

* Thruster plugin (#10)

* fix fluid density

Signed-off-by: Arjo Chakravarty <[email protected]>

* Finish porting force plugin

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix formula

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix propeller spinning direction

Signed-off-by: Arjo Chakravarty <[email protected]>

* Add plugin

Signed-off-by: Arjo Chakravarty <[email protected]>

* update citation

Signed-off-by: Arjo Chakravarty <[email protected]>

* Style fixes

Signed-off-by: Arjo Chakravarty <[email protected]>

* style fixes

Signed-off-by: Arjo Chakravarty <[email protected]>

* purposely messing up, so that git will eventually stop being a git and actually correctly sync this file

Signed-off-by: Arjo Chakravarty <[email protected]>

* Git, stop being a git and sync this file

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix line length 🧹

Signed-off-by: Arjo Chakravarty <[email protected]>

* update license 🗝️

Signed-off-by: Arjo Chakravarty <[email protected]>

* whoops wrong location for 🗝️ license

Signed-off-by: Arjo Chakravarty <[email protected]>

* update year.

Signed-off-by: Arjo Chakravarty <[email protected]>

* update year

Signed-off-by: Arjo Chakravarty <[email protected]>

* add protobuf messages

Signed-off-by: Mabel Zhang <[email protected]>

* cleanup

Signed-off-by: Mabel Zhang <[email protected]>

* add initial gps code

Signed-off-by: Arjo Chakravarty <[email protected]>

* Initial integration work

Signed-off-by: Arjo Chakravarty <[email protected]>

* Add current state to comms plugin

Signed-off-by: Arjo Chakravarty <[email protected]>

* Add lat long

Signed-off-by: Arjo Chakravarty <[email protected]>

* Add proppeller angular velocity

Signed-off-by: Arjo Chakravarty <[email protected]>

* Adds support for sending commands

Signed-off-by: Arjo Chakravarty <[email protected]>

* add mbari operation commands to readme

Signed-off-by: Mabel Zhang <[email protected]>

* add manual code check scripts

Signed-off-by: Mabel Zhang <[email protected]>

* Manual style fixes

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix crash with fixnan, fix command fields (#17)

Signed-off-by: Mabel Zhang <[email protected]>

* finish implementation

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix compile issues

Signed-off-by: Arjo Chakravarty <[email protected]>

* Adds plugin to model

Signed-off-by: Arjo Chakravarty <[email protected]>

* fix inability to reverse.

Signed-off-by: Arjo Chakravarty <[email protected]>

* publish sim time in LRAUVState.Header; fix raw pointer in msg

Signed-off-by: Mabel Zhang <[email protected]>

* fix camel case

Signed-off-by: Arjo Chakravarty <[email protected]>

* remove blank lines

Signed-off-by: Arjo Chakravarty <[email protected]>

* adds rudder position reporting

* added more logs

Signed-off-by: Arjo Chakravarty <[email protected]>

* Change units to radians

Signed-off-by: Arjo Chakravarty <[email protected]>

* Add transform for velocity forces.

Signed-off-by: Arjo Chakravarty <[email protected]>

* Adds hydrodynamics

Signed-off-by: Arjo Chakravarty <[email protected]>

* remove unessecary debugging stuff

Signed-off-by: Arjo Chakravarty <[email protected]>

* clamp thruster value to pid controller to prevent crash

Signed-off-by: Mabel Zhang <[email protected]>

* expose robot namespace as SDF plugin parameter

Signed-off-by: Mabel Zhang <[email protected]>

* standardize thruster plugin with Ignition style

Signed-off-by: Mabel Zhang <[email protected]>

* Added centripetal matrix back in.

Signed-off-by: Arjo Chakravarty <[email protected]>

* Update comments

Signed-off-by: Arjo Chakravarty <[email protected]>

* Update constants and set controllers to output in radians per second.

Signed-off-by: Arjo Chakravarty <[email protected]>

* refactor out ThrustToAngularVec function

Signed-off-by: Arjo Chakravarty <[email protected]>

* refactor and fix style

Signed-off-by: Arjo Chakravarty <[email protected]>

* more refactoring

Signed-off-by: Arjo Chakravarty <[email protected]>

Co-authored-by: Mabel Zhang <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Ashton Larkin <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
* add enable/disable diffdrive

Signed-off-by: Guillaume Doisy <[email protected]>

* remove debug

Signed-off-by: Guillaume Doisy <[email protected]>

* do not subscribe to enable if topic is empty

Signed-off-by: Guillaume Doisy <[email protected]>

* add test

Signed-off-by: Guillaume Doisy <[email protected]>

* lint and style

Signed-off-by: Guillaume Doisy <[email protected]>

* change enable type to bool and renamed to enabled

Signed-off-by: Guillaume Doisy <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 requested a review from iche033 as a code owner April 23, 2021 09:45
@caguero caguero merged commit 9599770 into gazebosim:ign-gazebo5 Apr 26, 2021
scpeters added a commit that referenced this pull request May 19, 2021
* 🎈 3.8.0 (#688)

Signed-off-by: Louise Poubel <[email protected]>

* Make it so joint state publisher is quieter (#696)

Signed-off-by: Michael Carroll <[email protected]>

* [BULLET] Making GetContactsFromLastStepFeature optional in Collision Features (#690)

* GetContactsFromLastStepFeature made optional

Signed-off-by: Tomas Lorente <[email protected]>

Co-authored-by: Addisu Z. Taddese <[email protected]>

* Add test for thermal object temperatures below 0 kelvin (#621)

Signed-off-by: Ashton Larkin <[email protected]>

* Scenebroadcaster sensors (#698)

* Add sensors to scene broadcaster

Signed-off-by: Nate Koenig <[email protected]>

* Update src/systems/scene_broadcaster/SceneBroadcaster.cc

Co-authored-by: Michael Carroll <[email protected]>

* Fix codecheck

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>

* Fix diffuse and ambient values for ackermann example (#707)

Signed-off-by: Ammaar Solkar <[email protected]>

* 🎈 5.0.0 (#731)

Signed-off-by: Louise Poubel <[email protected]>

* Support configuring particle scatter ratio in particle emitter system (#674)

* set particle scatter ratio through sdf

Signed-off-by: Ian Chen <[email protected]>

* address feedback

Signed-off-by: Ian Chen <[email protected]>

* add todo note about merging forward

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Ashton Larkin <[email protected]>

* Update PlaybackScrubber description (#733)

Signed-off-by: Ammaar Solkar <[email protected]>

* Iterate through changed links only in UpdateSim (#678)

Signed-off-by: Ashton Larkin <[email protected]>

* Do not pass -Wno-unused-parameter to MSVC compiler (#716)

Signed-off-by: Silvio Traversaro <[email protected]>

* Use Protobuf_IMPORT_DIRS instead of PROTOBUF_IMPORT_DIRS for compatibility with Protobuf CMake config (#715)

Signed-off-by: Silvio Traversaro <[email protected]>

* Fix component inspector shutdown crash (#724)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Alejandro Hernández Cordero <[email protected]>

* Validate step size and RTF parameters (#740)

Only set them if they are strictly positive.

Signed-off-by: Luca Della Vedova <[email protected]>

* Fix compute_rtfs arguments (#737)

Signed-off-by: Caio Amaral <[email protected]>

* Fixed collision visual bounding boxes (#746)

Signed-off-by: Jenn Nguyen <[email protected]>

* Fix CMakelists.txt merge

Signed-off-by: Nate Koenig <[email protected]>

* ECM's ChangedState gets message with modified components (#742)

* ecm's ChangedState to contain modified components

Signed-off-by: Jenn Nguyen <[email protected]>

* updated log_system test

Signed-off-by: Jenn Nguyen <[email protected]>

* removed unnecessary calls

Signed-off-by: Jenn Nguyen <[email protected]>

Co-authored-by: Ian Chen <[email protected]>

* fixed particle emitter forward playback (#745)

Signed-off-by: Jenn Nguyen <[email protected]>

* Merge pull request #730 from ignitionrobotics/particle_emitter

Particle emitter based on SDF

* 4 7 0 prep (#755)

* Prepare for 4.7.0

Signed-off-by: Nate Koenig <[email protected]>

* Added placeholder

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>

* Fix 'invalid animation update data' msg for actors (#754)

Signed-off-by: Ashton Larkin <[email protected]>

* Update benchmark comparison instructions (#766) (#766)

Signed-off-by: Ashton Larkin <[email protected]>

* [DiffDrive] add enable/disable (#772)

* add enable/disable diffdrive

Signed-off-by: Guillaume Doisy <[email protected]>

* remove debug

Signed-off-by: Guillaume Doisy <[email protected]>

* do not subscribe to enable if topic is empty

Signed-off-by: Guillaume Doisy <[email protected]>

* add test

Signed-off-by: Guillaume Doisy <[email protected]>

* lint and style

Signed-off-by: Guillaume Doisy <[email protected]>

* change enable type to bool and renamed to enabled

Signed-off-by: Guillaume Doisy <[email protected]>

* Add odometry publisher system (#547)

* Create Initial Odometry Publisher system plugin

Add code for initial plugin that gets position from Pose component and
calculates velocities based on rolling mean from displacement data.

Signed-off-by: Maganty Rushyendra <[email protected]>

* Remove Linear and Angular Velocity components

Also renames frames in Odometry msg to include model name, and makes
various style changes.

Signed-off-by: Maganty Rushyendra <[email protected]>

* Get World pose instead of pose of robot base frame

Signed-off-by: Maganty Rushyendra <[email protected]>

* Add documentation for variables and functions

Includes minor stylistic changes.

Signed-off-by: Maganty Rushyendra <[email protected]>

* Check for valid odomTopic and update copyright year

Signed-off-by: Maganty Rushyendra <[email protected]>

* Add tests for OdometryPublisherSystem and fix velocity calculation bug

Swap X and Y linear velocities when calculating odometry velocities
relative to robotBaseFrame.

Signed-off-by: Maganty Rushyendra <[email protected]>

Co-authored-by: ahcorde <[email protected]>

* Patch particle emitter2 service (#777)

* Patch particle emitter2 service

Signed-off-by: Nate Koenig <[email protected]>

* Remove condition variable

Signed-off-by: Nate Koenig <[email protected]>

* Set emitter frame and relative pose

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>

* Preparing for 4.8.0 release (#780)

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>

* 👩‍🌾 Enable Focal CI (#646)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Michael Carroll <[email protected]>

* [TPE] Support setting individual link velocity  (#427)

Signed-off-by: claireyywang <[email protected]>
Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Ian Chen <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>

* Don't store duplicate ComponentTypeId in ECM (#751)

Signed-off-by: Louise Poubel <[email protected]>

* Feature/hydrodynamics (#749)

Implement hydrodynamics and thruster plugin.

Signed-off-by: Arjo Chakravarty <[email protected]>
Co-authored-by: Mabel Zhang <[email protected]>
Co-authored-by: Carlos Agüero <[email protected]>

* Fix macOS build: components::Name in benchmark (#784)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Steve Peters <[email protected]>

* Fix ColladaExporter submesh index bug (#763)

Signed-off-by: Jorge Perez <[email protected]>

* 👩‍🌾 Fix Windows build and some warnings (#782)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Alejandro Hernández Cordero <[email protected]>

* Prevent crash on Plotting plugin with mutex (#747)

Signed-off-by: Louise Poubel <[email protected]>

* Bump ign-physics version to 3.2 (#792)

Signed-off-by: Louise Poubel <[email protected]>

* Bump to ign-msgs 7.1 / sdformat 11.1, Windows fixes (#758)

Signed-off-by: Louise Poubel <[email protected]>

* Util: Use public API from libsdformat for detecting non-file source (#794)

Signed-off-by: Eric Cousineau <[email protected]>

* Fix included nested model expansion in SDF generation (#768)

* fixed included nested model expansion

Signed-off-by: Jenn Nguyen <[email protected]>

* added resource path to test

Signed-off-by: Jenn Nguyen <[email protected]>

* use orig URIs & support multi level nesting

Signed-off-by: Jenn Nguyen <[email protected]>

* save fuel version when enabled

Signed-off-by: Jenn Nguyen <[email protected]>

* retrieve uri from map

Signed-off-by: Jenn Nguyen <[email protected]>

* copy included element

Signed-off-by: Jenn Nguyen <[email protected]>

* clear attributes before copying include element

Signed-off-by: Jenn Nguyen <[email protected]>

* Map canonical links to their models (#736)

Signed-off-by: Ashton Larkin <[email protected]>

* ColladaExporter, export submesh selected (#802)

* Export only submesh if selected
* Add test case for the PR
* Attempting a unified solution

Signed-off-by: Jorge Perez <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>

Co-authored-by: Michael Carroll <[email protected]>
Co-authored-by: Jose Tomas Lorente <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Ashton Larkin <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Ammaar Solkar <[email protected]>
Co-authored-by: Ian Chen <[email protected]>
Co-authored-by: Ashton Larkin <[email protected]>
Co-authored-by: Silvio Traversaro <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Luca Della Vedova <[email protected]>
Co-authored-by: Caio Amaral <[email protected]>
Co-authored-by: Jenn Nguyen <[email protected]>
Co-authored-by: G.Doisy <[email protected]>
Co-authored-by: Rushyendra Maganty <[email protected]>
Co-authored-by: Claire Wang <[email protected]>
Co-authored-by: Arjo Chakravarty <[email protected]>
Co-authored-by: Mabel Zhang <[email protected]>
Co-authored-by: Carlos Agüero <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: Jorge Perez <[email protected]>
Co-authored-by: Eric Cousineau <[email protected]>
Co-authored-by: Jorge Perez <[email protected]>
@Pedro-Roque
Copy link
Contributor

@arjo129 - opening a discussion on naming for this plugin. I understand that Thrusters are used for underwater propellers enclosed in a cylinder to propel a vehicle forward. However, thrusters are also used in the context of a spacecraft, in which case the dynamics are considerably different. What name should we give to the later case?

@arjo129
Copy link
Contributor Author

arjo129 commented Jun 5, 2024

Hi @Pedro-Roque thanks for pointing this out. As this has been merged and in use for several years now it would be difficult to change. I recommend opening a ticket on the issues page so that we can track this conversation. I guess this would have been better served if it was called "MaritimeThruster" instead of "Thruster". Perhaps you can call yours "SpaceThruster"? If you are using RCS then one could call it "RCSThruster".

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.

6 participants