Commit 6f3830c5 authored by mnaveau's avatar mnaveau
Browse files

[cmake] Fix bug in making hrp-2 libraries optional.

parent 9a28f18f
...@@ -41,21 +41,23 @@ FUNCTION(COMPILE_PLUGIN NAME SOURCES ENTITIES) ...@@ -41,21 +41,23 @@ FUNCTION(COMPILE_PLUGIN NAME SOURCES ENTITIES)
ENDFUNCTION() ENDFUNCTION()
# Compile plug-ins. # Compile plug-ins.
IF (hrp2-dynamics_FOUND) IF (HRP2_DYNAMICS_FOUND)
MESSAGE(STATUS "Add dynamic-hrp2_14 plugin")
COMPILE_PLUGIN(dynamic-hrp2_14 dynamic-hrp2_14.cc DynamicHrp2_14) COMPILE_PLUGIN(dynamic-hrp2_14 dynamic-hrp2_14.cc DynamicHrp2_14)
PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_14 hrp2-dynamics) PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_14 hrp2-dynamics)
ENDIF() ENDIF()
IF (hrp2-10-optimized_FOUND) IF (HRP2_10_OPTIMIZED_FOUND)
MESSAGE(STATUS "Add dynamic-hrp2_10 plugin")
COMPILE_PLUGIN(dynamic-hrp2_10 dynamic-hrp2_10.cc DynamicHrp2_10) COMPILE_PLUGIN(dynamic-hrp2_10 dynamic-hrp2_10.cc DynamicHrp2_10)
PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_10 hrp2-10-optimized) PKG_CONFIG_USE_DEPENDENCY(dynamic-hrp2_10 hrp2-10-optimized)
ENDIF() ENDIF()
IF (hrp2-10-optimized_FOUND) IF (HRP2_10_OPTIMIZED_FOUND)
CONFIG_FILES(dynamic_graph/sot/hrp2_10/robot.py) CONFIG_FILES(dynamic_graph/sot/hrp2_10/robot.py)
ENDIF() ENDIF()
IF (hrp2-dynamics_FOUND) IF (HRP2_DYNAMICS_FOUND)
CONFIG_FILES(dynamic_graph/sot/hrp2_14/robot.py) CONFIG_FILES(dynamic_graph/sot/hrp2_14/robot.py)
ENDIF() ENDIF()
...@@ -71,7 +73,7 @@ PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "hrp2.py" ) ...@@ -71,7 +73,7 @@ PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "hrp2.py" )
SET(FILES __init__.py robot.py) SET(FILES __init__.py robot.py)
# Install dynamic_graph.sot.hrp2_14 # Install dynamic_graph.sot.hrp2_14
IF (hrp2-dynamics_FOUND) IF (HRP2_DYNAMICS_FOUND)
SET(PYTHON_MODULE dynamic_graph/sot/hrp2_14) SET(PYTHON_MODULE dynamic_graph/sot/hrp2_14)
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" ) PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" )
PYTHON_INSTALL_BUILD("${PYTHON_MODULE}" "robot.py" "${PYTHON_SITELIB}") PYTHON_INSTALL_BUILD("${PYTHON_MODULE}" "robot.py" "${PYTHON_SITELIB}")
...@@ -79,7 +81,7 @@ IF (hrp2-dynamics_FOUND) ...@@ -79,7 +81,7 @@ IF (hrp2-dynamics_FOUND)
ENDIF() ENDIF()
# Install dynamic_graph.sot.hrp2_10 # Install dynamic_graph.sot.hrp2_10
IF (hrp2-10-optimized_FOUND) IF (HRP2_10_OPTIMIZED_FOUND)
SET(PYTHON_MODULE dynamic_graph/sot/hrp2_10) SET(PYTHON_MODULE dynamic_graph/sot/hrp2_10)
PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" ) PYTHON_INSTALL_ON_SITE("${PYTHON_MODULE}" "__init__.py" )
PYTHON_INSTALL_BUILD("${PYTHON_MODULE}" "robot.py" "${PYTHON_SITELIB}") PYTHON_INSTALL_BUILD("${PYTHON_MODULE}" "robot.py" "${PYTHON_SITELIB}")
...@@ -149,11 +151,11 @@ MACRO(build_hrp2_controller robotnumber) ...@@ -149,11 +151,11 @@ MACRO(build_hrp2_controller robotnumber)
ENDMACRO() ENDMACRO()
IF (hrp2-10-optimized_FOUND) IF (HRP2_10_OPTIMIZED_FOUND)
build_hrp2_controller("10") build_hrp2_controller("10")
ENDIF() ENDIF()
IF (hrp2-dynamics_FOUND) IF (HRP2_DYNAMICS_FOUND)
build_hrp2_controller("14") build_hrp2_controller("14")
ENDIF() ENDIF()
...@@ -172,10 +172,9 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut) ...@@ -172,10 +172,9 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut)
sotDEBUGIN(25) ; sotDEBUGIN(25) ;
vector<double> anglesOut; vector<double> anglesOut;
anglesOut.resize(state_.size()); anglesOut.resize(state_.size());
// Integrate control // Integrate control
increment(timestep_); increment(timestep_);
sotDEBUG (25) << "state = " << state_ << std::endl; sotDEBUG (25) << "state = " << state_ << std::endl;
sotDEBUG (25) << "diff = " << ((previousState_.size() == state_.size())? sotDEBUG (25) << "diff = " << ((previousState_.size() == state_.size())?
(state_ - previousState_) : state_ ) << std::endl; (state_ - previousState_) : state_ ) << std::endl;
...@@ -188,7 +187,7 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut) ...@@ -188,7 +187,7 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut)
for(unsigned int i=6; i < state_.size();++i) for(unsigned int i=6; i < state_.size();++i)
anglesOut[i-6] = state_(i); anglesOut[i-6] = state_(i);
controlOut["joints"].setValues(anglesOut); controlOut["joints"].setValues(anglesOut);
// Read zmp reference from input signal if plugged // Read zmp reference from input signal if plugged
int time = controlSIN.getTime (); int time = controlSIN.getTime ();
zmpSIN.recompute (time + 1); zmpSIN.recompute (time + 1);
...@@ -206,7 +205,7 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut) ...@@ -206,7 +205,7 @@ void SoTHRP2Device::getControl(map<string,dgsot::ControlValues> &controlOut)
controlOut["zmp"].setName("zmp"); controlOut["zmp"].setName("zmp");
controlOut["zmp"].setValues(ZMPRef); controlOut["zmp"].setValues(ZMPRef);
// Update position of freeflyer in global frame // Update position of freeflyer in global frame
for (int i = 0;i < 3; ++i) for (int i = 0;i < 3; ++i)
baseff_[i*4+3] = freeFlyerPose () (i, 3); baseff_[i*4+3] = freeFlyerPose () (i, 3);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment