This C++ package implements the exponentially stable robust following controller for Data-Driven and Robust Path-following Control of a Quadrotor Slung Load Transport System.
The only dependency of the main controller library is the Eigen linear algebra library. You can install it with
sudo apt-get install libeigen3-dev
The tests additionally depend on Googletest and rapidjson. You can install each of these libraries with
sudo apt-get install rapidjson-dev
sudo apt-get install libgtest-dev
At the root of this package, run
cmake -S . -B build --preset=ci-ubuntu # Or some entry from your CMakeUserPresets.json
cmake --build build --config Release
sudo cmake --install build
Tests are not built by default. Testing is covered in tests/testing.md
.
This section walks you through how to use this controller library in your C++ code.
-
Find this package and link your executable to it in CMake. NOTE: Target name is
slts_control::slts_controller
find_package(slts_control REQUIRED) add_executable(my_controller path/to/my_controller.cpp) target_link_libraries(my_controller slts_control::slts_controller)
-
Include the required headers
#include "slts_control/definitions.h" #include "slts_control/robust_tracker.h"
-
Construct the controller object
control::SLTSController ctl;
-
Construct the parameter structure and load it into the controller
control::SLTSController::Params params; params.uav_mass = 1.0; params.pld_mass = 0.5; // Fill in other fields if (!ctl.loadParams(params)) { // Handle the error appropriately }
-
Optionally also load initial conditions
control::SLTSController::InitialConditions ics; ics.uav_pos << 0.0, 0.0, 0.5; // Fill in other fields if (!ctl.setInitialConditions(ics)) { // Handle the error appropriately }
-
-
Run the following functions upon each sensor update
-
Update UAV position
ctl.uav_pos() = gps_pos_reading;
-
Update UAV velocity
ctl.uav_vel() = gps_vel_reading:
-
Update UAV acceleration (Earth frame!!!)
ctl.uav_acc() = rotation_body_to_earth * imu_acc_reading;
-
Update vehicle actual thrust estimation.
Good if you have instrumented motors and ESCs. If not, use the thrust magnitude, multiplied by the body-Z axis of the UAV
ctl.thrust_act() = motor_thrust;
-
Update payload position relative to UAV. Run either:
// This function uses numerical differentiation to compute payload velocity relative // to UAV ctl.setPayloadRelativePosition( dt, // Time interval for numerical differentiation pld_rel_pos, // Payload position relative to UAV control::NumDiffMode::Forward); // Mode of numerical differentiation
or
// This function sets payload relative position AND velocity, assuming payload // relative velocity is computed by some other means, e.g. optical flow or a // state estimator ctl.setPayloadRelativePositionAndVelocity(pld_rel_pos, pld_rel_vel);
-
-
Set translational errors
ctl.setPayloadTranslationalErrors( pld_pos_err, // Payload positional error pld_pos_err_rates, // Derivative of payload position error (can be zeroed // for little performance penalty) pld_vel_err, // Payload velocity error pld_vel_sp); // Payload velocity setpoint
-
Run the main function in a control loop
tracker.computeControlOutput(dt);
-
Read the thrust setpoint and forward it to actuators in the actuator loop
const Eigen::Vector3d thrust_setpoint = ctl.thrust_sp(); motors.setThrust(thrust_setpoint); // Some magical actuator function
Often it is necessary to convert the 3D thrust setpoint to a desired thrusting orientation and a scalar thrust value. Equation (11) in our paper tells you how to do that
Refer to docs/formula_reference.pdf