Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre Fernbach
tsid
Commits
6cdcde30
Unverified
Commit
6cdcde30
authored
Jun 11, 2018
by
Justin Carpentier
Committed by
GitHub
Jun 11, 2018
Browse files
Merge pull request #14 from jcarpent/master
Simplify cmake files
parents
b63ad911
adc5ebdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
6cdcde30
#
# Copyright (c) 2017 CNRS
# Copyright (c) 2017
-2018
CNRS
#
# This file is part of tsid
# pinocchio is free software: you can redistribute it
...
...
@@ -21,25 +21,18 @@ INCLUDE(cmake/boost.cmake)
INCLUDE
(
cmake/eigen.cmake
)
INCLUDE
(
cmake/python.cmake
)
INCLUDE
(
cmake/ide.cmake
)
INCLUDE
(
cmake/apple.cmake
)
SET
(
PROJECT_NAME tsid
)
SET
(
PROJECT_DESCRIPTION
"Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio"
)
SET
(
PROJECT_URL
"http://github.com/stack-of-tasks/tsid"
)
OPTION
(
INSTALL_DOCUMENTATION
"Generate and install the documentation"
FALSE
)
OPTION
(
INSTALL_DOCUMENTATION
"Generate and install the documentation"
OFF
)
SET
(
DOXYGEN_USE_MATHJAX YES
)
# Handle APPLE Cmake policy
IF
(
APPLE
)
SET
(
CMAKE_MACOSX_RPATH TRUE
)
SET
(
CMAKE_SKIP_BUILD_RPATH FALSE
)
SET
(
CMAKE_BUILD_WITH_INSTALL_RPATH FALSE
)
SET
(
CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE
)
set
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_PREFIX
}
/lib"
)
list
(
FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"
${
CMAKE_INSTALL_PREFIX
}
/lib"
isSystemDir
)
if
(
"
${
isSystemDir
}
"
STREQUAL
"-1"
)
set
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_PREFIX
}
/lib"
)
endif
(
"
${
isSystemDir
}
"
STREQUAL
"-1"
)
APPLY_DEFAULT_APPLE_CONFIGURATION
()
ENDIF
(
APPLE
)
# Disable -Werror on Unix for now.
...
...
cmake
@
bf10c6ca
Compare
d22de8c5
...
bf10c6ca
Subproject commit
d22de8c53c3507df785b1fb3ab260d9fdfb65233
Subproject commit
bf10c6ca3565b96ab283edaa8f18b5b533e59da9
include/tsid/math/utils.hpp
View file @
6cdcde30
...
...
@@ -94,7 +94,7 @@ namespace tsid
const
se3
::
SE3
&
Mdes
,
se3
::
Motion
&
error
);
void
solveWithDampingFromSvd
(
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
&
svd
,
void
solveWithDampingFromSvd
(
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svd
,
ConstRefVector
b
,
RefVector
sol
,
double
damping
=
0.0
);
...
...
@@ -107,13 +107,13 @@ namespace tsid
unsigned
int
computationOptions
=
Eigen
::
ComputeThinU
|
Eigen
::
ComputeThinV
);
void
pseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
unsigned
int
computationOptions
);
void
pseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
double
*
nullSpaceBasisOfA
,
...
...
@@ -122,7 +122,7 @@ namespace tsid
unsigned
int
computationOptions
);
void
dampedPseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
double
dampingFactor
,
...
...
@@ -130,12 +130,12 @@ namespace tsid
double
*
nullSpaceBasisOfA
=
0
,
int
*
nullSpaceRows
=
0
,
int
*
nullSpaceCols
=
0
);
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
&
svdDecomposition
,
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svdDecomposition
,
double
tolerance
,
double
*
nullSpaceBasisMatrix
,
int
&
rows
,
int
&
cols
);
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
&
svdDecomposition
,
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svdDecomposition
,
int
rank
,
double
*
nullSpaceBasisMatrix
,
int
&
rows
,
int
&
cols
);
...
...
src/math/utils.cpp
View file @
6cdcde30
...
...
@@ -52,7 +52,7 @@ namespace tsid
error
=
se3
::
log6
(
Mdes
.
inverse
()
*
M
);
}
void
solveWithDampingFromSvd
(
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
&
svd
,
void
solveWithDampingFromSvd
(
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svd
,
ConstRefVector
b
,
RefVector
sol
,
double
damping
)
{
...
...
@@ -77,7 +77,7 @@ namespace tsid
RefVector
sol
,
double
damping
)
{
assert
(
A
.
rows
()
==
b
.
size
());
Eigen
::
JacobiSVD
<
typename
Eigen
::
MatrixXd
::
PlainObject
>
svd
(
A
.
rows
(),
A
.
cols
());
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
svd
(
A
.
rows
(),
A
.
cols
());
svd
.
compute
(
A
,
Eigen
::
ComputeThinU
|
Eigen
::
ComputeThinV
);
solveWithDampingFromSvd
(
svd
,
b
,
sol
,
damping
);
...
...
@@ -89,12 +89,12 @@ namespace tsid
unsigned
int
computationOptions
)
{
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
svdDecomposition
(
A
.
rows
(),
A
.
cols
());
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
svdDecomposition
(
A
.
rows
(),
A
.
cols
());
pseudoInverse
(
A
,
svdDecomposition
,
Apinv
,
tolerance
,
computationOptions
);
}
void
pseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
unsigned
int
computationOptions
)
...
...
@@ -106,7 +106,7 @@ namespace tsid
}
void
pseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
double
*
nullSpaceBasisOfA
,
...
...
@@ -118,7 +118,7 @@ namespace tsid
if
(
computationOptions
==
0
)
return
;
//if no computation options we cannot compute the pseudo inverse
svdDecomposition
.
compute
(
A
,
computationOptions
);
JacobiSVD
<
MatrixXd
::
PlainObject
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
JacobiSVD
<
MatrixXd
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
long
int
singularValuesSize
=
singularValues
.
size
();
int
rank
=
0
;
for
(
long
int
idx
=
0
;
idx
<
singularValuesSize
;
idx
++
)
{
...
...
@@ -140,7 +140,7 @@ namespace tsid
}
void
dampedPseudoInverse
(
ConstRefMatrix
A
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>&
svdDecomposition
,
RefMatrix
Apinv
,
double
tolerance
,
double
dampingFactor
,
...
...
@@ -153,7 +153,7 @@ namespace tsid
if
(
computationOptions
==
0
)
return
;
//if no computation options we cannot compute the pseudo inverse
svdDecomposition
.
compute
(
A
,
computationOptions
);
JacobiSVD
<
MatrixXd
::
PlainObject
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
JacobiSVD
<
MatrixXd
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
//rank will be used for the null space basis.
//not sure if this is correct
...
...
@@ -178,13 +178,13 @@ namespace tsid
}
}
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>&
svdDecomposition
,
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>&
svdDecomposition
,
double
tolerance
,
double
*
nullSpaceBasisMatrix
,
int
&
rows
,
int
&
cols
)
{
using
namespace
Eigen
;
JacobiSVD
<
MatrixXd
::
PlainObject
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
JacobiSVD
<
MatrixXd
>::
SingularValuesType
singularValues
=
svdDecomposition
.
singularValues
();
int
rank
=
0
;
for
(
int
idx
=
0
;
idx
<
singularValues
.
size
();
idx
++
)
{
if
(
tolerance
>
0
&&
singularValues
(
idx
)
>
tolerance
)
{
...
...
@@ -195,7 +195,7 @@ namespace tsid
}
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
::
PlainObject
>
&
svdDecomposition
,
void
nullSpaceBasisFromDecomposition
(
const
Eigen
::
JacobiSVD
<
Eigen
::
MatrixXd
>
&
svdDecomposition
,
int
rank
,
double
*
nullSpaceBasisMatrix
,
int
&
rows
,
int
&
cols
)
...
...
unittest/CMakeLists.txt
View file @
6cdcde30
...
...
@@ -18,16 +18,20 @@
# --- MACROS ------------------------------------------------------------------
# --- MACROS ------------------------------------------------------------------
IF
(
BUILD_UNIT_TESTS
)
SET
(
DISABLE_TESTS OFF
)
ELSE
(
BUILD_UNIT_TESTS
)
SET
(
DISABLE_TESTS ON
)
ENDIF
(
BUILD_UNIT_TESTS
)
include
(
../cmake/test.cmake
)
MACRO
(
ADD_TEST_CFLAGS target flag
)
SET_PROPERTY
(
TARGET
${
target
}
APPEND_STRING PROPERTY COMPILE_FLAGS
"
${
flag
}
"
)
ENDMACRO
(
ADD_TEST_CFLAGS
)
MACRO
(
ADD_UNIT_TEST NAME PKGS
)
IF
(
BUILD_UNIT_TESTS
)
ADD_EXECUTABLE
(
${
NAME
}
${
NAME
}
)
ELSE
(
BUILD_UNIT_TESTS
)
ADD_EXECUTABLE
(
${
NAME
}
EXCLUDE_FROM_ALL
${
NAME
}
)
ENDIF
(
BUILD_UNIT_TESTS
)
MACRO
(
ADD_TESTCASE NAME PKGS
)
ADD_UNIT_TEST
(
${
NAME
}
${
NAME
}
)
SET_TARGET_PROPERTIES
(
${
NAME
}
PROPERTIES LINKER_LANGUAGE CXX
)
ADD_TEST_CFLAGS
(
${
NAME
}
"-DBOOST_TEST_DYN_LINK"
)
SET
(
MODULE_NAME
"
${
NAME
}
Test"
)
...
...
@@ -40,34 +44,26 @@ MACRO(ADD_UNIT_TEST NAME PKGS)
TARGET_LINK_LIBRARIES
(
${
NAME
}
${
PROJECT_NAME
}
)
TARGET_LINK_LIBRARIES
(
${
NAME
}
${
Boost_UNIT_TEST_FRAMEWORK_LIBRARY
}
)
ADD_TEST
(
NAME
${
NAME
}
COMMAND
${
NAME
}
)
ADD_DEPENDENCIES
(
check
${
NAME
}
)
ENDMACRO
(
ADD_UNIT_TEST
)
ENDMACRO
(
ADD_TESTCASE
)
# --- RULES -------------------------------------------------------------------
# --- RULES -------------------------------------------------------------------
# --- RULES -------------------------------------------------------------------
IF
(
APPLE
)
ADD_CUSTOM_TARGET
(
check COMMAND export DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH} &&
${
CMAKE_CTEST_COMMAND
}
)
ELSE
(
APPLE
)
ADD_CUSTOM_TARGET
(
check COMMAND
${
CMAKE_CTEST_COMMAND
}
)
ENDIF
(
APPLE
)
ADD_
UNIT_
TEST
(
constraints
"eigen3;pinocchio"
)
ADD_
UNIT_
TEST
(
trajectories
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
constraints
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
trajectories
"eigen3;pinocchio"
)
ADD_
UNIT_
TEST
(
robot-wrapper
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
robot-wrapper
"eigen3;pinocchio"
)
ADD_TEST_CFLAGS
(
robot-wrapper '-DTSID_SOURCE_DIR=\\\"
${${
PROJECT_NAME
}
_SOURCE_DIR
}
\\\"'
)
ADD_
UNIT_
TEST
(
tasks
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
tasks
"eigen3;pinocchio"
)
ADD_TEST_CFLAGS
(
tasks '-DTSID_SOURCE_DIR=\\\"
${${
PROJECT_NAME
}
_SOURCE_DIR
}
\\\"'
)
ADD_
UNIT_
TEST
(
contacts
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
contacts
"eigen3;pinocchio"
)
ADD_TEST_CFLAGS
(
contacts '-DTSID_SOURCE_DIR=\\\"
${${
PROJECT_NAME
}
_SOURCE_DIR
}
\\\"'
)
ADD_
UNIT_
TEST
(
tsid-formulation
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
tsid-formulation
"eigen3;pinocchio"
)
ADD_TEST_CFLAGS
(
tsid-formulation '-DTSID_SOURCE_DIR=\\\"
${${
PROJECT_NAME
}
_SOURCE_DIR
}
\\\"'
)
ADD_
UNIT_
TEST
(
math_utils
"eigen3;pinocchio"
)
ADD_
UNIT_
TEST
(
hqp_solvers
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
math_utils
"eigen3;pinocchio"
)
ADD_TEST
CASE
(
hqp_solvers
"eigen3;pinocchio"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment