Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/documentation #199

Merged
merged 4 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ serializing and deserializing control library objects
into serialized message packets (#182)
- Add set_data function (#163)
- Move set_data declaration to State and add it for Ellipsoid (#166)
- Add automatic documentation generation and deployment to GitHub Pages (#170)
- Add automatic documentation generation and deployment to GitHub Pages (#170, #199)
- Build and push development dependencies image in CI and related
restructuring of Docker resources (#169)
- Correct an error in the `makefile` of the protobuf bindings and remove
Expand Down
131 changes: 7 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,135 +21,18 @@
A set of libraries to facilitate the creation of full control loop algorithms,
including trajectory planning, kinematics, dynamics and control.

Documentation is available at <a href="https://epfl-lasa.github.io/control_libraries/versions/main/">epfl-lasa.github.io/control_libraries</a>

## Core libraries

For the implementation and documentation of the core libraries, see the
[source](./source) folder.
For the implementation, installation and documentation of the core libraries, see the
<a href="https://github.com/epfl-lasa/control_libraries/tree/main/source">source</a> folder.

## Python bindings

There exist Python bindings for the control libraries (currently not all libraries
supported). See the [python](./python) folder for installation instructions and
currently supported libraries.
There exist Python bindings for core control library modules. See the <a href="https://github.com/epfl-lasa/control_libraries/tree/main/python">python</a>
folder for installation instructions and currently supported libraries.

## Demos

For examples and demos in plain C++, ROS, and ROS2, refer to the [demos](./demos) folder.

---
## Installation

### Supported platforms

These libraries have been developed and tested on Linux Ubuntu 18.04 and 20.04.
They should also work on macOS and Windows, though the installation
steps may differ. At this time no guarantees are made for library support on
non-Linux systems.

### Installation with the install script
This project uses CMake to generate static library objects for each of the modules.

To facilitate the installation process, an [install script](source/install.sh) is provided. Users who are interested in
the manual installation steps and/or have already installed Pinocchio refer to the
[manual installation steps](#manual-installation-steps) in the next section.

The install script takes care of all the installation steps, including the installation and configuration of Pinocchio.
It can be run with several optional arguments:
- `-y`, `--auto`: Any input prompts will be suppressed and install steps automatically approved.
- `-d [path]`, `--dir [path]`: If provided, the installation directory will be changed to `[path]`.
- `--no-controllers`: The controllers library will be excluded from the installation.
- `--no-dynamical-systems`: The dynamical systems library will be excluded from the installation.
- `--no-robot-model`: The robot model library, and therefore Pinocchio, will be excluded from the installation.
- `--build-tests`: The unittest targets will be included in the installation.
- `--clean`: Any previously installed header files from `/usr/local/include` and any shared library files from
`/usr/local/lib` will be deleted before the installation.
- `--cleandir [path]`: Any previously installed header files shared library files from `[path]` will be deleted before
the installation.

### Manual installation steps

Eigen3 is required for building `state_representation` and all other libraries.
You can install it with:
```shell script
apt-get install libeigen3-dev
```

Pinocchio is required for building the `robot_model` library. Installing this requires
some additional steps; see the [install script](source/install.sh) for reference.
If the `robot_model` library is not needed, you can skip the installation of Pinocchio.

Once the dependencies are installed, build and install the libraries by navigating
to the source folder and invoking `cmake` and `make` as shown below.
The library files are installed to `usr/local/lib`, and the library header files
are copied to `/usr/local/include`.

```shell script
cd control_libraries/source
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
make install
```

The CMake configuration flags `BUILD_CONTROLLERS`, `BUILD_DYNAMICAL_SYSTEMS` and `BUILD_ROBOT_MODEL`
determine which libraries are built, and are all defined as `ON` by default.
The building of the `state_representation` library cannot be disabled, as all other libraries depend on it.

To selectively disable the build of a particular library, set the flag to `=OFF`.
For example, the following flags will prevent the `robot_model` library from being built,
which is useful if the Pinocchio dependency is not fulfilled on your system.

```shell script
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_ROBOT_MODEL=OFF ..
```

To also build the library tests, add the CMake flag `-DBUILD_TESTING=ON`.
This requires GTest to be installed on your system. You can then use `make test` to run all test targets.

Alternatively, you can include the source code for each library as submodules in your own CMake project,
using the CMake directive `add_subdirectory(...)` to link it with your project.

## Troubleshooting

This section lists common problems that might come up when using the `control_libraries` modules.

### Boost container limit compile error in ROS
When using the `robot_model` module in ROS and trying to `catkin_make` the workspace, it might produce the following error:
```bash
/opt/openrobots/include/pinocchio/container/boost-container-limits.hpp:29:7: error: #error "BOOST_MPL_LIMIT_LIST_SIZE value is lower than the value of PINOCCHIO_BOOST_MPL_LIMIT_CONTAINER_SIZE"
#23 2.389 29 | # error "BOOST_MPL_LIMIT_LIST_SIZE value is lower than the value of PINOCCHIO_BOOST_MPL_LIMIT_CONTAINER_SIZE"
```
In order to avoid this error and successfully `catkin_make` the workspace, make sure that the `CMakeList.txt` of the ROS
package contains all the necessary directives, i.e. on top of
```bash

list(APPEND CMAKE_PREFIX_PATH /opt/openrobots)
find_package(Eigen3 REQUIRED)
find_package(pinocchio REQUIRED)
find_package(OsqpEigen REQUIRED)
find_package(osqp REQUIRED)

find_library(state_representation REQUIRED)
find_library(dynamical_systems REQUIRED)
find_library(controllers REQUIRED)
find_library(robot_model REQUIRED)
...
include_directories(
${catkin_INCLUDE_DIRS}
${Eigen3_INCLUDE_DIRS}
${STATE_REPRESENTATION_INCLUDE_DIR}
${DYNAMICAL_SYSTEMS_INCLUDE_DIR}
${ROBOT_MODEL_INCLUDE_DIR}
${CONTROLLERS_INCLUDE_DIR}
${PINOCCHIO_INCLUDE_DIR}
${OsqpEigen_INCLUDE_DIR}
/opt/openrobots/include
)
```
it should also have
```bash
find_package(Boost REQUIRED COMPONENTS system)
add_compile_definitions(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS)
add_compile_definitions(BOOST_MPL_LIMIT_LIST_SIZE=30)
```
For a comprehensive example, please check the [`CMakeLists.txt` of the ROS demos](/demos/ros_examples/CMakeLists.txt).
For examples and demos in plain C++, ROS, and ROS2, refer to the <a href="https://github.com/epfl-lasa/control_libraries/tree/main/demos">demos</a> folder.
13 changes: 7 additions & 6 deletions doxygen/doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ EXTRACT_STATIC = NO
# for Java sources.
# The default value is: YES.

EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_CLASSES = NO

# This flag is only useful for Objective-C code. If set to YES, local methods,
# which are defined in the implementation section but not in the interface are
Expand Down Expand Up @@ -791,7 +791,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = ../source
INPUT = ../README.md ../source ../protocol ../python

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -826,6 +826,7 @@ FILE_PATTERNS = *.c \
*.hxx \
*.hpp \
*.h++ \
*.proto \
*.m \
*.markdown \
*.md
Expand Down Expand Up @@ -859,7 +860,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = */tests/*
EXCLUDE_PATTERNS = */tests/* */test/*

# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
Expand All @@ -876,7 +877,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH =
EXAMPLE_PATH = ../demos

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down Expand Up @@ -952,7 +953,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE =
USE_MDFILE_AS_MAINPAGE = ../README.md

#---------------------------------------------------------------------------
# Configuration options related to source browsing
Expand All @@ -965,7 +966,7 @@ USE_MDFILE_AS_MAINPAGE =
# also VERBATIM_HEADERS is set to NO.
# The default value is: NO.

SOURCE_BROWSER = NO
SOURCE_BROWSER = YES

# Setting the INLINE_SOURCES tag to YES will include the body of functions,
# classes and enums directly into the documentation.
Expand Down
2 changes: 1 addition & 1 deletion protocol/clproto_cpp/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# clproto_cpp - Control Libraries Protocol (C++)
# clproto (C++)

This library provides a simple interface for encoding and decoding
control library type objects to and from a serialized binary string
Expand Down
6 changes: 5 additions & 1 deletion protocol/clproto_cpp/include/clproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#define CLPROTO_PACKING_MAX_FIELD_LENGTH (4096)
#define CLPROTO_PACKING_MAX_FIELDS (64)

/**
* @namespace clproto
* @brief Bindings to encode and decode state objects into serialised binary message
*/
namespace clproto {

/**
Expand All @@ -19,7 +23,7 @@ typedef std::size_t field_length_t;

/**
* @class DecodingException
* @brief A DedocdingException is raised whenever a
* @brief A DecodingException is raised whenever a
* decoding operation fails due to invalid encoding.
*/
class DecodingException : public std::runtime_error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define MACRO_STRINGIFY(x) STRINGIFY(x)

PYBIND11_MODULE(state_representation, m) {
m.doc() = "Python bindings for control_libraries state_representation";
m.doc() = "Python bindings for control libraries state_representation";

#ifdef MODULE_VERSION_INFO
m.attr("__version__") = MACRO_STRINGIFY(MODULE_VERSION_INFO);
Expand Down
Loading