ROS-free C++ core of the SmartArmStack. This repository holds the pure C++ part of SmartArmStack/sas_core: everything that does not depend on ROS2 and does not depend on pybind11.
More information about SmartArmStack is available in smartarmstack.github.io.
The supported installation is the SmartArmStack apt repository,
which provides the pre-built libmarinholab-sas-core package
(LGPL, amd64 and arm64):
curl -s --compressed "https://smartarmstack.github.io/smart_arm_stack_ROS2/KEY.gpg" \
| gpg --dearmor \
| sudo tee /etc/apt/trusted.gpg.d/smartarmstack_lgpl.gpg >/dev/null
sudo curl -s --compressed -o /etc/apt/sources.list.d/smartarmstack_lgpl.list \
"https://smartarmstack.github.io/smart_arm_stack_ROS2/smartarmstack_lgpl.list"
sudo apt update
sudo apt-get install libmarinholab-sas-coreThe package depends on libdqrobotics (from the DQ Robotics PPA, see
Prerequisites) and installs the shared library, the
headers under /usr/include/marinholab/sas/core/ and the CMake package
configuration, so consumers can find_package(marinholab_sas_core).
Keep it up to date with
sudo apt-get update && sudo apt-get upgrade libmarinholab-sas-core.
Building from source is described in Building (CMake); the full list of SmartArmStack packages is on smartarmstack.github.io.
include/marinholab/sas/core/— public C++ headers (namespacemarinholab::sas::core).src/— library implementation.examples/— C++ example programs (built by default).docker/—ubuntu:noblebuild environment and full test pipeline.debian/— Debian packaging (native source package).tools/version.sh— rolling version computation.
The library depends on Eigen3 and dqrobotics.
The project uses a rolling YY.MM.NN version:
YY.MM— the current month (e.g.26.09for September 2026).NN— the number of commits since the version tagvYY.MM(e.g.v26.09);00when the tag does not exist yet.
The version is computed at build time by tools/version.sh; the first
release after a new month starts at .00 and rolls forward with each
commit.
- Ubuntu / Linux — full support, including the real-time scheduling
(
ThreadManagerpriorities, CPU affinity) and theSCHED_FIFOexample. - macOS — builds and runs. Real-time scheduling degrades gracefully:
ThreadManager::apply_priority()/apply_cpu_affinity()are Linux-only (guarded by#ifdef __linux__), and theSCHED_FIFOexample falls back to default scheduling. - Windows — the library builds. The POSIX-only parts of
ThreadManagerare guarded, and theSCHED_FIFOexample compiles to a no-op timing loop. Builddqroboticsfrom source with vcpkg (its CMake expects the vcpkg toolchain).
Note
The Debian package is only produced on Ubuntu. On macOS/Windows use CMake
directly or FetchContent.
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j- A shared library (
libmarinholab_sas_core.so) is built by default (the standard CMakeBUILD_SHARED_LIBSvariable). - For a static library instead:
cmake -B build -DBUILD_SHARED_LIBS=OFF. - Example executables are built by default; disable with
-DMARINHO_LAB_SAS_CORE_BUILD_EXAMPLES=OFF.
- Eigen3:
- Ubuntu:
apt-get install libeigen3-dev - macOS:
brew install eigen - Windows:
vcpkg install eigen3
- Ubuntu:
- dqrobotics:
- Ubuntu: from the DQ Robotics PPA
(
add-apt-repository ppa:dqrobotics-dev/development && apt-get install libdqrobotics) - macOS / Windows: build from
dqrobotics/cpp with CMake
(
cmake -S cpp -B cpp/build && cmake --build cpp/build && cmake --install cpp/build)
- Ubuntu: from the DQ Robotics PPA
(
- Note: the dqrobotics headers use
<Eigen/Dense>without theeigen3/prefix; if that does not resolve on your system, create the symlinkln -s /usr/include/eigen3/Eigen /usr/include/Eigen(Ubuntu only).
find_package(marinholab_sas_core REQUIRED)
target_link_libraries(your_target marinholab::sas::core)#include <marinholab/sas/core/sas_clock.hpp>
marinholab::sas::core::Clock clock(0.01);Or as a subdirectory / FetchContent dependency:
include(FetchContent)
FetchContent_Declare(
marinholab_sas_core
GIT_REPOSITORY https://github.com/MarinhoLab/sas_cpp.git
GIT_TAG main
)
FetchContent_MakeAvailable(marinholab_sas_core)
target_link_libraries(your_target marinholab::sas::core)Run them after building (all are bounded; they exit on their own):
./build/sas_core_example
./build/sas_clock_example
./build/sas_clock_sched_fifo_example
./build/thread_manager_example
./build/sas_robot_driver_exampleBuild the .deb with the usual command:
bash tools/bump-changelog.sh # align the changelog with the rolling version
dpkg-buildpackage -us -uc -bThis produces ../libmarinholab-sas-core_<version>_<arch>.deb containing the
shared library, the headers under /usr/include/marinholab/sas/core/ and the
CMake package configuration under /usr/lib/cmake/marinholab_sas_core/, so
installed consumers can find_package(marinholab_sas_core).
A full build-and-test environment on ubuntu:noble (CMake build, running all
examples, the static-library toggle, and the Debian package) lives in
docker/:
cd docker
docker compose run --rm marinholab_sas_core