diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a85fb52 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +variables: + GIT_SUBMODULE_STRATEGY: "recursive" + GIT_DEPTH: "3" + CCACHE_BASEDIR: "${CI_PROJECT_DIR}" + CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" + +cache: + paths: + - ccache + +.robotpkg-py-dynamic-graph-tutorial: &robotpkg-py-dynamic-graph-tutorial + except: + - gh-pages + script: + - mkdir -p ccache + - cd /root/robotpkg/wip/py-dynamic-graph-tutorial + - git pull + - make checkout MASTER_REPOSITORY="dir ${CI_PROJECT_DIR}" + - make install + - cd work.$(hostname)/$(make show-var VARNAME=DISTNAME) + - make test + +robotpkg-py-dynamic-graph-tutorial-14.04-release: + <<: *robotpkg-py-dynamic-graph-tutorial + image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-tutorial/py-dynamic-graph-tutorial:14.04 + +robotpkg-py-dynamic-graph-tutorial-16.04-release: + <<: *robotpkg-py-dynamic-graph-tutorial + image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-tutorial/py-dynamic-graph-tutorial:16.04 + +robotpkg-py-dynamic-graph-tutorial-18.04-release: + <<: *robotpkg-py-dynamic-graph-tutorial + image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-tutorial/py-dynamic-graph-tutorial:18.04 + +doc-coverage: + <<: *robotpkg-py-dynamic-graph-tutorial + image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-tutorial/py-dynamic-graph-tutorial:16.04 + before_script: + - echo -e 'CXXFLAGS+= --coverage\nLDFLAGS+= --coverage\nPKG_DEFAULT_OPTIONS= debug' >> /opt/openrobots/etc/robotpkg.conf + after_script: + - cd /root/robotpkg/wip/py-dynamic-graph-tutorial + - cd work.$(hostname)/$(make show-var VARNAME=DISTNAME) + - make doc + - mv doc/doxygen-html ${CI_PROJECT_DIR} + - mkdir -p ${CI_PROJECT_DIR}/coverage/ + - gcovr -r . + - gcovr -r . --html --html-details -o ${CI_PROJECT_DIR}/coverage/index.html + artifacts: + expire_in: 1 day + paths: + - doxygen-html/ + - coverage/ + diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index f766ee2..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Authors: diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf96dd..9cde011 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,44 +1,41 @@ # -# Copyright 2010 CNRS +# Copyright 2010, 2018 CNRS # Author: Florent Lamiraux # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -SET (CXX_DISABLE_WERROR ON) INCLUDE(cmake/base.cmake) INCLUDE(cmake/boost.cmake) -INCLUDE(cmake/lapack.cmake) -INCLUDE(cmake/cpack.cmake) +INCLUDE(cmake/test.cmake) +INCLUDE(cmake/python.cmake) SET(PROJECT_NAME dynamic-graph-tutorial) -project(${PROJECT_NAME}) - SET(PROJECT_DESCRIPTION "Tutorial for dynamic-graph") -SET(PROJECT_URL "http://github.com/jrl-umi3218/dynamic-graph-tutorial") -SET(${PROJECT_NAME}_HEADERS - include/dynamic-graph/tutorial/inverted-pendulum.hh - include/dynamic-graph/tutorial/feedback-controller.hh -) -# -# Look for dependencies -# +SET(PROJECT_URL "http://github.com/stack-of-tasks/${PROJECT_NAME}") SETUP_PROJECT() -# -# Documentation dependency to package dynamic-graph -# - ADD_REQUIRED_DEPENDENCY("dynamic-graph") -# -# Dependency to package dynamic-graph-python -# -ADD_REQUIRED_DEPENDENCY("dynamic-graph-python") +SET(BOOST_COMPONENTS unit_test_framework) + +OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON) +IF(BUILD_PYTHON_INTERFACE) + ADD_REQUIRED_DEPENDENCY("dynamic-graph-python") + FINDPYTHON() + STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME}) + SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python) + INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) +ENDIF(BUILD_PYTHON_INTERFACE) + +SEARCH_FOR_BOOST() +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +ADD_SUBDIRECTORY(include/dynamic-graph/tutorial) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(doc) +ADD_SUBDIRECTORY(tests) SETUP_PROJECT_FINALIZE() diff --git a/COPYING b/COPYING deleted file mode 100644 index 453184a..0000000 --- a/COPYING +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 31f65ff..0000000 --- a/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -Write in this file the modifications you commit. diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 3008885..0000000 --- a/INSTALL +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright -# - -Installation instructions for library dg-tutorial ----------------------------------------------- - -It is recommended to create a specific directory to install this package. -mkdir build -cd build -cmake [Options] .. -make -make install - -Options: - --DCMAKE_INSTALL_PREFIX=... - specifies the directory where to install the package. - --DCMAKE_BUILD_TYPE=[none|debug|release|relwithdebinfo|MinSizeRel] - specifies to type of compilation (release, debug, ...) diff --git a/NEWS b/NEWS deleted file mode 100644 index 0110a9c..0000000 --- a/NEWS +++ /dev/null @@ -1 +0,0 @@ -Write in this file the news related to package dg-tutorial. diff --git a/README.md b/README.md index 77e9dce..9cc3084 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ -[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) # dynamic-graph-tutorial +[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) +[![Building Status](https://travis-ci.org/stack-of-tasks/dynamic-graph-tutorial.svg?branch=master)](https://travis-ci.org/stack-of-tasks/dynamic-graph-tutorial) +[![Pipeline status](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/pipeline.svg)](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/commits/master) +[![Coverage report](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/stack-of-tasks/doc/stack-of-tasks/dynamic-graph-tutorial/master/coverage/) + + See INSTALL for installation instruction. The documentation is available here: -[http://stack-of-tasks.github.io/dynamic-graph-tutorial/](http://stack-of-tasks.github.io/dynamic-graph-tutorial/) \ No newline at end of file +[http://stack-of-tasks.github.io/dynamic-graph-tutorial/](http://stack-of-tasks.github.io/dynamic-graph-tutorial/) diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 140b799..0000000 --- a/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "" -echo "This package is installed through cmake. Please read INSTALL for instructions." -echo "" diff --git a/dg-tutorial.pc.cmake b/dg-tutorial.pc.cmake deleted file mode 100644 index 1810450..0000000 --- a/dg-tutorial.pc.cmake +++ /dev/null @@ -1,13 +0,0 @@ -prefix=${CMAKE_INSTALL_PREFIX} -exec_prefix=${install_pkg_prefix} -libdir=${install_pkg_exec_prefix}/lib -includedir=${install_pkg_prefix}/include -datarootdir=${install_pkg_prefix}/share -docdir=${install_pkg_datarootdir}/doc/${PROJECT_NAME} - -Name: ${PROJECT_NAME} -Description: -Version: ${PROJECT_VERSION} -Requires: ${PACKAGE_REQUIREMENTS} -Libs: ${LIBDIR_KW}${install_pkg_libdir} ${${PROJECT_NAME}_LDFLAGS} -Cflags: -I${install_pkg_include_dir} ${${PROJECT_NAME}_CXXFLAGS} diff --git a/include/dynamic-graph/tutorial/CMakeLists.txt b/include/dynamic-graph/tutorial/CMakeLists.txt new file mode 100644 index 0000000..cd651e5 --- /dev/null +++ b/include/dynamic-graph/tutorial/CMakeLists.txt @@ -0,0 +1,9 @@ +SET(${PROJECT_NAME}_HEADERS} + inverted-pendulum.hh + feedback-controller.hh + ) + +INSTALL(FILES + ${${PROJECT_NAME}_HEADERS} + DESTINATION include/${PROJECT_NAME} + ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 77ac26f..afed53c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010, Florent Lamiraux, CNRS +# Copyright 2010, 2018, Florent Lamiraux, CNRS # # This file is part of sot-core. # sot-core is free software: you can redistribute it and/or @@ -13,33 +13,23 @@ # received a copy of the GNU Lesser General Public License along with # dynamic-graph-tutorial. If not, see . -# Libraries DEFINITIONS and INCLUDES -INCLUDE(../cmake/python.cmake) - -SET(LIBRARY_NAME ${PROJECT_NAME}) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) - -# provide path to dependency libraries -LINK_DIRECTORIES(${DYNAMIC_GRAPH_PYTHON_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS}) - -ADD_LIBRARY(${LIBRARY_NAME} - SHARED - inverted-pendulum.cc - feedback-controller.cc +SET(${PROJECT_NAME}_SOURCES + inverted-pendulum + feedback-controller ) -SET_TARGET_PROPERTIES(${LIBRARY_NAME} - PROPERTIES - SOVERSION ${PROJECT_VERSION} - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) +SET(${PY_NAME}_PYTHON + simu.py + ) -# Add dynamic-graph-python compilation flags and link to dependency libraries -PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph-python) +ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}) +PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph) -INSTALL(TARGETS ${LIBRARY_NAME} - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +IF(BUILD_PYTHON_INTERFACE) + PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph-python) + DYNAMIC_GRAPH_PYTHON_MODULE("tutorial" ${PROJECT_NAME} wrap) + INSTALL(FILES ${${PY_NAME}_PYTHON} DESTINATION "${PYTHON_SITELIB}/dynamic-graph/tutorial/") +ENDIF(BUILD_PYTHON_INTERFACE) -# Create a python module containing new Python entity classes -DYNAMIC_GRAPH_PYTHON_MODULE("tutorial" ${LIBRARY_NAME} wrap) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) diff --git a/src/feedback-controller.cc b/src/feedback-controller.cpp similarity index 100% rename from src/feedback-controller.cc rename to src/feedback-controller.cpp diff --git a/src/inverted-pendulum.cc b/src/inverted-pendulum.cpp similarity index 100% rename from src/inverted-pendulum.cc rename to src/inverted-pendulum.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..9f39fc8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,9 @@ +ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) + +ADD_UNIT_TEST(pendulum pendulum) +TARGET_LINK_LIBRARIES(pendulum ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +PKG_CONFIG_USE_DEPENDENCY(pendulum dynamic-graph) + +ADD_UNIT_TEST(controller controller) +TARGET_LINK_LIBRARIES(controller ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +PKG_CONFIG_USE_DEPENDENCY(controller dynamic-graph) diff --git a/tests/controller.cpp b/tests/controller.cpp new file mode 100644 index 0000000..1ee486b --- /dev/null +++ b/tests/controller.cpp @@ -0,0 +1,12 @@ +#include + +#include "dynamic-graph/tutorial/feedback-controller.hh" + +BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE ) + +BOOST_AUTO_TEST_CASE(test_controller) +{ + dynamicgraph::tutorial::FeedbackController controller("test controller"); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/pendulum.cpp b/tests/pendulum.cpp new file mode 100644 index 0000000..86f5376 --- /dev/null +++ b/tests/pendulum.cpp @@ -0,0 +1,18 @@ +#include + +#include "dynamic-graph/tutorial/inverted-pendulum.hh" + +BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE ) + +BOOST_AUTO_TEST_CASE(test_pendulum) +{ + dynamicgraph::tutorial::InvertedPendulum pendulum("test pendulum"); + pendulum.setCartMass(1.2); + BOOST_CHECK(pendulum.getCartMass() == 1.2); + pendulum.setPendulumMass(0.6); + BOOST_CHECK(pendulum.getPendulumMass() == 0.6); + pendulum.setPendulumLength(1.8); + BOOST_CHECK(pendulum.getPendulumLength() == 1.8); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt deleted file mode 100644 index c04aa64..0000000 --- a/unitTesting/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright -# - -SET(EXECUTABLE_NAME test${PROJECT_NAME}) - -ADD_DEFINITIONS(-DDEBUG=2) - -# provide path to dependency libraries -LINK_DIRECTORIES(${DYNAMIC_GRAPH_PYTHON_LIBRARY_DIRS}) - -ADD_EXECUTABLE(${EXECUTABLE_NAME} - main.cc - dg-tutorial-test.cc) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) - -LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/src) -TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} - dg-tutorial) - -# Add dependency compilation flags and link to dependency libraries -ADD_DEFINITIONS(${DYNAMIC_GRAPH_PYTHON_CFLAGS}) -TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${DYNAMIC_GRAPH_PYTHON_LIBRARIES}) diff --git a/unitTesting/main.cc b/unitTesting/main.cc deleted file mode 100644 index 5457cdf..0000000 --- a/unitTesting/main.cc +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright - */ - -#include "dg-tutorial-test.hh" - -int main (int argc, char** argv) -{ - TutorialTest testTutorial(); -} diff --git a/unitTesting/sot-tutorial-test.cc b/unitTesting/sot-tutorial-test.cc deleted file mode 100644 index 0038c41..0000000 --- a/unitTesting/sot-tutorial-test.cc +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright - */ - -#include -#include "dg-tutorial-test.hh" - -TutorialTest::TutorialTest() -{ - std::cout << "Constructor of unitTesting object of class Tutorial." << std::endl; -} diff --git a/unitTesting/sot-tutorial-test.hh b/unitTesting/sot-tutorial-test.hh deleted file mode 100644 index b4a7445..0000000 --- a/unitTesting/sot-tutorial-test.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright - */ - -#ifndef DG_TUTORIAL_HH -#define DG_TUTORIAL_HH - -#include "dg-tutorial/dg-tutorial.hh" - -/** - \brief UnitTesting class of class Tutorial -*/ -class TutorialTest -{ -public: - /** - \brief Constructor - */ - TutorialTest(); -private: - sot::Tutorial tutorial_; -}; - -#endif