Skip to content
Snippets Groups Projects
Commit 340bccd2 authored by Alejandro Lopez Gestoso's avatar Alejandro Lopez Gestoso
Browse files

Merge branch 'packaging'

parents 9edca229 ab30f250
No related branches found
No related tags found
No related merge requests found
Pipeline #5192 passed
image: docker.io/labrobotica/labrobotica
stages:
- build
- test
- deploy
build-package:
stage: build
script:
# Uncomment to install dependencies
# - apt update
# - apt -y install iri-<package_name>-dev
- apt update
- apt -y install iri-iriutils-dev iri-comm-dev iri-trajectory-dev
- apt install -y libxerces-c-dev xsdcxx
- mkdir -pv build
- cd build
- cmake -D CMAKE_BUILD_TYPE=RELEASE -DCPACK_PACKAGE_VERSION=$CI_COMMIT_TAG ..
- make package -j $(nproc)
artifacts:
paths:
- build/*.deb
expire_in: 2 weeks
only:
- tags
update_repo:
stage: deploy
script:
- cd build
- "scp -i /root/.ssh/iriLabKeyNopwd -r *ptu-d46*.deb irilabo@labrepo.iri.upc.edu:packages/"
- "ssh irilabo@labrepo.iri.upc.edu -i /root/.ssh/iriLabKeyNopwd -tt /home/irilabo/repo_scripts/update_repo.sh ptu-d46"
only:
- tags
...@@ -8,18 +8,7 @@ endif(COMMAND cmake_policy) ...@@ -8,18 +8,7 @@ endif(COMMAND cmake_policy)
# The project name and the type of project # The project name and the type of project
PROJECT(ptu_d46) PROJECT(ptu_d46)
SET(PACKAGE_NAME ptu-d46)
SET(CPACK_PACKAGE_VERSION "1.0.0")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "0")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
SET (X86 TRUE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
ELSE ()
SET (X86 FALSE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
ENDIF()
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
...@@ -76,15 +65,28 @@ ELSE(UNIX) ...@@ -76,15 +65,28 @@ ELSE(UNIX)
) )
ENDIF(UNIX) ENDIF(UNIX)
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
SET (X86 TRUE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
ELSE ()
SET (X86 FALSE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
ENDIF()
IF (UNIX) IF (UNIX)
SET(CPACK_PACKAGE_FILE_NAME "iri-${PROJECT_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") SET(CPACK_PACKAGE_FILE_NAME "iri-${PACKAGE_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET(CPACK_PACKAGE_NAME "iri-${PROJECT_NAME}-dev") SET(CPACK_PACKAGE_NAME "iri-${PACKAGE_NAME}-dev")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at http://wikiri.upc.es/index.php/Robotics_Lab") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at https://gitlab.iri.upc.edu/labrobotica/labrobotica_how_to")
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) SET(CPACK_PACKAGING_INSTALL_PREFIX /usr)
SET(CPACK_GENERATOR "DEB") SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica@iri.upc.edu") SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
SET(CPACK_SET_DESTDIR "ON") # Necessary because of the absolute install paths
# Uncomment to add the necessary mantainer scripts
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/postrm")
# Uncomment to add dependencies comma separated
# SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-iriutils-dev (>= 1.0~${DISTRIB}), iri-comm-dev (>= 1.0~${DISTRIB}), iri-trajectory-dev (>= 1.0~${DISTRIB}), libxerces-c-dev (>= 1.0~${DISTRIB}), xsdcxx (>= 1.0~${DISTRIB})")
INCLUDE(CPack) INCLUDE(CPack)
ELSE(UNIX) ELSE(UNIX)
......
#edit the following line to add the librarie's header files #edit the following line to add the librarie's header files
FIND_PATH(ptu_d46_INCLUDE_DIRS ptu_commands.h ptu_d46.h /usr/include/iri/ptu_d46 /usr/local/include/iri/ptu_d46) FIND_PATH(ptu_d46_INCLUDE_DIRS ptu_commands.h ptu_d46.h ptu_d46_exceptions.h /usr/local/include/iri/ptu_d46 /usr/include/iri/ptu_d46)
FIND_LIBRARY(ptu_d46_LIBRARIES FIND_LIBRARY(ptu_d46_LIBRARIES
NAMES ptu_d46 NAMES ptu_d46
PATHS /usr/lib /usr/lib/iri/ptu_d46 /usr/local/lib /usr/local/lib/iri/ptu_d46) PATHS /usr/local/lib/iri/ptu_d46 /usr/lib/iri/ptu_d46)
SET(ptu_d46_INCLUDE_DIR ${ptu_d46_INCLUDE_DIRS}) SET(ptu_d46_INCLUDE_DIR ${ptu_d46_INCLUDE_DIRS})
SET(ptu_d46_LIBRARY ${ptu_d46_LIBRARIES}) SET(ptu_d46_LIBRARY ${ptu_d46_LIBRARIES})
......
...@@ -10,18 +10,48 @@ This driver offers a c++ wrapper to control a pan&tilt [PTU-D46](https://www.sus ...@@ -10,18 +10,48 @@ This driver offers a c++ wrapper to control a pan&tilt [PTU-D46](https://www.sus
* Move both servos to a desired position. * Move both servos to a desired position.
* Move both servos to a desired position relative to the current position. * Move both servos to a desired position relative to the current position.
* Move both servos on torque mode. * Move both servos on torque mode.
* Get any feedback that the pna-tilt offers. * Get any feedback that the pan&tilt offers.
On the following image is shown a pan&tilt and his controller: On the following image is shown a pan&tilt and its controller:
<img src="doc/images/ptu_d46.png" alt="ptu_d46" height="150"> <img src="doc/images/ptu_d46.png" alt="ptu_d46" height="150">
## Installation
* Add the labrobotica repository if it is not already added:
``` sudo sh -c 'echo "deb [arch=amd64] http://labrepo.iri.upc.edu/packages xenial main" > /etc/apt/sources.list.d/labrobotica_repo.list' ```
``` wget -O - http://labrepo.iri.upc.edu/labrobotica_repo.gpg.key | sudo apt-key add - ```
* Install the package:
``` sudo apt update && sudo apt install iri-ptu-d46-dev ```
## Disclaimer
Copyright (C) 2009-2019 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer IRI labrobotics (labrobotica@iri.upc.edu)
This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction.
In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
## For developers
<details><summary>click here</summary>
<p>
## Dependencies ## Dependencies
This package requires of the following system libraries and packages This package requires of the following system libraries and packages
* [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system. * [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system.
* [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation. * [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation.
* [XSD](http://wiki.codesynthesis.com/XSD "XSD wiki main page") to enable XML support.
* stdc++. * stdc++.
Under linux all of these utilities are available in ready-to-use packages. Under linux all of these utilities are available in ready-to-use packages.
...@@ -34,9 +64,9 @@ This package also requires of the following IRI libraries: ...@@ -34,9 +64,9 @@ This package also requires of the following IRI libraries:
* [comm](https://gitlab.iri.upc.edu/labrobotica/drivers/comm "comm gitlab page"), a set of drivers for standard communication devices. * [comm](https://gitlab.iri.upc.edu/labrobotica/drivers/comm "comm gitlab page"), a set of drivers for standard communication devices.
* [trajectory](https://gitlab.iri.upc.edu/labrobotica/algorithms/trajectory "trajectory gitlab page"), a set of basic tools to follow a trajectory. * [trajectory](https://gitlab.iri.upc.edu/labrobotica/algorithms/trajectory "trajectory gitlab page"), a set of basic tools to follow a trajectory.
## Compilation and installation ## Compilation and installation from source
Download this repository and create a build folder inside: Clone this repository and create a build folder inside:
``` mkdir build ``` ``` mkdir build ```
...@@ -51,7 +81,7 @@ The RELEASE build mode optimizes for speed. To build in this mode execute instea ...@@ -51,7 +81,7 @@ The RELEASE build mode optimizes for speed. To build in this mode execute instea
The release mode will be kept until next time cmake is executed. The release mode will be kept until next time cmake is executed.
``` make ``` ``` make -j $(nproc)```
In case no errors are reported, the generated libraries (if any) will be located at the In case no errors are reported, the generated libraries (if any) will be located at the
_lib_ folder and the executables (if any) will be located at the _bin_ folder. _lib_ folder and the executables (if any) will be located at the _bin_ folder.
...@@ -62,8 +92,9 @@ To do that, execute ...@@ -62,8 +92,9 @@ To do that, execute
``` make install ``` ``` make install ```
as root and the shared libraries will be copied to */usr/local/lib/iri/ptu_d46* directory as root and the shared libraries will be copied to */usr/local/lib/iri/ptu_d46* directory
and the header files will be copied to */usr/local/include/iri/ptu_d46* dierctory. At and the header files will be copied to */usr/local/include/iri/ptu_d46* dierctory. If the
this point, the library may be used by any user. support for XML file is enabled, all the necessary files will be copied to */usr/local/include/iri/ptu_d46/xml*.
At this point, the library may be used by any user.
To remove the library from the system, exceute To remove the library from the system, exceute
...@@ -79,11 +110,11 @@ To generate the documentation execute the following command: ...@@ -79,11 +110,11 @@ To generate the documentation execute the following command:
To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command
``` FIND_PACKAGE(<library name>) ``` ``` FIND_PACKAGE(ptu_d46) ```
In the case that the package is present, it is necessary to add the header files directory to the include directory path by using In the case that the package is present, it is necessary to add the header files directory to the include directory path by using
``` INCLUDE_DIRECTORIES(${<librray name>_INCLUDE_DIRS}) ``` ``` INCLUDE_DIRECTORIES($ptu_d46_INCLUDE_DIRS}) ```
and it is also necessary to link with the desired libraries by using the following command and it is also necessary to link with the desired libraries by using the following command
...@@ -93,25 +124,13 @@ and it is also necessary to link with the desired libraries by using the followi ...@@ -93,25 +124,13 @@ and it is also necessary to link with the desired libraries by using the followi
* [PTU-D46 calibration](doc/ptu_d46_calibration.md) * [PTU-D46 calibration](doc/ptu_d46_calibration.md)
## Disclaimer ## Examples
Copyright (C) 2009-2010 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Author shernand (shernand@iri.upc.edu)
All rights reserved.
This file is part of Pan project_name Tilt PTU-D46 driver library
Pan project_name Tilt PTU-D46 driver library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
There are three examples:
* _test\_ptu\_d46_ where the pan&tilt unit is controlled on absolute angle mode.
* _test\_ptu\_d46\_speed_ where the pan&tilt unit is controlled on torque mode.
* _test\_sequence_ where the pan&tilt unit is controlled following a trajectory.
</p>
</details>
File moved
File moved
File moved
...@@ -3,7 +3,7 @@ ADD_SUBDIRECTORY(xml) ...@@ -3,7 +3,7 @@ ADD_SUBDIRECTORY(xml)
# edit the following line to add all the source code files of the library # edit the following line to add all the source code files of the library
SET(sources ptu_d46.cpp ptu_d46_exceptions.cpp) SET(sources ptu_d46.cpp ptu_d46_exceptions.cpp)
# edit the following line to add all the header files of the library # edit the following line to add all the header files of the library
SET(headers ptu_d46.h ptu_d46_exceptions.h ptu_commands.h) SET(headers ../include/ptu_d46.h ../include/ptu_d46_exceptions.h ../include/ptu_commands.h)
# edit the following line to find the necessary packages # edit the following line to find the necessary packages
FIND_PACKAGE(iriutils REQUIRED) FIND_PACKAGE(iriutils REQUIRED)
...@@ -11,10 +11,10 @@ FIND_PACKAGE(comm REQUIRED) ...@@ -11,10 +11,10 @@ FIND_PACKAGE(comm REQUIRED)
FIND_PACKAGE(trajectory REQUIRED) FIND_PACKAGE(trajectory REQUIRED)
# edit the following line to add the necessary include directories # edit the following line to add the necessary include directories
INCLUDE_DIRECTORIES(.) INCLUDE_DIRECTORIES(. ../include)
INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${comm_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${comm_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${trajectory_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${trajectory_INCLUDE_DIRS})
SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1) SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1)
...@@ -23,10 +23,10 @@ ADD_LIBRARY(ptu_d46 SHARED ${sources} ${XSD_SOURCES}) ...@@ -23,10 +23,10 @@ ADD_LIBRARY(ptu_d46 SHARED ${sources} ${XSD_SOURCES})
ADD_DEPENDENCIES(ptu_d46 xsd_files_gen) ADD_DEPENDENCIES(ptu_d46 xsd_files_gen)
#edit the following line to add the necessary system libraries (if any) #edit the following line to add the necessary system libraries (if any)
TARGET_LINK_LIBRARIES(ptu_d46 ${iriutils_LIBRARY}) TARGET_LINK_LIBRARIES(ptu_d46 ${iriutils_LIBRARIES})
TARGET_LINK_LIBRARIES(ptu_d46 ${comm_LIBRARY}) TARGET_LINK_LIBRARIES(ptu_d46 ${comm_LIBRARIES})
TARGET_LINK_LIBRARIES(ptu_d46 ${XSD_LIBRARY}) TARGET_LINK_LIBRARIES(ptu_d46 ${XSD_LIBRARIES})
TARGET_LINK_LIBRARIES(ptu_d46 ${trajectory_LIBRARY}) TARGET_LINK_LIBRARIES(ptu_d46 ${trajectory_LIBRARIES})
INSTALL(TARGETS ptu_d46 INSTALL(TARGETS ptu_d46
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
......
...@@ -4,14 +4,16 @@ IF(EXISTS "/usr/include/xsd/cxx") ...@@ -4,14 +4,16 @@ IF(EXISTS "/usr/include/xsd/cxx")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_HAVE_XSD" PARENT_SCOPE) SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_HAVE_XSD" PARENT_SCOPE)
SET(XSD_FOUND TRUE) SET(XSD_FOUND TRUE)
MESSAGE(STATUS "Found the XML library ... adding support for XML files") MESSAGE(STATUS "Found the XML library ... adding support for XML files")
FIND_LIBRARY(XSD_LIBRARY FIND_LIBRARY(XSD_LIBRARIES
NAMES xerces-c NAMES xerces-c
PATHS /usr/lib /usr/local/lib) PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu/)
SET(XSD_LIBRARY ${XSD_LIBRARIES})
ELSE(EXISTS "/usr/include/xsd/cxx") ELSE(EXISTS "/usr/include/xsd/cxx")
MESSAGE(STATUS "XML library not found ... it will be impossible to handle XML files") MESSAGE(STATUS "XML library not found ... it will be impossible to handle XML files")
ENDIF(EXISTS "/usr/include/xsd/cxx") ENDIF(EXISTS "/usr/include/xsd/cxx")
IF(XSD_FOUND) IF(XSD_FOUND)
SET(XSD_LIBRARIES ${XSD_LIBRARIES} PARENT_SCOPE)
SET(XSD_LIBRARY ${XSD_LIBRARY} PARENT_SCOPE) SET(XSD_LIBRARY ${XSD_LIBRARY} PARENT_SCOPE)
SET(XSD_PATH ${CMAKE_CURRENT_SOURCE_DIR}) SET(XSD_PATH ${CMAKE_CURRENT_SOURCE_DIR})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment