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

Support SDFormat 1.8 Composition #542

Merged
merged 16 commits into from
Mar 10, 2021
Merged

Support SDFormat 1.8 Composition #542

merged 16 commits into from
Mar 10, 2021

Conversation

brawner
Copy link
Contributor

@brawner brawner commented Jan 9, 2021

This PR adds support for model composition via <include>'d models. This PR adds the following functionality related to nested models:

  • Supports loading nested models via includes
  • Support nested references to frames
  • Support the use of frames for a joint's parent or child
  • Placement frames with references to nested models
  • AABBs mostly take nested models into account. However, currently one needs to re-click on a nested entity to update its bounding box, since otherwise the bounding box just follows the canonical link. Since there is only one canonical link per model even if it includes many nested models, the bounding box's update is linked to the canonical link. @azeey's work on supporting one canonical link per nested model will help with this.
  • TransformControl of nested models

Work towards #479

@brawner brawner requested a review from azeey January 9, 2021 00:13
@github-actions github-actions bot added the 🏢 edifice Ignition Edifice label Jan 9, 2021
@brawner brawner self-assigned this Jan 11, 2021
@brawner brawner mentioned this pull request Jan 11, 2021
12 tasks
@brawner brawner force-pushed the brawner/composition_sdf_18 branch 3 times, most recently from 7d87eb2 to b342f6e Compare January 26, 2021 01:56
@brawner brawner changed the title WIP: Support SDFormat 1.8 Composition Support SDFormat 1.8 Composition Jan 26, 2021
@brawner brawner marked this pull request as ready for review January 26, 2021 01:57
@brawner brawner force-pushed the brawner/composition_sdf_18 branch from b342f6e to f51154c Compare February 1, 2021 20:14
@brawner
Copy link
Contributor Author

brawner commented Feb 1, 2021

Fixed a cppcheck error and rebased onto main

src/EntityComponentManager.cc Outdated Show resolved Hide resolved
src/SdfEntityCreator.cc Outdated Show resolved Hide resolved
src/SdfEntityCreator.cc Show resolved Hide resolved
Copy link
Contributor Author

@brawner brawner left a comment

Choose a reason for hiding this comment

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

Thanks @azeey!

src/SdfEntityCreator.cc Show resolved Hide resolved
src/SdfEntityCreator.cc Outdated Show resolved Hide resolved
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.

I left a few comments that should be easy to address. The one comment that might be more involved is the FreeGroup feature. We can tackle that in a follow up PR if you'd like. Otherwise, this is looking great!

