Skip to content

Commit 068ab7b

Browse files
committed
Merge pull request #578 from dartsim/fix_joint_constraints_4.3
Fix incorrect applying of joint constraint impulses -- Patch for 4.3
2 parents 2955a44 + 5249d84 commit 068ab7b

14 files changed

+273
-104
lines changed

.travis.yml

+25-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
language: cpp
2+
os:
3+
- linux
4+
- osx
5+
sudo: required
6+
dist: trusty
27
compiler:
38
- gcc
49
- clang
5-
before_install:
6-
- 'ci/before_install.sh'
710
env:
8-
global:
9-
matrix:
10-
- BUILD_CORE_ONLY=OFF BUILD_TYPE=Debug
11-
- BUILD_CORE_ONLY=OFF BUILD_TYPE=Release
12-
- BUILD_CORE_ONLY=ON BUILD_TYPE=Debug
13-
- BUILD_CORE_ONLY=ON BUILD_TYPE=Release
14-
before_script: cmake -DBUILD_CORE_ONLY=$BUILD_CORE_ONLY -DCMAKE_BUILD_TYPE=$BUILD_TYPE .
11+
- BUILD_CORE_ONLY=OFF BUILD_TYPE=Debug
12+
- BUILD_CORE_ONLY=OFF BUILD_TYPE=Release
13+
- BUILD_CORE_ONLY=ON BUILD_TYPE=Debug
14+
- BUILD_CORE_ONLY=ON BUILD_TYPE=Release
15+
matrix:
16+
exclude:
17+
- os: osx
18+
compiler: gcc
19+
before_install:
20+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then 'ci/before_install_linux.sh' ; fi
21+
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then 'ci/before_install_osx.sh' ; fi
22+
install:
23+
- mkdir build
24+
- cd build
25+
- cmake -DBUILD_CORE_ONLY=$BUILD_CORE_ONLY -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
1526
script:
16-
- make
17-
- sudo ldconfig --verbose # So the test executeables can detect libtinyxml2
18-
- if [ $BUILD_CORE_ONLY = OFF ]; then make test; fi
19-
# - cd tools/
20-
# - ./code_check.sh
21-
# - ./abi_check.sh 4.1.0 # Check with DART 4.1.0
27+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then '../ci/script_linux.sh' ; fi
28+
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then '../ci/script_osx.sh' ; fi
2229
after_failure:
23-
- cat Testing/Temporary/LastTest.log
24-
- cat Testing/Temporary/LastTestsFailed.log
30+
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then '../ci/after_failure_linux.sh' ; fi
31+
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then '../ci/after_failure_osx.sh' ; fi
32+

