====================== Setup and installation ====================== Preparation =========== JSON-LD metamodels ------------------ After cloning this repository, checkout the metamodels to the folder `comp-rob2b/metamodels`: .. code:: sh git clone https://github.com/comp-rob2b/metamodels comp-rob2b/metamodels Code generator -------------- The following dependencies are required for the code generator: * `Python `_ * `rdflib `_ * `pySHACL `_ * `numpy `_ * `Java `_ * `Apache Ant `_ * `StringTemplate `_ * `STSTv4 `_ (from Git!) * `GNU Make `_ Apply the patches from the ``misc/patches`` directory to rdflib. For convenience, we provide a step-by-step installation guide for the latter two dependencies. Note, that STSTv4 comes with a pre-bundled version of StringTemplate. Hence, the steps for StringTemplate can be considered optional and are only relevant if one plans to use a more recent StringTemplate version. StringTemplate can either be `installed `_ from the `pre-compiled version `_ or it can be built from source: 1. Download the latest version and extract it to a directory ```` 2. Change to the directory .. code:: sh cd 2. For version 4.3.3 execute .. code:: sh sed "s/1.6/1.8/g" -i build.xml 3. Compile using ``ant`` 4. This creates a JAR file ```` (e.g. ``ST-4.3.4.jar``) in the ``/dist`` folder STSTv4 must be `built `_ from the Git version (to support `nested JSON arrays `_): 1. Clone the source code: .. code:: sh git clone https://github.com/jsnyders/STSTv4.git 2. Change into the repository: ``cd STSTv4`` 3. Build with ``ant`` 4. Copy the launch script template: .. code:: sh cp stst.sh.init stst.sh 5. Adapt the ``STST_HOME`` variable in the launch script 6. (Optional) To use StringTemplate from above adapt the ``CP`` variable: .. code:: sh sed "s#\$STST_HOME/lib/ST-4.0.8.jar#/dist/#g" -i stst.sh 7. Fix the launch script: .. code:: sh sed "s#lib/stst.jar#build/jar/stst.jar#g" -i stst.sh 8. Make the launch script executable: .. code:: sh chmod +x stst.sh Generated code -------------- The following dependencies are required to build and execute the generated code: * Build dependencies: * `CMake `_ * `GCC `_ * Run-time dependencies: * `orocos_kdl `_ * `urdfdom_headers `_ * `urdfdom `_ * `robif2b `_ * `hddc2b `_ Make sure that the latter dependencies are accessible to the generated CMake script. That can be achieved via a local or system-wide installation, but also using CMake's package registry (to avoid the installation). To this end, both projects can be configured with a ``-DENABLE_PACKAGE_REGISTRY=On`` option. Building and execution ====================== There are four make targets to build the different scenarios: * ``sc0a``: Keep the robot's right arm in contact with the table * ``sc0b``: Keep both robot arms in contact with the table * ``sc1``: Alignment task using an active mobile base * ``sc2``: Alignment task using active arms For instance, to build the latter scenario execute: .. code:: sh make sc2 This target triggers the intermediate code generation, code generation and the final compilation. Run the code via .. code:: sh cd gen/build ./main Documentation ============= The following dependencies are required for building the documentation: * `Sphinx `_ * `Read the Docs Sphinx Theme `_ Build the documentation with the following command: .. code:: sh make tutorial-html