Skip to content

Commit

Permalink
Use cmake options for including optional solvers and robot models,
Browse files Browse the repository at this point in the history
Move test case to subfolders for easier cmake structure
  • Loading branch information
dmronga committed Feb 21, 2024
1 parent 8383379 commit fe96467
Show file tree
Hide file tree
Showing 73 changed files with 306 additions and 246 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ set(PROJECT_VERSION 0.2)
set(API_VERSION ${PROJECT_VERSION})

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

option(ROBOT_MODEL_PINOCCHIO "Build the Pinocchio-based robot model" OFF)
option(ROBOT_MODEL_KDL "Build the KDL-based robot model" OFF)
option(ROBOT_MODEL_HYRODYN "Build the HyRoDyn-based robot model" OFF)
option(SOLVER_PROXQP "Build the ProxQP-based solver" OFF)
option(SOLVER_EIQUADPROG "Build the Eiquadprog-based solver" OFF)
option(SOLVER_QPSWIFT "Build the QPSwift-based solver" OFF)

add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(tutorials)

find_package(Doxygen)

if(DOXYGEN_FOUND)
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
Expand Down
5 changes: 3 additions & 2 deletions scripts/full_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ make -j8 && sudo make install && cd ../..

# WBC
mkdir wbc/build && cd wbc/build
cmake .. -DUSE_EIQUADPROG=1 -DUSE_KDL=1 -DUSE_PINOCCHIO=1 -DUSE_QPSWIFT=1 -DUSE_PROXQP=1
make -j8 && sudo make install && cd ../..
cmake .. -DROBOT_MODEL_PINOCCHIO=ON -DROBOT_MODEL_KDL=ON -DSOLVER_PROXQP=ON -DSOLVER_EIQUADPROG=ON -DSOLVER_QPSWIFT=ON -DCMAKE_BUILD_TYPE=RELEASE
make -j8 && sudo make install && cd ..

sudo ldconfig
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ cmake .. && make -j8 && sudo make install && cd ../..

# WBC
mkdir wbc/build && cd wbc/build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make -j8 && sudo make install
sudo ldconfig
62 changes: 42 additions & 20 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,77 +1,99 @@
# Controllers
echo "Testing controllers ..."
cd build/test/controllers
cd build/src
cd controllers/test
./test_pid_controllers
./test_pos_pd_controllers
./test_pot_field_controllers
cd ../..

# Core
echo "Testing core library ..."
cd ../core
cd core/test
./test_core
cd ../..

# Robot Models
echo "Testing robot models ..."
echo "Testing RobotModelRBDL ..."
cd ../robot_models/rbdl
cd robot_models/rbdl/test
./test_robot_model_rbdl
cd ..
cd ../..
if [ -d "kdl" ]; then
echo "Testing RobotModelKDL ..."
cd kdl
cd kdl/test
./test_robot_model_kdl
cd ..
cd ../..
fi
if [ -d "pinocchio" ]; then
echo "Testing RobotModelPinocchio ..."
cd ../robot_models/pinocchio
cd pinocchio/test
./test_robot_model_pinocchio
cd ..
cd ../..
fi
if [ -d "hyrodyn" ]; then
echo "Testing RobotModelHyrodyn ..."
cd hyrodyn
cd hyrodyn/test
./test_robot_model_hyrodyn
cd ..
cd ../..
fi
cd ..

# Scenes
echo "Testing scenes ..."
cd ../scenes

echo "Testing VelocityScene ..."
cd scenes/velocity/test
./test_velocity_scene
cd ../..

echo "Testing VelocitySceneQuadraticCost ..."
cd velocity_qp/test
./test_velocity_scene_quadratic_cost
cd ../..


echo "Testing AccelerationScene ..."
cd acceleration/test
./test_acceleration_scene
cd ../..

echo "Testing AccelerationSceneTSID ..."
cd acceleration_tsid/test
./test_acceleration_scene_tsid
cd ../..

echo "Testing AccelerationSceneReducedTSID ..."
cd acceleration_reduced_tsid/test
./test_acceleration_scene_reduced_tsid
cd ../../..

# Solvers
echo "Testing hls ..."
cd ../solvers/hls
cd solvers/hls/test
./test_hls_solver
cd ../..

echo "Testing QPOasesSolver ..."
cd ../qpoases
cd qpoases/test
./test_qpoases_solver
cd ..
cd ../..
if [ -d "eiquadprog" ]; then
echo "Testing EiquadprogSolver ..."
cd eiquadprog
cd eiquadprog/test
./test_eiquadprog_solver
cd ..
cd ../..
fi
if [ -d "proxqp" ]; then
echo "Testing ProxQPSolver ..."
cd proxqp
cd proxqp/test
./test_proxqp_solver
cd ..
cd ../..
fi
if [ -d "qpswift" ]; then
echo "Testing QPSwiftSolver ..."
cd qpswift
cd qpswift/test
./test_qpswift_solver
cd ../../..
cd ../..
fi
cd ..
2 changes: 2 additions & 0 deletions src/controllers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ install(TARGETS ${TARGET_NAME}
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${HEADERS} DESTINATION include/wbc/controllers)

