lgmath is a C++ library for handling geometry in state estimation problems in robotics. It is used to store, manipulate, and apply three-dimensional rotations and transformations and their associated uncertainties.
There are no minimal, constraint-free, singularity-free representations for these quantities, so lgmath exploits two different representations for the nominal and noisy parts of the uncertain random variable.
- Nominal rotations and transformations are represented using their composable, singularity-free matrix Lie groups, SO(2)/SO(3) and SE(2)/SE(3).
- Their uncertainties are represented as multiplicative perturbations on the minimal, constraint-free vectorspaces of their Lie algebras, so(2)/so(3) and se(2)/se(3).
This library uses concepts and mathematics described in Timothy D. Barfoot's book State Estimation for Robotics. The library also references Associating Uncertainty With Three-Dimensional Poses for Use in Estimation Problems and Integral Forms in Matrix Lie Groups. It is used for robotics research at the Autonomous Space Robotics Lab; most notably in the STEAM Engine, a library for Simultaneous Trajectory Estimation and Mapping.
- Compiler with C++17 support
- CMake (>=3.16)
- Eigen (>=3.3.7)
- (Optional) ROS2 Foxy or later (colcon+ament_cmake)
sudo apt -q -y install build-essential cmake# using APT
sudo apt -q -y install libeigen3-dev
# OR from source
WORKSPACE=~/workspace # choose your own workspace directory
mkdir -p ${WORKSPACE}/eigen && cd $_
git clone https://gitlab.com/libeigen/eigen.git . && git checkout 3.3.7
mkdir build && cd $_
cmake .. && make install # default install location is /usr/local/- Note: if installed from source to a custom location then make sure
cmakecan find it. Also ensure that ros has not been sourced in the terminal used for compilation otherwise it will be compiled as anament_cmakepackage.
Note that lgmath is by default compiled with -march=native in the CMakeLists.txt file in order to improve performance. This can cause issues in a project using lgmath that does not enable the same compilation option. Ensure that your project either makes use of this compilation flag or simply remove that flag from the lgmath CMakeLists.txt.
WORKSPACE=~/workspace # choose your own workspace directory
# clone
mkdir -p ${WORKSPACE}/lgmath && cd $_
git clone https://github.com/utiasASRL/lgmath.git .
# build and install
mkdir -p build && cd $_
cmake .. # optionally include -DBUILD_TESTING=ON to build tests
cmake --build .
cmake --install . # (optional) install, default location is /usr/local/
make doc # (optional) generate documentation in ./docNote: lgmathConfig.cmake will be generated in both build/ and <install prefix>/lib/cmake/lgmath/ to be included in other projects.
CMake will automatically determine if you are building as part of a
colcon buildand use ament_cmake for you. This is achieved checking if ROS is present in your terminal and if the install location is not the default /usr/local which is true of ROS packages.