From b4e2e64a9eb93509be595089e0f45342e31349a7 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Thu, 21 Jan 2016 21:28:56 -0500 Subject: [PATCH 1/7] Show master build status of AppVeyor badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41d425ac326d4..8d1709ba4c1f0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ [![Build Status](https://travis-ci.org/dartsim/dart.png?branch=master)](https://travis-ci.org/dartsim/dart) -[![Build status](https://ci.appveyor.com/api/projects/status/6rta8olo95bpu84r?svg=true)](https://ci.appveyor.com/project/jslee02/dart) +[![Build status](https://ci.appveyor.com/api/projects/status/6rta8olo95bpu84r/branch/master?svg=true)](https://ci.appveyor.com/project/jslee02/dart/branch/master) [![Documentation Status](https://readthedocs.org/projects/dart/badge/?version=latest)](https://readthedocs.org/projects/dart/?badge=latest) From 4ae6e8ed363c04afcef04514fa3b6aa8ea6130d0 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 27 Jan 2016 01:29:35 -0500 Subject: [PATCH 2/7] 5.1 --> master --- CMakeLists.txt | 12 +++-- appveyor.yml | 8 +-- ci/appveyor_install.ps1 | 4 +- unittests/testJoints.cpp | 112 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd8b9cbc49a7..f4b0b76695264 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,11 @@ #=============================================================================== # CMake settings #=============================================================================== -cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) +if(MSVC) + cmake_minimum_required(VERSION 3.1.3) +else() + cmake_minimum_required(VERSION 2.8.6) +endif() # Use MACOSX_RPATH by default on OS X. This was added in CMake 2.8.12 and # became default in CMake 3.0. Explicitly setting this policy is necessary to @@ -218,7 +222,7 @@ endif() # Boost set(DART_MIN_BOOST_VERSION 1.46.0 CACHE INTERNAL "Boost min version requirement" FORCE) -if(MSVC OR MSVC90 OR MSVC10) +if(MSVC) add_definitions(-DBOOST_ALL_NO_LIB) endif() add_definitions(-DBOOST_TEST_DYN_LINK) @@ -471,8 +475,8 @@ endif() #=============================================================================== if(MSVC) # Visual Studio enables c++11 support by default - if(NOT MSVC12 AND NOT MSVC14) - message(FATAL_ERROR "${PROJECT_NAME} requires VS 2013 or greater.") + if(MSVC_VERSION VERSION_LESS 1900) + message(FATAL_ERROR "${PROJECT_NAME} requires VS 2015 or greater.") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP4") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO") diff --git a/appveyor.yml b/appveyor.yml index 38f6ebdbe3460..e33e34b9a07af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,8 +12,8 @@ platform: # specify custom environment variables environment: MSVC_DEFAULT_OPTIONS: ON - BOOST_ROOT: C:\Libraries\boost - BOOST_LIBRARYDIR: C:\Libraries\boost\lib32-msvc-12.0 + BOOST_ROOT: C:\Libraries\boost_1_59_0 + BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib32-msvc-14.0 BUILD_EXAMPLES: OFF # don't build examples to not exceed allowed build time (40 min) BUILD_TUTORIALS: OFF # don't build tutorials to not exceed allowed build time (40 min) matrix: @@ -53,8 +53,8 @@ before_build: - cmd: md build - cmd: cd build # We generate project files for Visual Studio 12 because the boost binaries installed on the test server are for Visual Studio 12. - - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 12 - - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 12 Win64 + - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 + - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64 - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DDART_BUILD_EXAMPLES="%BUILD_EXAMPLES%" -DDART_BUILD_TUTORIALS="%BUILD_TUTORIALS%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" -DDART_MSVC_DEFAULT_OPTIONS="%MSVC_DEFAULT_OPTIONS%" .. build: diff --git a/ci/appveyor_install.ps1 b/ci/appveyor_install.ps1 index 03a1dc8f491bc..3a10c7517cd79 100755 --- a/ci/appveyor_install.ps1 +++ b/ci/appveyor_install.ps1 @@ -9,8 +9,8 @@ function InstallPrerequisites($work_dir, $install_dir) $old_dir = $pwd cd $work_dir - $msi = "dart-prerequisites.msi" - $uri = "https://github.com/dartsim/dart-prerequisites-windows/raw/3e34167fd29fcc870ebed50bf318f3f31f491e6a/DART%205.0-prerequisites-msvc12-md-32bit.msi" + $msi = "dart-dependencies.msi" + $uri = "https://github.com/dartsim/dart-prerequisites-windows-installers/raw/master/02/DART-dependencies-msvc14-md-32bit.msi" Invoke-WebRequest $uri -OutFile $msi $install_command = "msiexec.exe" diff --git a/unittests/testJoints.cpp b/unittests/testJoints.cpp index 33f393eb73113..62056e3ce9e34 100644 --- a/unittests/testJoints.cpp +++ b/unittests/testJoints.cpp @@ -809,6 +809,118 @@ TEST_F(JOINTS, SERVO_MOTOR) testServoMotor(); } +//============================================================================== +TEST_F(JOINTS, JOINT_COULOMB_FRICTION_AND_POSITION_LIMIT) +{ + const double timeStep = 1e-3; + const double tol = 1e-2; + + simulation::WorldPtr myWorld + = utils::SkelParser::readWorld( + DART_DATA_PATH"/skel/test/joint_friction_test.skel"); + EXPECT_TRUE(myWorld != nullptr); + + myWorld->setGravity(Eigen::Vector3d(0.0, 0.0, 0.0)); + myWorld->setTimeStep(timeStep); + + dynamics::SkeletonPtr pendulum = myWorld->getSkeleton("double_pendulum"); + EXPECT_TRUE(pendulum != nullptr); + pendulum->disableSelfCollision(); + + dynamics::Joint* joint0 = pendulum->getJoint("joint0"); + dynamics::Joint* joint1 = pendulum->getJoint("joint1"); + + EXPECT_TRUE(joint0 != nullptr); + EXPECT_TRUE(joint1 != nullptr); + + double frictionForce = 5.0; + + joint0->setPositionLimitEnforced(true); + joint1->setPositionLimitEnforced(true); + + const double ll = -DART_PI/12.0; // -15 degree + const double ul = +DART_PI/12.0; // +15 degree + + size_t dof0 = joint0->getNumDofs(); + for (size_t i = 0; i < dof0; ++i) + { + joint0->setPosition(i, 0.0); + joint0->setPosition(i, 0.0); + joint0->setPositionLowerLimit(i, ll); + joint0->setPositionUpperLimit(i, ul); + } + + size_t dof1 = joint1->getNumDofs(); + for (size_t i = 0; i < dof1; ++i) + { + joint1->setPosition(i, 0.0); + joint1->setPosition(i, 0.0); + joint1->setPositionLowerLimit(i, ll); + joint1->setPositionUpperLimit(i, ul); + } + + joint0->setCoulombFriction(0, frictionForce); + joint1->setCoulombFriction(0, frictionForce); + + EXPECT_EQ(joint0->getCoulombFriction(0), frictionForce); + EXPECT_EQ(joint1->getCoulombFriction(0), frictionForce); + +#ifndef NDEBUG // Debug mode + double simTime = 0.2; +#else + double simTime = 2.0; +#endif // ------- Debug mode + int nSteps = simTime / timeStep; + + // First two seconds rotating in positive direction with higher control forces + // than the friction forces + for (int i = 0; i < nSteps; i++) + { + joint0->setForce(0, 100.0); + joint1->setForce(0, 100.0); + myWorld->step(); + + double jointPos0 = joint0->getPosition(0); + double jointPos1 = joint1->getPosition(0); + + double jointVel0 = joint0->getVelocity(0); + double jointVel1 = joint1->getVelocity(0); + + EXPECT_GE(std::abs(jointVel0), 0.0); + EXPECT_GE(std::abs(jointVel1), 0.0); + + EXPECT_GE(jointPos0, ll - tol); + EXPECT_LE(jointPos0, ul + tol); + + EXPECT_GE(jointPos1, ll - tol); + EXPECT_LE(jointPos1, ul + tol); + } + + // Another two seconds rotating in negative direction with higher control + // forces than the friction forces + for (int i = 0; i < nSteps; i++) + { + joint0->setForce(0, -100.0); + joint1->setForce(0, -100.0); + myWorld->step(); + + double jointPos0 = joint0->getPosition(0); + double jointPos1 = joint1->getPosition(0); + + double jointVel0 = joint0->getVelocity(0); + double jointVel1 = joint1->getVelocity(0); + + EXPECT_GE(std::abs(jointVel0), 0.0); + EXPECT_GE(std::abs(jointVel1), 0.0); + + EXPECT_GE(jointPos0, ll - tol); + EXPECT_LE(jointPos0, ul + tol); + + EXPECT_GE(jointPos1, ll - tol); + EXPECT_LE(jointPos1, ul + tol); + } +} + //============================================================================== template Eigen::Matrix random_vec(double limit=100) From 480422923fd9eb6e7b81c1a091ae745c52d78d63 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Jan 2016 20:17:22 -0500 Subject: [PATCH 3/7] Change note for developers to doxygen comment --- dart/common/Addon.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dart/common/Addon.h b/dart/common/Addon.h index 4a94053e8427a..cf5b8f4750d66 100644 --- a/dart/common/Addon.h +++ b/dart/common/Addon.h @@ -128,9 +128,9 @@ class Addon /// Constructor /// - // We require the AddonManager argument in this constructor to make it clear - // to extensions that they must have an AddonManager argument in their - // constructors. + /// We require the AddonManager argument in this constructor to make it clear + /// to extensions that they must have an AddonManager argument in their + /// constructors. Addon(AddonManager* manager); /// This function will be triggered (1) after the Addon has been created From b3294838e57ccb0f6f5fe6adeaa1a48c721b45eb Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Jan 2016 20:23:13 -0500 Subject: [PATCH 4/7] Remove _isSpecializedFor() from AddonManager --- dart/common/AddonManager.h | 8 +++----- dart/common/detail/AddonManager.h | 7 ------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/dart/common/AddonManager.h b/dart/common/AddonManager.h index 89f4384f660e4..9ebe37b80ed92 100644 --- a/dart/common/AddonManager.h +++ b/dart/common/AddonManager.h @@ -128,7 +128,9 @@ class AddonManager template std::unique_ptr release(); - /// Check if this Manager is specialized for a specific type of Addon + /// Check if this Manager is specialized for a specific type of Addon. + /// + /// By default, this simply returns false. template static constexpr bool isSpecializedFor(); @@ -171,10 +173,6 @@ class AddonManager /// AddonManager types to call the protected Addon::setManager function. void becomeManager(Addon* addon, bool transfer); - /// Always returns false - template - static constexpr bool _isSpecializedFor(type); - /// A map that relates the type of Addon to its pointer AddonMap mAddonMap; }; diff --git a/dart/common/detail/AddonManager.h b/dart/common/detail/AddonManager.h index 1328cf67b601e..4e185babbf79a 100644 --- a/dart/common/detail/AddonManager.h +++ b/dart/common/detail/AddonManager.h @@ -135,13 +135,6 @@ std::unique_ptr AddonManager::release() //============================================================================== template constexpr bool AddonManager::isSpecializedFor() -{ - return _isSpecializedFor(type()); -} - -//============================================================================== -template -constexpr bool AddonManager::_isSpecializedFor(type) { return false; } From b97d7f539c2793e2c33aed05fa64e83925cfbd0d Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Jan 2016 20:26:10 -0500 Subject: [PATCH 5/7] Do nothing when attempting to duplicate addons into itself --- dart/common/AddonManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dart/common/AddonManager.cpp b/dart/common/AddonManager.cpp index 394c23924211b..d7320f6203def 100644 --- a/dart/common/AddonManager.cpp +++ b/dart/common/AddonManager.cpp @@ -198,6 +198,9 @@ void AddonManager::duplicateAddons(const AddonManager* otherManager) return; } + if(this == otherManager) + return; + const AddonMap& otherMap = otherManager->mAddonMap; AddonMap::iterator receiving = mAddonMap.begin(); From 668d3343c2f694f5253b2c89d8ffad7a1a4b0694 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Jan 2016 20:32:35 -0500 Subject: [PATCH 6/7] Add missing constructor definition, and add move constructor to Joint::ExtendedProperties --- dart/dynamics/Joint.cpp | 20 ++++++++++++++++++++ dart/dynamics/Joint.h | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/dart/dynamics/Joint.cpp b/dart/dynamics/Joint.cpp index a5fd58b0cd99a..cd4c7b4a22608 100644 --- a/dart/dynamics/Joint.cpp +++ b/dart/dynamics/Joint.cpp @@ -67,6 +67,26 @@ Joint::Properties::Properties(const std::string& _name, // Do nothing } +//============================================================================== +Joint::ExtendedProperties::ExtendedProperties( + const Properties& standardProperties, + const AddonProperties& addonProperties) + : Properties(standardProperties), + mAddonProperties(addonProperties) +{ + // Do nothing +} + +//============================================================================== +Joint::ExtendedProperties::ExtendedProperties( + Properties&& standardProperties, + AddonProperties&& addonProperties) + : Properties(std::move(standardProperties)), + mAddonProperties(std::move(addonProperties)) +{ + // Do nothing +} + //============================================================================== Joint::~Joint() { diff --git a/dart/dynamics/Joint.h b/dart/dynamics/Joint.h index 5f8b63bb77781..69e41e1ed1b62 100644 --- a/dart/dynamics/Joint.h +++ b/dart/dynamics/Joint.h @@ -162,10 +162,17 @@ class Joint : public virtual common::Subject, struct ExtendedProperties : Properties { + /// Composed constructor ExtendedProperties( const Properties& standardProperties = Properties(), const AddonProperties& addonProperties = AddonProperties()); + /// Composed move constructor + ExtendedProperties( + Properties&& standardProperties, + AddonProperties&& addonProperties); + + /// Properties of all the Addons attached to this Joint AddonProperties mAddonProperties; }; From 585cf4c94b703a475ce97acaee2e17f358a37589 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Jan 2016 21:53:41 -0500 Subject: [PATCH 7/7] Add typename keyword to specify it's type name --- dart/dynamics/MultiDofJoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dart/dynamics/MultiDofJoint.h b/dart/dynamics/MultiDofJoint.h index 3f0e429f6509e..20a001a964697 100644 --- a/dart/dynamics/MultiDofJoint.h +++ b/dart/dynamics/MultiDofJoint.h @@ -71,7 +71,7 @@ class MultiDofJoint : using Properties = detail::MultiDofJointProperties; using Addon = detail::MultiDofJointAddon; - DART_BAKE_SPECIALIZED_ADDON_IRREGULAR( MultiDofJoint::Addon, MultiDofJointAddon ) + DART_BAKE_SPECIALIZED_ADDON_IRREGULAR( typename MultiDofJoint::Addon, MultiDofJointAddon ) MultiDofJoint(const MultiDofJoint&) = delete;