src/systems/user_commands/UserCommands.cc Outdated Show resolved Hide resolved
src/systems/user_commands/UserCommands.cc Outdated Show resolved Hide resolved
test/integration/sdf_frame_semantics.cc Outdated Show resolved Hide resolved
test/integration/sdf_frame_semantics.cc Outdated Show resolved Hide resolved
TEST_F(SdfFrameSemanticsTest, IncludeNestedModelsRelativeTo)
{
std::string path = std::string(PROJECT_SOURCE_PATH) + "/test/worlds/models";
setenv("IGN_GAZEBO_RESOURCE_PATH",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how well this works across multiple platforms. An alternative is to use sdf::setFindCallback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to be the preferred way of setting the resource path in these test files. I got it from test/integration/physics_system.cc

@@ -1458,14 +1458,6 @@ void PhysicsPrivate::UpdatePhysics(EntityComponentManager &_ecm)
if (modelIt == this->entityModelMap.end())
return true;

// world pose cmd currently not supported for nested models
if (_entity != topLevelModel(_entity, _ecm))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure TPE supports moving nested models separately from their top level model. So, maybe we shouldn't remove this yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, if you have this check then a nested model won't transform correctly, even if it's fully connected by joints.

@@ -280,6 +304,9 @@ Entity SdfEntityCreator::CreateEntities(const sdf::Model *_model,

// Links
bool canonicalLinkCreated = false;
const auto[canonicalLink, canonicalLinkName] =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: canonicalLinkName is not used, so can just be const auto *canonicalLink = _model->CanonicalLink();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

</link>

<joint name="joint_01" type="continuous">
<parent>frame_00</parent>
Copy link
Contributor

Choose a reason for hiding this comment

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

I was getting the error Failed to resolve parent link for joint 'joint_01' with parent name 'frame_00' when I ran INTEGRATION_sdf_frame_semantics. This is because frame_00 can't be referenced from this scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the joint up one level.

src/SdfEntityCreator.cc Show resolved Hide resolved
</visual>
</link>

<joint name="joint_01" type="continuous">
Copy link
Contributor

Choose a reason for hiding this comment

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

DART doesn't support continuous joints yet. Can you change this to revolute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@brawner brawner force-pushed the brawner/composition_sdf_18 branch from 2c6e372 to cbd49c6 Compare February 3, 2021 23:58
@brawner brawner requested a review from azeey February 3, 2021 23:59
azeey and others added 6 commits February 9, 2021 11:53
Signed-off-by: Stephen Brawner <[email protected]>
Signed-off-by: Stephen Brawner <[email protected]>
Signed-off-by: Stephen Brawner <[email protected]>
@brawner brawner force-pushed the brawner/composition_sdf_18 branch from cbd49c6 to f9b456e Compare February 9, 2021 19:54
@brawner
Copy link
Contributor Author

brawner commented Feb 9, 2021

Rebased onto main, and resolved a nullptr issue which was showing up in the breadcrumbs test.

There appears to be a memory error with the user_commands integration test, which seems to be unrelated to this PR, but nonetheless I'll try to resolve it first.

Signed-off-by: Stephen Brawner <[email protected]>
@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #542 (bca2fe1) into main (4e692db) will decrease coverage by 0.00%.
The diff coverage is 54.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #542      +/-   ##
==========================================
- Coverage   64.88%   64.87%   -0.01%     
==========================================
  Files         235      235              
  Lines       16889    16941      +52     
==========================================
+ Hits        10958    10991      +33     
- Misses       5931     5950      +19     
Impacted Files Coverage Δ
.../plugins/component_inspector/ComponentInspector.cc 7.20% <0.00%> (-0.02%) ⬇️
.../plugins/component_inspector/ComponentInspector.hh 28.57% <ø> (ø)
src/systems/user_commands/UserCommands.cc 69.13% <0.00%> (-0.69%) ⬇️
src/rendering/RenderUtil.cc 42.64% <50.00%> (+0.04%) ⬆️
src/SdfEntityCreator.cc 88.23% <60.78%> (-5.08%) ⬇️
src/systems/physics/Physics.cc 68.81% <0.00%> (+0.71%) ⬆️
src/ServerConfig.cc 89.68% <0.00%> (+0.79%) ⬆️

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 f1bc04b...bca2fe1. Read the comment docs.

@brawner
Copy link
Contributor Author

brawner commented Feb 12, 2021

Added integration test which fails without the nested model dartsim PR (gazebosim/gz-physics#189).

@scpeters
Copy link
Member

I haven't looked at the code yet, just run some tests locally. The INTEGRATION_physics_system has two failing cases for me

[  FAILED  ] PhysicsSystemFixture.IncludeNestedModelDartsim
[  FAILED  ] PhysicsSystemFixture.IncludeNestedModelTPE

Signed-off-by: Stephen Brawner <[email protected]>
@brawner
Copy link
Contributor Author

brawner commented Feb 12, 2021

Failures in tests are expected until dependent ign-physics is merged and released

@scpeters
Copy link
Member

I think the windows build is failing due to setenv calls

@azeey
Copy link
Contributor

azeey commented Feb 24, 2021

The transform control is not working for me. I also found out that it doesn't work for nested models in Dome with TPE neither since gazebosim/gz-physics#142. I will go ahead remove the changes related to that and fix it in a follow up PR.

@azeey azeey force-pushed the brawner/composition_sdf_18 branch from e1dfbc4 to cf6f4f3 Compare February 24, 2021 23:36
@azeey
Copy link
Contributor

azeey commented Feb 24, 2021

The transform control is not working for me. I also found out that it doesn't work for nested models in Dome with TPE neither since ignitionrobotics/ign-physics#142. I will go ahead remove the changes related to that and fix it in a follow up PR.

Removed in 023d4bb. Also created issue #649.

@azeey
Copy link
Contributor

azeey commented Feb 24, 2021

I think the windows build is failing due to setenv calls

Fixed in cf6f4f3

@brawner
Copy link
Contributor Author

brawner commented Feb 24, 2021

I'm going to unsubscribe from this PR. Thanks for taking over @azeey. Feel free to ping me if you have any questions.

@azeey
Copy link
Contributor

azeey commented Mar 10, 2021

I believe test failures on macOS are unrelated to this PR. Merging!

@azeey azeey merged commit fb4080e into main Mar 10, 2021
@azeey azeey deleted the brawner/composition_sdf_18 branch March 10, 2021 18:47
nkoenig pushed a commit that referenced this pull request Nov 8, 2021
[Dome] Support <actor><pose> and <actor><plugin>

Approved-by: Luca Della Vedova
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.

3 participants