diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..8dd57a6e91ac0d52a49665319da9901848bed875
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,36 @@
+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
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c37117080091ac70cdaab2c31281b2330d3589df..2fd81ba3dfa0e130d7a5921071bfa825fdde7460 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,18 +8,7 @@ endif(COMMAND cmake_policy)
 
 # The project name and the type of project
 PROJECT(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(PACKAGE_NAME ptu-d46)
 
 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
@@ -76,15 +65,28 @@ ELSE(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)
-  SET(CPACK_PACKAGE_FILE_NAME "iri-${PROJECT_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
-  SET(CPACK_PACKAGE_NAME "iri-${PROJECT_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_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+  SET(CPACK_PACKAGE_FILE_NAME "iri-${PACKAGE_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
+  SET(CPACK_PACKAGE_NAME "iri-${PACKAGE_NAME}-dev")
+  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 /usr)
   SET(CPACK_GENERATOR "DEB")
-  SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica@iri.upc.edu")
-  SET(CPACK_SET_DESTDIR "ON")  # Necessary because of the absolute install paths
+  SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
+
+# 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)
 ELSE(UNIX)
diff --git a/Findptu_d46.cmake b/Findptu_d46.cmake
index 94406c197eaa730117c935fd2d879d4aa6568cfb..8c389ab0c7f55b0f2bd760859d980dc66ce3c1cb 100755
--- a/Findptu_d46.cmake
+++ b/Findptu_d46.cmake
@@ -1,9 +1,9 @@
 #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
     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_LIBRARY    ${ptu_d46_LIBRARIES})
diff --git a/ReadMe.md b/ReadMe.md
index b2dc6b784e97bb38dcfede6085f6ca390c78a656..c00061da88f038f3aa1766feb1b08bc78522e0c8 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -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 relative to the current position.
  * 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">
 
+## 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
 
 This package requires of the following system libraries and packages
 
  * [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.
+ * [XSD](http://wiki.codesynthesis.com/XSD "XSD wiki main page") to enable XML support.
  * stdc++.
 
 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:
  * [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.
 
-## 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 ```
 
@@ -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.
 
-``` make ``` 
+``` make -j $(nproc)``` 
 
 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.
@@ -62,8 +92,9 @@ To do that, execute
 ``` make install ```
 
 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
-this point, the library may be used by any user.
+and the header files will be copied to */usr/local/include/iri/ptu_d46* dierctory. If the 
+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
 
@@ -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
 
-``` 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
 
-``` 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
 
@@ -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)
 
-## Disclaimer  
-
-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/>
+## Examples
 
+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>
 
diff --git a/src/ptu_commands.h b/include/ptu_commands.h
similarity index 100%
rename from src/ptu_commands.h
rename to include/ptu_commands.h
diff --git a/src/ptu_d46.h b/include/ptu_d46.h
similarity index 100%
rename from src/ptu_d46.h
rename to include/ptu_d46.h
diff --git a/src/ptu_d46_exceptions.h b/include/ptu_d46_exceptions.h
similarity index 100%
rename from src/ptu_d46_exceptions.h
rename to include/ptu_d46_exceptions.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 23006c2b828dbd6e5d2d5acfddbfbd2f534b905b..66874299013079fef6668a863dd411dd5cf31893 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,7 +3,7 @@ ADD_SUBDIRECTORY(xml)
 # edit the following line to add all the source code files of the library
 SET(sources ptu_d46.cpp ptu_d46_exceptions.cpp)
 # 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
 FIND_PACKAGE(iriutils REQUIRED)
@@ -11,10 +11,10 @@ FIND_PACKAGE(comm REQUIRED)
 FIND_PACKAGE(trajectory REQUIRED)
 
 # edit the following line to add the necessary include directories
-INCLUDE_DIRECTORIES(.)
-INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIR})
-INCLUDE_DIRECTORIES(${comm_INCLUDE_DIR})
-INCLUDE_DIRECTORIES(${trajectory_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(. ../include)
+INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${comm_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${trajectory_INCLUDE_DIRS})
 
 SET_SOURCE_FILES_PROPERTIES(${XSD_SOURCES} PROPERTIES GENERATED 1)
 
@@ -23,10 +23,10 @@ ADD_LIBRARY(ptu_d46 SHARED ${sources} ${XSD_SOURCES})
 ADD_DEPENDENCIES(ptu_d46 xsd_files_gen)
 
 #edit the following line to add the necessary system libraries (if any)
-TARGET_LINK_LIBRARIES(ptu_d46 ${iriutils_LIBRARY})
-TARGET_LINK_LIBRARIES(ptu_d46 ${comm_LIBRARY})
-TARGET_LINK_LIBRARIES(ptu_d46 ${XSD_LIBRARY})
-TARGET_LINK_LIBRARIES(ptu_d46 ${trajectory_LIBRARY})
+TARGET_LINK_LIBRARIES(ptu_d46 ${iriutils_LIBRARIES})
+TARGET_LINK_LIBRARIES(ptu_d46 ${comm_LIBRARIES})
+TARGET_LINK_LIBRARIES(ptu_d46 ${XSD_LIBRARIES})
+TARGET_LINK_LIBRARIES(ptu_d46 ${trajectory_LIBRARIES})
 
 INSTALL(TARGETS ptu_d46
   RUNTIME DESTINATION bin
diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt
index a98246a880a2f52506f429a4b3289d45d94fb5b4..af74ebb0982dbb8af41ed769057a9a8f16916a06 100755
--- a/src/xml/CMakeLists.txt
+++ b/src/xml/CMakeLists.txt
@@ -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(XSD_FOUND TRUE) 
    MESSAGE(STATUS "Found the XML library ... adding support for XML files")
-   FIND_LIBRARY(XSD_LIBRARY
+   FIND_LIBRARY(XSD_LIBRARIES
       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")
    MESSAGE(STATUS "XML library not found ... it will be impossible to handle XML files")
 ENDIF(EXISTS "/usr/include/xsd/cxx")
 
 IF(XSD_FOUND)
+   SET(XSD_LIBRARIES ${XSD_LIBRARIES} PARENT_SCOPE)
    SET(XSD_LIBRARY ${XSD_LIBRARY} PARENT_SCOPE)
 
    SET(XSD_PATH ${CMAKE_CURRENT_SOURCE_DIR})