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

Add support for nested models #32

Merged

Conversation

srmainwaring
Copy link
Collaborator

This PR adds support for nested models. This feature was available in the original version of the plugin for Gazebo11.

Enhancement

Details

Ensure methods to find links, joints and sensors search in nested models.

This change will permit more complex models containing sensors and other peripherals to be composed from a collection of simpler models.

ArduPilot plugin

  • Add a custom version of Model::JointByName.
  • Search for entities given a scoped name and then check that those found support the required components (Joint and JointVelocity).
  • In the ApplyForce function add a check that the JointVelocity and JointPosition components are valid before dereferencing them.
  • Rewrite the search for the IMU sensor component to use scoped names ensuring backwards compatibility.

Models

  • Update the iris models to use composition. The base model iris_with_standoffs defines the frame and rotor joints. The composite model iris_with_ardupilot adds plugins and uses scoped names to refer to the included models joints and sensors.

- Search for links, joints and sensors in nested models
- Add a custom version of Model::JointByName implemented as a lambda
- Search for entities given a scoped name and then check that those
  found support the required components (Joint and JointVelocity)
- Rewrite the search for the IMU sensor component to use scoped names
- In the `ApplyForce` function add a check that the JointVelocity
  and JointPosition components are valid before dereferencing them
- Rename modeLink to imuLink (it is the pose of the link containing the IMU that is passed to the flight controller).
- Fix initialisation of imuLink after rebase.
- Replace references to ignition with gz replacements.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>

Add support for nested models

- Add utility to search for all descendent entities matching an un-scoped name.
- Ensure initialisation of IMU sensor is backwards compatible.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>

Add support for nested models

- Move JointByName into Utils.hh

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>

Add support for nested models

- Update Iris models. The basic model now has no plugins.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
@srmainwaring srmainwaring added the enhancement New feature or request label Dec 15, 2022
@srmainwaring srmainwaring self-assigned this Dec 15, 2022
Copy link
Contributor

@clydemcqueen clydemcqueen left a comment

Choose a reason for hiding this comment

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

LGTM. I tested this against the refactored iris model and it works great. I also ran it against my un-nested models and saw no changes, as expected. Nice enhancement!

src/Util.cc Outdated Show resolved Hide resolved
- Review feedback - remove commented code.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
@srmainwaring srmainwaring merged commit 28829af into ArduPilot:main Dec 16, 2022
@srmainwaring srmainwaring deleted the srmainwaring/garden/nested-models branch December 16, 2022 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for nested models
2 participants