add_subdirectory(test)
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
add_executable(test_pot_field_controllers test_pot_field_controllers.cpp ../suite.cpp)
find_package(Boost COMPONENTS system filesystem unit_test_framework serialization REQUIRED)
add_executable(test_pot_field_controllers test_pot_field_controllers.cpp)
target_link_libraries(test_pot_field_controllers
wbc-controllers
Boost::unit_test_framework)

add_executable(test_pos_pd_controllers test_pos_pd_controllers.cpp ../suite.cpp)
add_executable(test_pos_pd_controllers test_pos_pd_controllers.cpp)
target_link_libraries(test_pos_pd_controllers
wbc-controllers
Boost::unit_test_framework)


add_executable(test_pid_controllers test_pid_controllers.cpp ../suite.cpp)
add_executable(test_pid_controllers test_pid_controllers.cpp)
target_link_libraries(test_pid_controllers
wbc-controllers
Boost::unit_test_framework)
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream>

#include "controllers/JointTorquePIDController.hpp"
#include "../JointTorquePIDController.hpp"
#include <base/samples//RigidBodyStateSE3.hpp>

using namespace std;
Expand Down Expand Up @@ -86,4 +88,3 @@ BOOST_AUTO_TEST_CASE(joint_torque_controller_test){
usleep(dt*1000*1000);
}
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <fstream>
#include <iostream>

#include "controllers/CartesianPosPDController.hpp"
#include "controllers/JointPosPDController.hpp"
#include <controllers/ControllerTools.hpp>
#include "../CartesianPosPDController.hpp"
#include "../JointPosPDController.hpp"
#include "../ControllerTools.hpp"
#include <base/samples/RigidBodyStateSE3.hpp>

using namespace std;
Expand Down Expand Up @@ -176,4 +178,3 @@ BOOST_AUTO_TEST_CASE(jnt_pos_pd_controller){
usleep(dt*1000*1000);
}
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <fstream>
#include <iostream>

#include "controllers/CartesianPotentialFieldsController.hpp"
#include "controllers/RadialPotentialField.hpp"
#include "controllers/PlanarPotentialField.hpp"
#include "controllers/JointLimitAvoidanceController.hpp"
#include "../CartesianPotentialFieldsController.hpp"
#include "../RadialPotentialField.hpp"
#include "../PlanarPotentialField.hpp"
#include "../JointLimitAvoidanceController.hpp"

using namespace std;
using namespace ctrl_lib;
Expand Down Expand Up @@ -307,4 +309,3 @@ BOOST_AUTO_TEST_CASE(joint_limit_avoidance)
usleep(dt*1000*1000);
}
}

2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ install(TARGETS ${TARGET_NAME}
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${HEADERS} DESTINATION include/wbc/core)

add_subdirectory(test)
5 changes: 5 additions & 0 deletions src/core/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
find_package(Boost COMPONENTS system filesystem unit_test_framework serialization REQUIRED)
add_executable(test_core test_core.cpp)
target_link_libraries(test_core
wbc-core
Boost::unit_test_framework)
3 changes: 2 additions & 1 deletion test/core/test_core.cpp → src/core/test/test_core.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <core/TaskConfig.hpp>
#include <core/PluginLoader.hpp>
Expand Down Expand Up @@ -110,4 +112,3 @@ BOOST_AUTO_TEST_CASE(scene_factory){
BOOST_CHECK_NO_THROW(scene = SceneFactory::createInstance("velocity", robot_model, solver, 1e-3));
BOOST_CHECK(scene != 0);
}

6 changes: 3 additions & 3 deletions src/robot_models/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
add_subdirectory(rbdl)
if(USE_PINOCCHIO)
if(ROBOT_MODEL_PINOCCHIO)
add_subdirectory(pinocchio)
endif()
if(USE_HYRODYN)
if(ROBOT_MODEL_HYRODYN)
add_subdirectory(hyrodyn)
endif()
if(USE_KDL)
if(ROBOT_MODEL_KDL)
add_subdirectory(kdl)
endif()

2 changes: 2 additions & 0 deletions src/robot_models/hyrodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ install(TARGETS ${TARGET_NAME}
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${HEADERS} DESTINATION include/wbc/robot_models/hyrodyn)

add_subdirectory(test)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_executable(test_robot_model_hyrodyn test_robot_model_hyrodyn.cpp ../../suite.cpp ../test_robot_model.cpp)
find_package(Boost COMPONENTS system filesystem unit_test_framework serialization REQUIRED)
add_executable(test_robot_model_hyrodyn test_robot_model_hyrodyn.cpp ../../test/test_robot_model.cpp)
target_link_libraries(test_robot_model_hyrodyn
wbc-robot_models-hyrodyn
Boost::unit_test_framework)

Loading

0 comments on commit fe96467

Please sign in to comment.