CMakeLists.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ option(BUILD_CORE_ONLY "Build only the core of DART" OFF)
4545
if(MSVC)
4646
set(DART_RUNTIME_LIBRARY "/MT" CACHE STRING "BaseName chosen by the user at CMake configure time")
4747
set_property(CACHE DART_RUNTIME_LIBRARY PROPERTY STRINGS /MD /MT)
48+
option(DART_MSVC_DEFAULT_OPTIONS "Build DART with default Visual Studio options" OFF)
4849
else()
4950
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
5051
endif()
@@ -341,14 +342,16 @@ endif()
341342
# Compiler flags
342343
#===============================================================================
343344
if(MSVC)
344-
message(STATUS "Setup Visual Studio Specific Flags")
345345
# Visual Studio enables c++11 support by default
346346
if(NOT MSVC12)
347347
message(FATAL_ERROR "${PROJECT_NAME} requires VS 2013 or greater.")
348348
endif()
349-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DART_RUNTIME_LIBRARY}d /Zi /Gy /W1 /EHsc")
350-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${DART_RUNTIME_LIBRARY} /Zi /GL /Gy /W1 /EHsc /arch:SSE2")
351-
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG")
349+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP4")
350+
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO")
351+
if(NOT DART_MSVC_DEFAULT_OPTIONS)
352+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DART_RUNTIME_LIBRARY}d /Zi /Gy /W1 /EHsc")
353+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${DART_RUNTIME_LIBRARY} /Zi /GL /Gy /W1 /EHsc /arch:SSE2")
354+
endif(NOT DART_MSVC_DEFAULT_OPTIONS)
352355
elseif(CMAKE_COMPILER_IS_GNUCXX)
353356
set(CMAKE_CXX_FLAGS "-Wall -msse2 -fPIC")
354357
execute_process(

appveyor.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
version: "{build}"
33

44
# Operating system (build VM template)
5-
# os: Windows Server 2012 R2
5+
os: Visual Studio 2015
66

77
# build platform, i.e. Win32 (instead of x86), x64, Any CPU. This setting is optional.
88
platform:
99
- Win32
10-
- x64
10+
#- x64 Disable build for x64 machine until x64 version of dart-prerequisites is ready
1111

1212
# specify custom environment variables
1313
environment:
14-
BOOST_ROOT: c:\Libraries\boost
15-
BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib
14+
MSVC_DEFAULT_OPTIONS: ON
15+
BOOST_ROOT: C:\Libraries\boost
16+
BOOST_LIBRARYDIR: C:\Libraries\boost\lib32-msvc-12.0
17+
BUILD_EXAMPLES: OFF # don't build examples to not exceed allowed build time (40 min)
1618
matrix:
1719
- BUILD_CORE_ONLY: ON
18-
# Diabled since we don't have binaries of DART prerequisites build on Visual Studio 2013 (/MT) yet (See #270)
19-
# - BUILD_CORE_ONLY: OFF
20+
- BUILD_CORE_ONLY: OFF
2021

21-
# build Configuration, i.e. Debug, Release, etc.
22+
# build configuration, i.e. Debug, Release, etc.
2223
configuration:
2324
- Debug
2425
- Release
@@ -42,10 +43,8 @@ branches:
4243

4344
# scripts that run after cloning repository
4445
install:
45-
- cmd: cd C:\projects
46-
- ps: Start-FileDownload 'http://www.prism.gatech.edu/~tkunz3/DART-Prerequisites.msi'
47-
- cmd: C:\projects\DART-Prerequisites.msi
48-
# - cmd: choco install doxygen.install
46+
- ps: cd C:\projects\dart\ci
47+
- ps: .\appveyor_install.ps1
4948

5049
# scripts to run before build
5150
before_build:
@@ -55,11 +54,12 @@ before_build:
5554
# We generate project files for Visual Studio 12 because the boost binaries installed on the test server are for Visual Studio 12.
5655
- cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 12
5756
- cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 12 Win64
58-
- cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" ..
57+
- cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DDART_BUILD_EXAMPLES="%BUILD_EXAMPLES%" -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%" ..
5958

6059
build:
61-
project: C:\projects\dart\build\dart.sln
62-
60+
project: C:\projects\dart\build\dart.sln # path to Visual Studio solution or project
61+
parallel: true # enable MSBuild parallel builds
62+
verbosity: quiet # MSBuild verbosity level (quiet|minimal|normal|detailed)
63+
6364
test_script:
64-
- cmd: ctest -C Release -VV
65-
- cmd: ctest -C Debug -VV
65+
- cmd: ctest --build-config %configuration% --parallel 4 --output-on-failure

ci/after_failure_linux.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cat Testing/Temporary/LastTest.log
2+
cat Testing/Temporary/LastTestsFailed.log

ci/after_failure_osx.sh

Whitespace-only changes.

ci/appveyor_install.ps1

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function ExecuteCommand($command, $command_args)
2+
{
3+
Write-Host $command $command_args
4+
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
5+
}
6+
7+
function InstallPrerequisites($work_dir, $install_dir)
8+
{
9+
$old_dir = $pwd
10+
cd $work_dir
11+
12+
$msi = "dart-prerequisites.msi"
13+
$uri = "https://github.com/dartsim/dart-prerequisites-windows/raw/3e34167fd29fcc870ebed50bf318f3f31f491e6a/DART%205.0-prerequisites-msvc12-md-32bit.msi"
14+
Invoke-WebRequest $uri -OutFile $msi
15+
16+
$install_command = "msiexec.exe"
17+
$install_args = "/qn /log log.txt /i $msi TARGETDIR=$install_dir"
18+
ExecuteCommand $install_command $install_args
19+
20+
cd $old_dir
21+
}
22+
23+
function main()
24+
{
25+
try
26+
{
27+
InstallPrerequisites "C:/projects" "C:/Golems"
28+
}
29+
catch
30+
{
31+
throw
32+
}
33+
}
34+
35+
main

ci/before_install.sh

-65
This file was deleted.

ci/before_install_linux.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
sudo apt-add-repository --yes ppa:libccd-debs/ppa
2+
sudo apt-add-repository --yes ppa:fcl-debs/ppa
3+
sudo apt-add-repository --yes ppa:dartsim/ppa
4+
sudo apt-get -qq update
5+
6+
APT_CORE='
7+
cmake
8+
libassimp-dev
9+
libboost-all-dev
10+
libccd-dev
11+
libeigen3-dev
12+
libfcl-dev
13+
'
14+
15+
APT=$APT_CORE'
16+
freeglut3-dev
17+
libxi-dev
18+
libxmu-dev
19+
libflann-dev
20+
libnlopt-dev
21+
coinor-libipopt-dev
22+
libtinyxml-dev
23+
libtinyxml2-dev
24+
liburdfdom-dev
25+
liburdfdom-headers-dev
26+
'
27+
28+
if [ $BUILD_CORE_ONLY = OFF ]; then
29+
sudo apt-get -qq --yes --force-yes install $APT
30+
else
31+
sudo apt-get -qq --yes --force-yes install $APT_CORE
32+
fi
33+

ci/before_install_osx.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
brew tap dartsim/dart
2+
brew tap homebrew/science
3+
4+
brew update > /dev/null
5+
6+
PACKAGES='
7+
git
8+
cmake
9+
assimp
10+
fcl
11+
bullet
12+
flann
13+
boost
14+
eigen
15+
tinyxml
16+
tinyxml2
17+
libccd
18+
nlopt
19+
ipopt
20+
ros/deps/urdfdom
21+
ros/deps/urdfdom_headers
22+
ros/deps/console_bridge
23+
ros/deps/gtest
24+
'
25+
26+
brew install $PACKAGES | grep -v '%$'

ci/script_linux.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
make
2+
sudo ldconfig --verbose # So the test executeables can detect libtinyxml2
3+
if [ $BUILD_CORE_ONLY = OFF ]; then make test; fi
4+
# cd tools/
5+
# ./code_check.sh
6+
# ./abi_check.sh 4.1.0 # Check with DART 4.1.0

ci/script_osx.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
make
2+
if [ $BUILD_CORE_ONLY = OFF ]; then make test; fi
3+
# cd tools/
4+
# ./code_check.sh
5+
# ./abi_check.sh 4.1.0 # Check with DART 4.1.0

dart/constraint/JointCoulombFrictionConstraint.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ void JointCoulombFrictionConstraint::applyUnitImpulse(size_t _index)
200200
mJoint->setConstraintImpulse(i, 1.0);
201201
skeleton->updateBiasImpulse(mBodyNode);
202202
skeleton->updateVelocityChange();
203+
mJoint->setConstraintImpulse(i, 0.0);
203204
}
204205

