|
bitsim
Model, simulate, estimate and control robots in C++
|
#include "bitsim/bitsim_config.h"#include "bitsim/bitsim_types.h"#include "bitsim/control/linear_mpc.h"#include "bitsim/control/lqr.h"#include "bitsim/dynamics/cart_pole_dynamics.h"#include <opencv2/imgcodecs.hpp>#include <opencv2/imgproc.hpp>#include <algorithm>#include <cmath>#include <cstdio>#include <filesystem>#include <iostream>#include <limits>#include <string>#include <vector>
Classes | |
| struct | cart_pole_lqr_mpc::Run |
| class | cart_pole_lqr_mpc::CartPoleDynamics |
| A cart on a straight track, pushed by a horizontal force F, with a pole hinged on it. More... | |
| struct | cart_pole_lqr_mpc::CartPoleParameters |
| The cart and the pole. The defaults are those of the classic cart-pole of Barto, Sutton and Anderson (1983), which Gymnasium's CartPole uses too. More... | |
Namespaces | |
| namespace | cart_pole_lqr_mpc |
Typedefs | |
| using | cart_pole_lqr_mpc::real_t |
| real_t | |
| using | cart_pole_lqr_mpc::RealColVec4d |
| 4D column vector | |
| using | cart_pole_lqr_mpc::uint_t |
| uint_t | |
| using | cart_pole_lqr_mpc::Matrix |
| The matrices of the linear models and the controllers. | |
| using | cart_pole_lqr_mpc::Vector |
| The vectors of the linear models and the controllers: states, inputs. | |
| using | cart_pole_lqr_mpc::CartPoleState |
| The state: the position of the cart [m], its velocity [m/s], the angle of the pole from upright [rad], positive when it leans towards +x, and its rate [rad/s]. | |
Functions | |
| Matrix | cart_pole_lqr_mpc::state_weights () |
| Matrix | cart_pole_lqr_mpc::input_weights () |
| CartPoleState | cart_pole_lqr_mpc::start () |
| template<typename Controller> | |
| Run | cart_pole_lqr_mpc::simulate (const std::string &name, Controller &&controller) |
| void | cart_pole_lqr_mpc::print (const Run &run) |
| cv::Mat | cart_pole_lqr_mpc::draw (const std::vector< Run > &runs, uint_t k, const CartPoleParameters &p) |
| void | cart_pole_lqr_mpc::record (const std::vector< Run > &runs, const std::string &directory) |
| int | main (int argc, char **argv) |
Variables | |
| const real_t | cart_pole_lqr_mpc::DT = 0.02 |
| const real_t | cart_pole_lqr_mpc::DURATION = 6.0 |
| const real_t | cart_pole_lqr_mpc::X0 = 1.5 |
| const real_t | cart_pole_lqr_mpc::THETA0 = 0.4 |
| const real_t | cart_pole_lqr_mpc::TRACK_BOUND = 2.3 |
| const uint_t | cart_pole_lqr_mpc::HORIZON = 40 |
| const real_t | cart_pole_lqr_mpc::PENALTY = 1000.0 |
| const real_t | cart_pole_lqr_mpc::RECORD_RATE = 25.0 |
| int main | ( | int | argc, |
| char ** | argv ) |