Skip to content

Commit

Permalink
merge from ign-physics5
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@openrobotics.org>
  • Loading branch information
iche033 committed Jun 15, 2024
2 parents eb30b86 + 33bbf42 commit 928a504
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# More info:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

* @azeey @mxgrey @scpeters
* @azeey @scpeters
1 change: 1 addition & 0 deletions dartsim/src/SDFFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ Identity SDFFeatures::ConstructSdfLink(

bodyProperties.mInertia.setLocalCOM(localCom);

bodyProperties.mGravityMode = _sdfLink.EnableGravity();

dart::dynamics::FreeJoint::Properties jointProperties;
jointProperties.mName = bodyProperties.mName + "_FreeJoint";
Expand Down
16 changes: 16 additions & 0 deletions test/common_test/world_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ TEST_F(WorldFeaturesTestGravity, GravityFeatures)
auto link = model->GetLink(0);
ASSERT_NE(nullptr, link);

auto modelNoGravity = world->GetModel("sphere_no_gravity");
ASSERT_NE(nullptr, modelNoGravity);

auto linkNoGravity = modelNoGravity->GetLink(0);
ASSERT_NE(nullptr, linkNoGravity);

AssertVectorApprox vectorPredicate6(1e-6);

// initial link pose
Expand Down Expand Up @@ -175,6 +181,16 @@ TEST_F(WorldFeaturesTestGravity, GravityFeatures)
EXPECT_PRED_FORMAT2(vectorPredicate2,
Eigen::Vector3d(0.5, 0, 2.5),
pos);

if (this->PhysicsEngineName(name) == "dartsim")
{
// pose for link without gravity should not change
Eigen::Vector3d posNoGravity = linkNoGravity->FrameDataRelativeToWorld()
.pose.translation();
EXPECT_PRED_FORMAT2(vectorPredicate2,
Eigen::Vector3d(10, 10, 10),
posNoGravity);
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/common_test/worlds/falling.world
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,17 @@
</visual>
</link>
</model>
<model name='sphere_no_gravity'>
<link name='link'>
<gravity>false</gravity>
<pose>10 10 10 0 0 0</pose>
<visual name='visual'>
<geometry><sphere><radius>1</radius></sphere></geometry>
</visual>
<collision name='collision'>
<geometry><sphere><radius>1</radius></sphere></geometry>
</collision>
</link>
</model>
</world>
</sdf>

0 comments on commit 928a504

Please sign in to comment.