205206
++localIndex;
@@ -262,7 +263,8 @@ void JointCoulombFrictionConstraint::applyImpulse(double* _lambda)
262263
if (mActive[i] == false)
263264
continue;
264265

265-
mJoint->setConstraintImpulse(i, _lambda[localIndex]);
266+
mJoint->setConstraintImpulse(
267+
i, mJoint->getConstraintImpulse(i) + _lambda[localIndex]);
266268

267269
mOldX[i] = _lambda[localIndex];
268270

dart/constraint/JointLimitConstraint.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ void JointLimitConstraint::applyUnitImpulse(size_t _index)
309309
mJoint->setConstraintImpulse(i, 1.0);
310310
skeleton->updateBiasImpulse(mBodyNode);
311311
skeleton->updateVelocityChange();
312+
mJoint->setConstraintImpulse(i, 0.0);
312313
}
313314

314315
++localIndex;
@@ -370,7 +371,8 @@ void JointLimitConstraint::applyImpulse(double* _lambda)
370371
if (mActive[i] == false)
371372
continue;
372373

373-
mJoint->setConstraintImpulse(i, _lambda[localIndex]);
374+
mJoint->setConstraintImpulse(
375+
i, mJoint->getConstraintImpulse(i) + _lambda[localIndex]);
374376

375377
mOldX[i] = _lambda[localIndex];
376378

0 commit comments

Comments
 (0)