Skip to content

Commit

Permalink
Support DART >= 6.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Jan 17, 2019
1 parent 9ae008f commit 7acb48f
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ include(FindPkgConfig)

find_package(Boost REQUIRED COMPONENTS filesystem)

find_package(DART 6.7.0 REQUIRED
find_package(DART 6.6.2 REQUIRED
COMPONENTS optimizer-nlopt utils
OPTIONAL_COMPONENTS utils-urdf # for 'perception' target
CONFIG
Expand Down
4 changes: 4 additions & 0 deletions src/planner/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ std::unique_ptr<World> World::clone(const std::string& newName) const
worldClone->mSkeletons.reserve(mSkeletons.size());
for (std::size_t i = 0; i < mSkeletons.size(); ++i)
{
#if DART_VERSION_AT_LEAST(6,7,0)
const auto clonedSkeleton = mSkeletons[i]->cloneSkeleton();
#elif
const auto clonedSkeleton = mSkeletons[i]->clone();
#endif
clonedSkeleton->setConfiguration(mSkeletons[i]->getConfiguration());
worldClone->addSkeleton(std::move(clonedSkeleton));
}
Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/dart/test_MetaSkeletonStateSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ TEST(MetaSkeletonStateSpace, RevoluteJoint_CompatibleSkeletons)
withBoundSpace.checkCompatibility(withoutBound.get()),
std::invalid_argument);

#if DART_VERSION_AT_LEAST(6,7,0)
auto withoutBoundClone = withoutBound->cloneSkeleton();
#else
auto withoutBoundClone = withoutBound->clone();
#endif
EXPECT_TRUE(withoutBoundSpace.isCompatible(withoutBoundClone.get()));
EXPECT_NO_THROW(
withoutBoundSpace.checkCompatibility(withoutBoundClone.get()));
Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/test_CartesianProduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ TEST(CartesianProduct, Clone)
for (auto i = 0u; i < 5u; ++i)
{
auto s1 = space.createState();
#if DART_VERSION_AT_LEAST(6,7,0)
const auto angle = dart::math::Random::uniform(-M_PI, M_PI);
#else
const auto angle = dart::math::random(-M_PI, M_PI);
#endif
s1.getSubStateHandle<SO2>(0).fromAngle(angle);
s1.getSubStateHandle<R2>(1).setValue(Eigen::Vector2d::Random());

Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/test_SE2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ TEST(SE2, Clone)

for (auto i = 0u; i < 5u; ++i)
{
#if DART_VERSION_AT_LEAST(6,7,0)
const auto angle = dart::math::Random::uniform(-M_PI, M_PI);
#else
const auto angle = dart::math::random(-M_PI, M_PI);
#endif
Eigen::Isometry2d pose = Eigen::Isometry2d::Identity();
pose.rotate(Eigen::Rotation2Dd(angle));
pose.translation() = Eigen::Vector2d::Random();
Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/test_SE3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ TEST(SE3, Clone)
for (auto i = 0u; i < 5u; ++i)
{
Eigen::Isometry3d pose = Eigen::Isometry3d::Identity();
#if DART_VERSION_AT_LEAST(6,7,0)
const auto angle = dart::math::Random::uniform(-M_PI, M_PI);
#else
const auto angle = dart::math::random(-M_PI, M_PI);
#endif
const auto axis = Eigen::Vector3d::Random().normalized();
const auto angleAxis = Eigen::AngleAxisd(angle, axis);
pose.linear() = angleAxis.toRotationMatrix();
Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/test_SO2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ TEST(SO2, Clone)

for (auto i = 0u; i < 5u; ++i)
{
#if DART_VERSION_AT_LEAST(6,7,0)
const auto angle = dart::math::Random::uniform(-M_PI, M_PI);
#else
const auto angle = dart::math::random(-M_PI, M_PI);
#endif

auto s1 = so2.createState();
s1.fromAngle(angle);
Expand Down
4 changes: 4 additions & 0 deletions tests/statespace/test_SO3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ TEST(SO3, Clone)

for (auto i = 0u; i < 5u; ++i)
{
#if DART_VERSION_AT_LEAST(6,7,0)
const auto angle = dart::math::Random::uniform(-M_PI, M_PI);
#else
const auto angle = dart::math::random(-M_PI, M_PI);
#endif
const auto axis = Eigen::Vector3d::Random().normalized();
const auto angleAxis = Eigen::AngleAxisd(angle, axis);
const Eigen::Quaterniond quat(angleAxis);
Expand Down

0 comments on commit 7acb48f

Please sign in to comment.