From c42ca2bdc6227a7888707b1e4f5c84b124ec7a3c Mon Sep 17 00:00:00 2001 From: Francois Bleibel <fbleibel@gmail.com> Date: Thu, 24 Jun 2010 16:27:54 +0900 Subject: [PATCH] Added tools/ directory for... tools. Some corrections in the unit testing facility. --- CMakeLists.txt | 2 ++ include/sot-core/debug.h | 20 +++++------ src/CMakeLists.txt | 73 ++++++++++++++++++++++---------------- src/sot/sot-qr.cpp | 2 +- src/sot/sot.cpp | 2 +- src/task/multi-bound.cpp | 1 - tools/CMakeLists.txt | 30 ++++++++++++++++ unitTesting/CMakeLists.txt | 3 +- 8 files changed, 89 insertions(+), 44 deletions(-) create mode 100644 tools/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b295e9e..cc17d7be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ ENDIF( (NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio.*") ) +enable_testing() # # Look for dependencies @@ -138,6 +139,7 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(unitTesting) +ADD_SUBDIRECTORY(tools) # # Documentation produced by doxygen diff --git a/include/sot-core/debug.h b/include/sot-core/debug.h index 79e5656e..2bc14692 100644 --- a/include/sot-core/debug.h +++ b/include/sot-core/debug.h @@ -114,17 +114,17 @@ SOT_CORE_EXPORT extern DebugTrace sotERRORFLOW; #define sotPREERROR "\t!! "<<__FILE__ << ": " <<__FUNCTION__ \ << "(#" << __LINE__ << ") :" -# define sotDEBUG(level) if( (level>VP_DEBUG_MODE)||(!sotDEBUGFLOW.outputbuffer.good()) ) ;\ - else sotDEBUGFLOW.outputbuffer << sotPREDEBUG -# define sotDEBUGMUTE(level) if( (level>VP_DEBUG_MODE)||(!sotDEBUGFLOW.outputbuffer.good()) ) ;\ - else sotDEBUGFLOW.outputbuffer -# define sotERROR if(!sotDEBUGFLOW.outputbuffer.good()); else sotERRORFLOW.outputbuffer << sotPREERROR -# define sotDEBUGF if(!sotDEBUGFLOW.outputbuffer.good()); else sotDEBUGFLOW.pre(sotDEBUGFLOW.tmpbuffer<<sotPREDEBUG,VP_DEBUG_MODE).trace -# define sotERRORF if(!sotDEBUGFLOW.outputbuffer.good()); else sotERRORFLOW.pre(sotERRORFLOW.tmpbuffer<<sotPREERROR).trace +# define sotDEBUG(level) if( (level>VP_DEBUG_MODE)||(!sot::sotDEBUGFLOW.outputbuffer.good()) ) ;\ + else sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG +# define sotDEBUGMUTE(level) if( (level>VP_DEBUG_MODE)||(!sot::sotDEBUGFLOW.outputbuffer.good()) ) ;\ + else sot::sotDEBUGFLOW.outputbuffer +# define sotERROR if(!sot::sotDEBUGFLOW.outputbuffer.good()); else sot::sotERRORFLOW.outputbuffer << sotPREERROR +# define sotDEBUGF if(!sot::sotDEBUGFLOW.outputbuffer.good()); else sot::sotDEBUGFLOW.pre(sot::sotDEBUGFLOW.tmpbuffer<<sotPREDEBUG,VP_DEBUG_MODE).trace +# define sotERRORF if(!sot::sotDEBUGFLOW.outputbuffer.good()); else sot::sotERRORFLOW.pre(sot::sotERRORFLOW.tmpbuffer<<sotPREERROR).trace // TEMPLATE -# define sotTDEBUG(level) if( (level>VP_TEMPLATE_DEBUG_MODE)||(!sotDEBUGFLOW.outputbuffer.good()) ) ;\ - else sotDEBUGFLOW.outputbuffer << sotPREDEBUG -# define sotTDEBUGF if(!sotDEBUGFLOW.outputbuffer.good()); else sotDEBUGFLOW.pre(sotDEBUGFLOW.tmpbuffer<<sotPREDEBUG,VP_TEMPLATE_DEBUG_MODE).trace +# define sotTDEBUG(level) if( (level>VP_TEMPLATE_DEBUG_MODE)||(!sot::sotDEBUGFLOW.outputbuffer.good()) ) ;\ + else sot::sotDEBUGFLOW.outputbuffer << sotPREDEBUG +# define sotTDEBUGF if(!sot::sotDEBUGFLOW.outputbuffer.good()); else sot::sotDEBUGFLOW.pre(sot::sotDEBUGFLOW.tmpbuffer<<sotPREDEBUG,VP_TEMPLATE_DEBUG_MODE).trace inline bool sotDEBUG_ENABLE( const int & level ) { return level<=VP_DEBUG_MODE; } inline bool sotTDEBUG_ENABLE( const int & level ) { return level<=VP_TEMPLATE_DEBUG_MODE; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4edde21a..32ea5981 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,12 +5,42 @@ # The main library name SET(SOTCORE_LIB_NAME ${PROJECT_NAME}) -#This project will create many shared libraries as plugins, listed here +#This project will create many plugins as shared libraries, listed here SET(plugins sot/sot-qr sot/weighted-sot sot/sot-h sot/sot + + math/op-point-modifier + + matrix/binary-op + matrix/derivator + matrix/fir-filter + matrix/integrator-abstract + matrix/integrator-euler + matrix/matrix-constant + matrix/unary-op + matrix/vector-constant + matrix/vector-to-rotation + + task/gain-adaptative + task/task-pd + task/constraint + task/gain-hyperbolic + task/task + task/task-conti + task/task-unilateral + + feature/feature-point6d + feature/feature-vector3 + feature/feature-generic + feature/feature-joint-limits + feature/feature-1d + feature/feature-point6d-relative + feature/feature-visual-point + feature/feature-task + feature/feature-line-distance ) SET(LIBRARY_NAME ${SOTCORE_LIB_NAME}) @@ -29,45 +59,18 @@ SET(${PROJECT_NAME}_SOURCES signal/signal-cast.cpp - matrix/binary-op.cpp - matrix/derivator.cpp - matrix/fir-filter.cpp - matrix/integrator-abstract.cpp - matrix/integrator-euler.cpp - matrix/matrix-constant.cpp - matrix/unary-op.cpp - matrix/vector-constant.cpp - matrix/vector-to-rotation.cpp - math/matrix-force.cpp math/matrix-homogeneous.cpp math/matrix-rotation.cpp math/matrix-twist.cpp - math/op-point-modifier.cpp math/vector-quaternion.cpp math/vector-roll-pitch-yaw.cpp math/vector-utheta.cpp - feature/feature-point6d.cpp - feature/feature-vector3.cpp feature/feature-abstract.cpp - feature/feature-generic.cpp - feature/feature-joint-limits.cpp - feature/feature-1d.cpp - feature/feature-point6d-relative.cpp - feature/feature-visual-point.cpp - feature/feature-task.cpp - feature/feature-line-distance.cpp - - task/gain-adaptative.cpp - task/task-pd.cpp - task/constraint.cpp - task/gain-hyperbolic.cpp - task/task.cpp - task/multi-bound.cpp - task/task-conti.cpp - task/task-unilateral.cpp + task/task-abstract.cpp + task/multi-bound.cpp sot/flags.cpp sot/memory-task-sot.cpp @@ -82,6 +85,11 @@ SET(${PROJECT_NAME}_SOURCES INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +#define VP_DEBUG if we're building in debug mode +IF ( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" ) + ADD_DEFINITIONS(-DVP_DEBUG) +ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" ) + ADD_DEFINITIONS(-DDEBUG=2) # provide path to library libMatrixAbstractLayer.so @@ -155,6 +163,11 @@ FOREACH(plugin ${plugins}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) + #define VP_DEBUG if we're building in debug mode + IF ( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" ) + ADD_DEFINITIONS(-DVP_DEBUG) + ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" ) + ADD_DEFINITIONS(-DDEBUG=2) # provide path to library libMatrixAbstractLayer.so diff --git a/src/sot/sot-qr.cpp b/src/sot/sot-qr.cpp index b3592404..c6de0808 100644 --- a/src/sot/sot-qr.cpp +++ b/src/sot/sot-qr.cpp @@ -882,7 +882,7 @@ computeControlLaw( ml::Vector& control,const int& iterTime ) TaskAbstract & task = **iter; MemoryTaskSOT * mem = dynamic_cast<MemoryTaskSOT *>( task.memoryInternal ); const ml::Matrix &Jac = mem->JK; - const ml::Vector &err = task.taskSOUT.accessCopy(); + const ml::Vector &err = Sot::taskVectorToMlVector(task.taskSOUT.accessCopy()); ml::Vector diffErr(err.size()); Jac.multiply(control,diffErr); diff --git a/src/sot/sot.cpp b/src/sot/sot.cpp index 2884a086..e66f1c86 100644 --- a/src/sot/sot.cpp +++ b/src/sot/sot.cpp @@ -29,7 +29,7 @@ #ifdef VP_DEBUG class sotSOT__INIT { - public:sotSOT__INIT( void ) { DebugTrace::openFile(); } + public:sotSOT__INIT( void ) { sot::DebugTrace::openFile(); } }; sotSOT__INIT sotSOT_initiator; #endif //#ifdef VP_DEBUG diff --git a/src/task/multi-bound.cpp b/src/task/multi-bound.cpp index 1250d915..3aaf5f55 100644 --- a/src/task/multi-bound.cpp +++ b/src/task/multi-bound.cpp @@ -19,7 +19,6 @@ #include <sot-core/multi-bound.h> -#define VP_DEBUG #define VP_DEBUG_MODE 25 #include <sot-core/debug.h> diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..58473bc6 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,30 @@ +# +# Copyright +# + +### tools +SET(tools + "" +) + +FOREACH(tool_name ${tools}) + SET(EXECUTABLE_NAME ${tool_name}) + + ADD_DEFINITIONS(-DDEBUG=2) + + ADD_EXECUTABLE(${EXECUTABLE_NAME} + ${tool_name}.cpp) + + INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/../include + ) + + LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/lib) + + TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} + ${PROJECT_NAME} + dl) + + INSTALL(TARGETS ${tool_name} + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}) +ENDFOREACH(tool_name) \ No newline at end of file diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt index 06071bb2..2fd7e614 100644 --- a/unitTesting/CMakeLists.txt +++ b/unitTesting/CMakeLists.txt @@ -5,7 +5,6 @@ SET (tests main signal/test_signal - signal/test_array signal/test_depend signal/test_ptr signal/test_dep) @@ -48,5 +47,7 @@ FOREACH(test ${tests}) TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} dl) ENDIF(UNIX) + + ADD_TEST(${test} ${EXECUTABLE_NAME}) ENDFOREACH(test) -- GitLab