Skip to content

Commit b6beef1

Browse files
iche033srmainwaring
authored andcommitted
BallJoint: add test
Signed-off-by: Ian Chen <ichen@openrobotics.org>
1 parent fa15dff commit b6beef1

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

dartsim/src/SDFFeatures_TEST.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <type_traits>
1919

20+
#include <dart/dynamics/BallJoint.hpp>
2021
#include <dart/dynamics/BodyNode.hpp>
2122
#include <dart/dynamics/DegreeOfFreedom.hpp>
2223
#include <dart/dynamics/FreeJoint.hpp>
@@ -321,7 +322,7 @@ TEST_P(SDFFeatures_TEST, CheckDartsimData)
321322
dart::simulation::WorldPtr dartWorld = world->GetDartsimWorld();
322323
ASSERT_NE(nullptr, dartWorld);
323324

324-
ASSERT_EQ(7u, dartWorld->getNumSkeletons());
325+
ASSERT_EQ(8u, dartWorld->getNumSkeletons());
325326

326327
const dart::dynamics::SkeletonPtr skeleton = dartWorld->getSkeleton(1);
327328
ASSERT_NE(nullptr, skeleton);
@@ -417,6 +418,14 @@ TEST_P(SDFFeatures_TEST, CheckDartsimData)
417418
screwJointTest->getJoint(1));
418419
ASSERT_NE(nullptr, screwJoint);
419420
EXPECT_DOUBLE_EQ(-GZ_PI, screwJoint->getPitch());
421+
422+
const dart::dynamics::SkeletonPtr ballJointTest =
423+
dartWorld->getSkeleton("ball_joint_test");
424+
ASSERT_NE(nullptr, ballJointTest);
425+
ASSERT_EQ(2u, ballJointTest->getNumBodyNodes());
426+
const auto *ballJoint = dynamic_cast<const dart::dynamics::BallJoint*>(
427+
ballJointTest->getJoint(1));
428+
ASSERT_NE(nullptr, ballJoint);
420429
}
421430

422431
/////////////////////////////////////////////////

test/common_test/worlds/test.world

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@
358358
<thread_pitch>2</thread_pitch>
359359
</joint>
360360
</model>
361+
<model name="ball_joint_test">
362+
<link name="link0"/>
363+
<link name="link1"/>
364+
<joint name="j0" type="ball">
365+
<parent>link0</parent>
366+
<child>link1</child>
367+
<axis>
368+
<damping>0.1</damping>
369+
</axis>
370+
</joint>
371+
</model>
361372
<!-- Remove joint types as they get supported -->
362373
<model name="unsupported_joint_test">
363374
<link name="link0"/>

tpe/plugin/src/SDFFeatures_TEST.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ TEST(SDFFeatures_TEST, CheckTpeData)
9595
auto tpeWorld = world.GetTpeLibWorld();
9696
ASSERT_NE(nullptr, tpeWorld);
9797

98-
ASSERT_EQ(7u, tpeWorld->GetChildCount());
98+
ASSERT_EQ(8u, tpeWorld->GetChildCount());
9999

100100
// check model 01
101101
{

0 commit comments

Comments
 (0)