A modern C++ library for control systems: from classic transfer-function workflows to state-space, estimators, and optimal control. Design continuous or discrete controllers, run time-variant logic, and bring in LQR, Kalman filtering, and even H₂ synthesis building blocks.
- Transfer Functions
Work directly with continuous and discrete transfer functions, numerator/denominator polynomials, zeros/poles, and conversions. - State Space
Model systems in state-space or transfer functions - Continuous <--> Discrete transformations
Switch domains as needed with zero order hold or tustin in a type save manner:
s -- zero-order hold --> z -- inverser-bilinear (tustin) --> q -- bilinear (tustin) --> z - Time-Variant Controllers
Have high jitter or changing sampling rates? E.g.: Controlling with a sensor (e.g.: camera) that changes its and sampling rate (ROI)? The time variant controllers offer you two inputs: the value and the sample-time. - Modern Controllers & Optimal Control
Includes linear-quadratic controller support and estimation tooling (LQR / Kalman), with room to extend into H2/H-inf synthesis. - Identification & Estimation Recursive Least Squares and Kalman filters to estimate parameters and states, ready to slot into your controller pipelines.
Read more about CMake (build file generator) CPM.cmake (package manager) here.
# include the package manager
include(cmake/CPM.cmake)
# add the package
CPMAddPackage("gh:TobiasWallner/Controlpp#main")
# create your project executable
add_executable(my_app src/main.cpp)
# link the library
target_link_libraries(my_app PRIVATE controlpp)
#include <controlpp.hpp>
int main(){
const auto s controlpp::tf::s<float>;
// define a PT2 element:
const float f = 1000;
const float omega = 2 * 3.1415 * f;
const float D = 0.3;
const auto PT2_s = 1 / (1 + 2 * D * s / omega + (s * s) / (omega * omega));
// convert from transfer function to state space
const auto PT2_ss = to_state_space(PT2_s);
// convert from s (continuous) to z (discrete) domain
const float Ts = 1.0/10'000.0;
const auto PT2_z = s_to_z(PT2_ss, Ts);
}
Add to ~/.bashrc
, ~/.zshrc
or the config script of your terminal:
export CC=/path/to/gcc
export CXX=/path/to/g++
likely path: /usr/bin/
.
add the environment variables
setx CC "\path\to\gcc.exe"
setx CXX "\path\to\g++.exe"
likely path: C:\mingw64\bin\
or C:\Program Files\LLVM\bin\
.
Add to ~/.bashrc
, ~/.zshrc
or the config script of your terminal:
export CMAKE_GENERATOR="Ninja Multi-Config"
Add the environment variable
setx CMAKE_GENERATOR "Ninja Multi-Config"
Add to ~/.bashrc
, ~/.zshrc
or the config script of your terminal:
export CPM_SOURCE_CACHE=$HOME/.cache/CPM
Add the environment variable
setx CPM_SOURCE_CACHE "%USERPROFILE%\.cache\CPM"