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
Stack Of Tasks
sot-torque-control
Commits
377002ae
Commit
377002ae
authored
Aug 28, 2020
by
Guilhem Saurel
Browse files
Update for dynamic-graph-python v4
parent
a6639c46
Changes
25
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
377002ae
...
...
@@ -48,21 +48,21 @@ ENDIF(INITIALIZE_WITH_NAN)
ADD_PROJECT_DEPENDENCY
(
sot-core REQUIRED PKG_CONFIG_REQUIRES sot-core
)
ADD_PROJECT_DEPENDENCY
(
tsid REQUIRED PKG_CONFIG_REQUIRES tsid
)
ADD_PROJECT_DEPENDENCY
(
ddp-actuator-solver REQUIRED PKG_CONFIG_REQUIRES ddp-actuator-solver
)
ADD_
REQUIRED
_DEPENDENCY
(
"
parametric-curves
"
)
ADD_
PROJECT
_DEPENDENCY
(
parametric-curves
REQUIRED
)
ADD_REQUIRED_DEPENDENCY
(
"simple_humanoid_description"
)
SET
(
BOOST_COMPONENTS filesystem system thread program_options
unit_test_framework regex
)
IF
(
BUILD_TESTING
)
FIND_PACKAGE
(
Boost REQUIRED COMPONENTS unit_test_framework
)
ENDIF
(
BUILD_TESTING
)
IF
(
BUILD_PYTHON_INTERFACE
)
FINDPYTHON
()
SEARCH_FOR_BOOST_PYTHON
(
REQUIRED
)
STRING
(
REGEX REPLACE
"-"
"_"
PYTHON_DIR
${
CUSTOM_HEADER_DIR
}
)
ADD_PROJECT_DEPENDENCY
(
dynamic-graph-python REQUIRED
PKG_CONFIG_REQUIRES dynamic-graph-python
)
SET
(
BOOST_COMPONENTS
${
BOOST_COMPONENTS
}
python
)
ENDIF
(
BUILD_PYTHON_INTERFACE
)
SEARCH_FOR_BOOST
()
# Main Library
SET
(
${
PROJECT_NAME
}
_HEADERS
include/
${
CUSTOM_HEADER_DIR
}
/joint-torque-controller.hh
...
...
@@ -102,7 +102,7 @@ SET(${PROJECT_NAME}_SOURCES
ADD_LIBRARY
(
${
PROJECT_NAME
}
SHARED
${${
PROJECT_NAME
}
_SOURCES
}
${${
PROJECT_NAME
}
_HEADERS
}
)
TARGET_INCLUDE_DIRECTORIES
(
${
PROJECT_NAME
}
PUBLIC $<INSTALL_INTERFACE:include>
)
TARGET_LINK_LIBRARIES
(
${
PROJECT_NAME
}
${
Boost_LIBRARIES
}
TARGET_LINK_LIBRARIES
(
${
PROJECT_NAME
}
PUBLIC
tsid::tsid sot-core::sot-core ddp-actuator-solver::ddp-actuator-solver
)
IF
(
SUFFIX_SO_VERSION
)
...
...
cmake
@
9dcde03a
Compare
fb4c22c3
...
9dcde03a
Subproject commit
fb4c22c319ec5320f9a85527eb1a4130954846f5
Subproject commit
9dcde03a880cccc86531019a6845708f5c54c35d
python/CMakeLists.txt
View file @
377002ae
...
...
@@ -33,7 +33,7 @@ FOREACH(file ${${PROJECT_NAME}_PYTHON_IDENTIFICATION})
ENDFOREACH
(
file
${${
PROJECT_NAME
}
_PYTHON_IDENTIFICATION
}
)
FOREACH
(
file
${${
PROJECT_NAME
}
_PYTHON_UTILS
}
)
PYTHON_INSTALL_ON_SITE
(
"dynamic_graph/
${
PYTHON_DIR
}
/utils"
${
file
}
)
PYTHON_INSTALL_ON_SITE
(
"dynamic_graph/
${
PYTHON_DIR
}
/utils"
${
file
}
)
ENDFOREACH
(
file
${${
PROJECT_NAME
}
_PYTHON_UTILS
}
)
FOREACH
(
file
${${
PROJECT_NAME
}
_PYTHON_TESTS
}
)
...
...
python/dynamic_graph/sot/torque_control/tests/robot_data_test.py
View file @
377002ae
import
numpy
import
numpy
as
np
class
initRobotData
:
...
...
@@ -76,7 +76,7 @@ class initRobotData:
28
:
[
-
1.6057
,
1.6057
],
}
fMax
=
n
umpy
.
array
([
100.0
,
100.0
,
300.0
,
80.0
,
80.0
,
30.0
])
fMax
=
n
p
.
array
([
100.0
,
100.0
,
300.0
,
80.0
,
80.0
,
30.0
])
fMin
=
-
fMax
mapForceIdToForceLimits
=
{
0
:
[
fMin
,
fMax
],
1
:
[
fMin
,
fMax
],
2
:
[
fMin
,
fMax
],
3
:
[
fMin
,
fMax
]}
...
...
@@ -102,18 +102,18 @@ class initRobotData:
# Set the force limits for each id
for
key
in
self
.
mapForceIdToForceLimits
:
cm
.
setForceLimitsFromId
(
key
,
tuple
(
self
.
mapForceIdToForceLimits
[
key
][
0
]),
tuple
(
self
.
mapForceIdToForceLimits
[
key
][
1
]))
cm
.
setForceLimitsFromId
(
key
,
np
.
array
(
self
.
mapForceIdToForceLimits
[
key
][
0
]),
np
.
array
(
self
.
mapForceIdToForceLimits
[
key
][
1
]))
# Set the force sensor id for each sensor name
for
key
in
self
.
mapNameToForceId
:
cm
.
setForceNameToForceId
(
key
,
self
.
mapNameToForceId
[
key
])
# Set the map from the urdf joint list to the sot joint list
cm
.
setJointsUrdfToSot
(
self
.
urdftosot
)
cm
.
setJointsUrdfToSot
(
np
.
array
(
self
.
urdftosot
)
)
# Set the foot frame name
for
key
in
self
.
FootFrameNames
:
cm
.
setFootFrameName
(
key
,
self
.
FootFrameNames
[
key
])
cm
.
setRightFootSoleXYZ
(
self
.
RightFootSensorXYZ
)
cm
.
setRightFootSoleXYZ
(
np
.
array
(
self
.
RightFootSensorXYZ
)
)
python/dynamic_graph/sot/torque_control/tests/robot_data_test.py.in
View file @
377002ae
import numpy
import numpy
as np
class initRobotData:
...
...
@@ -76,7 +76,7 @@ class initRobotData:
28: [-1.6057, 1.6057],
}
fMax = n
umpy
.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMax = n
p
.array([100.0, 100.0, 300.0, 80.0, 80.0, 30.0])
fMin = -fMax
mapForceIdToForceLimits = {0: [fMin, fMax], 1: [fMin, fMax], 2: [fMin, fMax], 3: [fMin, fMax]}
...
...
@@ -102,18 +102,18 @@ class initRobotData:
# Set the force limits for each id
for key in self.mapForceIdToForceLimits:
cm.setForceLimitsFromId(key,
tuple
(self.mapForceIdToForceLimits[key][0]),
tuple
(self.mapForceIdToForceLimits[key][1]))
cm.setForceLimitsFromId(key,
np.array
(self.mapForceIdToForceLimits[key][0]),
np.array
(self.mapForceIdToForceLimits[key][1]))
# Set the force sensor id for each sensor name
for key in self.mapNameToForceId:
cm.setForceNameToForceId(key, self.mapNameToForceId[key])
# Set the map from the urdf joint list to the sot joint list
cm.setJointsUrdfToSot(self.urdftosot)
cm.setJointsUrdfToSot(
np.array(
self.urdftosot)
)
# Set the foot frame name
for key in self.FootFrameNames:
cm.setFootFrameName(key, self.FootFrameNames[key])
cm.setRightFootSoleXYZ(self.RightFootSensorXYZ)
cm.setRightFootSoleXYZ(
np.array(
self.RightFootSensorXYZ)
)
python/dynamic_graph/sot/torque_control/tests/test_control_manager.py
View file @
377002ae
from
dynamic_graph.sot.torque_control.control_manager
import
ControlManager
from
dynamic_graph.sot.torque_control.tests.robot_data_test
import
initRobotData
from
numpy
import
ones
,
zeros
from
numpy
import
array
,
ones
,
zeros
# Instanciate the free flyer
cm
=
ControlManager
(
"cm_test"
)
...
...
@@ -36,6 +36,7 @@ cm.addCtrlMode("pos")
# Add torque mode
cm
.
addCtrlMode
(
"torque"
)
cm
.
ctrl_torque
.
value
=
currentDes
cm
.
ctrl_pos
.
value
=
pwmDes
cm
.
setCtrlMode
(
"all"
,
"pos"
)
# TODO ctrl_* non working yet
# cm.ctrl_torque.value = array(currentDes)
# cm.ctrl_pos.value = pwmDes
# cm.setCtrlMode("all", "pos")
src/CMakeLists.txt
View file @
377002ae
...
...
@@ -33,7 +33,7 @@ FOREACH(plugin ${plugins})
SET_TARGET_PROPERTIES
(
${
LIBRARY_NAME
}
PROPERTIES SOVERSION
${
PROJECT_VERSION
}
)
ENDIF
(
SUFFIX_SO_VERSION
)
TARGET_LINK_LIBRARIES
(
${
LIBRARY_NAME
}
${
PROJECT_NAME
}
${${
LIBRARY_NAME
}
_deps
}
)
TARGET_LINK_LIBRARIES
(
${
LIBRARY_NAME
}
PUBLIC
${
PROJECT_NAME
}
${${
LIBRARY_NAME
}
_deps
}
)
IF
(
NOT INSTALL_PYTHON_INTERFACE_ONLY
)
INSTALL
(
TARGETS
${
LIBRARY_NAME
}
EXPORT
${
TARGETS_EXPORT_NAME
}
...
...
@@ -43,14 +43,14 @@ FOREACH(plugin ${plugins})
IF
(
BUILD_PYTHON_INTERFACE
)
STRING
(
REPLACE - _ PYTHON_LIBRARY_NAME
${
LIBRARY_NAME
}
)
DYNAMIC_GRAPH_PYTHON_MODULE
(
"
${
PYTHON_DIR
}
/
${
PYTHON_LIBRARY_NAME
}
"
${
LIBRARY_NAME
}
${
PROJECT_NAME
}
-
${
PYTHON_LIBRARY_NAME
}
-wrap
)
${
LIBRARY_NAME
}
${
PROJECT_NAME
}
-
${
PYTHON_LIBRARY_NAME
}
-wrap
MODULE_HEADER
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
plugin
}
-python.hh"
)
ENDIF
(
BUILD_PYTHON_INTERFACE
)
ENDFOREACH
(
plugin
)
IF
(
BUILD_PYTHON_INTERFACE
)
SET
(
NO_INSTALL_OF_INIT_PY 0
)
DYNAMIC_GRAPH_PYTHON_MODULE
(
${
PYTHON_DIR
}
${
PROJECT_NAME
}
wrap
${
NO_INSTALL_OF_INIT_PY
}
)
#SET(NO_INSTALL_OF_INIT_PY 0)
#DYNAMIC_GRAPH_PYTHON_MODULE(${PYTHON_DIR} ${PROJECT_NAME} wrap ${NO_INSTALL_OF_INIT_PY})
# Install empty __init__.py files in intermediate directories.
INSTALL
(
FILES
...
...
src/admittance-controller-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/admittance-controller.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
AdmittanceController
>
entities_t
;
src/base-estimator-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/base-estimator.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
BaseEstimator
>
entities_t
;
src/control-manager-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/control-manager.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
ControlManager
>
entities_t
;
src/current-controller-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/current-controller.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
CurrentController
>
entities_t
;
src/device-torque-ctrl-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/device-torque-ctrl.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
DeviceTorqueCtrl
>
entities_t
;
src/free-flyer-locator-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/free-flyer-locator.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
FreeFlyerLocator
>
entities_t
;
src/imu_offset_compensation-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/imu_offset_compensation.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
ImuOffsetCompensation
>
entities_t
;
src/inverse-dynamics-balance-controller-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/inverse-dynamics-balance-controller.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
InverseDynamicsBalanceController
>
entities_t
;
src/joint-torque-controller-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/joint-torque-controller.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
JointTorqueController
>
entities_t
;
src/joint-trajectory-generator-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/joint-trajectory-generator.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
JointTrajectoryGenerator
>
entities_t
;
src/numerical-difference-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/numerical-difference.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
NumericalDifference
>
entities_t
;
src/position-controller-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/position-controller.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
PositionController
>
entities_t
;
src/se3-trajectory-generator-python.hh
0 → 100644
View file @
377002ae
#include
"sot/torque_control/se3-trajectory-generator.hh"
typedef
boost
::
mpl
::
vector
<
dynamicgraph
::
sot
::
torque_control
::
SE3TrajectoryGenerator
>
entities_t
;
Prev
1
2
Next
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