Robot Library is a C++ package for modeling, trajectory generation, and control of robots. The initial release supports real-time velocity control of serial link robot arms (work on torque control is underway!). Checkout the ROS2 action server to see it in action 💥
- Everything is contained in one library: modeling, control, and trajectory generation.
- Easy-to-use control classes with automatic joint limit avoidance, redundancy resolution, singularity avoidance, etc.
- Modular design:
- Build your own controllers from
SerialLinkBase
class, or make one entirely from scratch with theKinematicTree
class. - Use the trajectory generation classes for your controller. Or don't - make your own!
- Build your own controllers from
- Full inverse dynamics for floating-base robots with the
KinematicTree
class. - All you need is a URDF to get started 😎
- Sections of the Library
- Installation
- Using Robot Library
- Release Notes
- Contributing
- Citing this Repository
- License
- Control: Classes for real-time, feedback control.
- Math: Supporting functions & classes for other parts of the library.
- Model: Classes for computing the kinematics & dynamics of rigid-body structures.
- Trajectory: Classes for generating paths through space & time.
The diagram below shows how the different libraries interact:
- CMake 3.14 or higher
- C++17 or higher
- Eigen3 v3.4 or higher
Note
You need to manually install Eigen 3.4 if you're using Ubuntu 20.04.
-
First ensure prerequisites are installed:
sudo apt update
sudo apt install -y build-essential cmake git
-
Download version 3.4 directly (or from the webpage):
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
-
Extract the downloaded file:
tar -xvf eigen-3.4.0.tar.gz
cd eigen-3.4.0
-
Build and install:
mkdir build && cd build
cmake ../
sudo make install
Eigen 3.4 is automatically installed on later versions of Ubuntu. In the command line you can run:
sudo apt install libeigen3-dev
-
Clone this repository in to your working directory:
git clone https://github.com/Woolfrey/software_robot_library.git
-
Navigate in to the folder:
cd ~/<your_working_directory>/software_robot_library
-
Create a build directory and navigate in to it:
mkdir build && cd build
-
Run the following commands in the
build
directory:cmake ..
sudo make install
You should now be able to include different parts of the library in your C++ files.
When using RobotLibrary
classes in another project, it is necessary to link both Eigen
and RobotLibrary
when compiling executables. For example, we may want to use the KinematicTree
class in the example.cpp
of the following example project:
example_project/
├── build/
├── src/
| └── example.cpp
└── CMakeLists.txt
In the example.cpp
file we can include the KinematicTree
header file under RobotLibrary
:
#include <RobotLibrary/Model/KinematicTree.h>
...
int main(int argc, char **argv)
{
RobotLibrary::Model::KinematicTree model("path/to/robot.urdf");
}
Then, in the CMakeLists.txt
file, we must:
- Tell the compiler to find both
Eigen3
andRobotLibrary
, and - Link
RobotLibrary
andEigen3
to the executable that uses anyRobotLibrary
classes:
cmake_minimum_required(VERSION 3.8)
project(example)
...
find_package(Eigen3 REQUIRED)
find_package(RobotLibrary REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
...
add_executable(example src/example.cpp)
target_link_libraries(example RobotLibrary::RobotLibrary Eigen3::Eigen)
Inside the example_project/build
folder it should be possible to compile the project:
cmake ..
make
If you would like to see examples where RobotLibrary
has been applied, you can check out:
- Serial Link Action Server : My own ROS2 action servers for control,
- Kuka iiwa14 velocity control : a ROS2 package which implements the former action server, and
- TestingRobotLibrary : C++ executables I use for numerical validation of RobotLibrary.
- Control:
- SerialLinkBase : Base class providing common structure for all child classes.
- SerialKinematicControl : Joint velocity & Cartesian velocity control algorithms.
- Math:
- MathFunctions : Helper functions for other classes.
- Polynomial : Generates a scalar, polynomial function.
- SkewSymmetric: Converted an
Eigen::Vector3d
object to an anti-symmetricEigen::Matrix3d
object. - Spline : Connects multiple points using polynomials, whilst ensuring continuity.
- Model:
- Joint : Models an actuated joint on a robot.
- KinematicTree : Kinematic & dynamic modeling of branching, serial-link structures.
- Link : Represents a combined
Joint
andRigidBody
object. - Pose : Position and orientation;
$\mathbb{SE}(3)$ . - RigidBody : Dynamics for a single, solid object.
- Trajectory:
- CartesianSpline : Generates smooth trajectories over a series of poses.
- SplineTrajectory : Generates smooth trajectories over a series of points.
- TrajectoryBase : Provides common structure to all trajectory classes.
- TrapezoidalVelocity : Trajectory with constant sections, and ramps up and down.
Contributions to this repositore are welcome! Feel free to:
- Fork the repository,
- Implement your changes / improvements, then
- Issue a pull request.
If you're looking for ideas, you can always check the Issues tab for those with 🙋 [OPEN]. These are things I'd like to implement, but don't have time for. It'd be much appreciated, and you'll be tagged as a contributor 😎
If you find this code useful, spread the word by acknowledging it. Click on Cite this repository
under the About section in the top-right corner of this page
Here's a BibTeX reference:
@software{woolfrey_robot_library_2025
author = {Woolfrey, Jon},
month = apr,
title = {{R}obot {L}ibrary},
url = {https://github.com/Woolfrey/software_robot_library},
version = {1.0.0},
year = {2025}
}
Here's the automatically generated APA format:
Woolfrey, J. (2025). Robot Library (Version 1.0.0). Retrieved from https://github.com/Woolfrey/software_robot_library
This project is licensed under an Open Source / Commercial Use License (OSCL). You are free to use, modify, and (re)distribute this software at no cost under the following conditions:
- You may incorporate this software into your own project, as long as your project also remains free and open source, in accordance with an OSI-approved open-source license.
- You may use this software in a closed-source, proprietary, or commercial product or service, but you must obtain a commercial license. Please contact jonathan.woolfrey@gmail.com to discuss licensing terms and royalties.
This license is designed to encourage open collaboration — but if you profit, then so must I (if only a little 🤏). See the full LICENSE for complete terms.