A collection of commonly used utility libraries.
To download the submodules, first move to the workspace directory and create a /src
folder:
cd ~/path_to_your_ws
mkdir src
cd src
and then use the following command:
git clone --recurse-submodules https://github.com/JRL-CARI-CNR-UNIBS/cnr_common.git
Keep the submodules up to date with:
cd ~/path_to_your_ws/src/cnr_common
git submodule update --init --recursive
. update_submodules.sh
First, install the dependencies:
sudo apt update
sudo apt -y install libboost-all-dev libeigen3-dev libyaml-cpp-dev libpoco-dev liblog4cxx-dev libgtest-dev
Since cnr_common
contains common packages, it is recommended to compile the workspace without any other workspaces and ROS sourced. If you have a chained workspace setup, this should be the first one in the chain.
If you are using colcon
, you can build these packages with colcon build
.
The package provides a .sh
file to automate the process of compiling and installing all the packages using cmake
. Navigate to the workspace folder where cnr_common
is located (~/path_to_your_ws
) and follow these instructions:
-
Copy and prepare the build script:
cp src/cnr_common/build_template.sh build.sh && sed -i '1i PATH_TO_WS="$(pwd)"' build.sh
-
Run the build script:
. build.sh
-
At the end of the process, add these lines to your
~/.bashrc
file to ensure the installed libraries are visible:
export CNR_COMMON_WS_INSTALL_FOLDER="$HOME/path_to_your_ws/install"
if [[ ":$PATH:" != *":$CNR_COMMON_WS_INSTALL_FOLDER/bin:"* ]]; then
export PATH="$CNR_COMMON_WS_INSTALL_FOLDER/bin:$PATH"
fi
if [[ ":$LD_LIBRARY_PATH:" != *":$CNR_COMMON_WS_INSTALL_FOLDER/lib:"* ]]; then
export LD_LIBRARY_PATH="$CNR_COMMON_WS_INSTALL_FOLDER/lib:$LD_LIBRARY_PATH"
fi
if [[ ":$CMAKE_PREFIX_PATH:" != *":$CNR_COMMON_WS_INSTALL_FOLDER:"* ]]; then
export CMAKE_PREFIX_PATH="$CNR_COMMON_WS_INSTALL_FOLDER:$CMAKE_PREFIX_PATH"
fi
Assign to the variable $CNR_COMMON_WS_INSTALL_FOLDER
the actual path to your install folder. These settings are necessary to make the installed libraries visible.
Note that cnr_param
requires the environment variable CNR_PARAM_ROOT_DIRECTORY
to be defined. For example, you can define it in the ~/.bashrc
file as follows:
export CNR_PARAM_ROOT_DIRECTORY="/tmp/cnr_param"
This is the folder used by cnr_param
to save parameters. See the dedicated GitHub page for more information.