2024-01-10 18:27:25 +08:00
|
|
|
//
|
2024-03-06 19:44:56 +08:00
|
|
|
// Created by SJQ on 2024/3/2.
|
2024-01-10 18:27:25 +08:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef WHEEL_LEGGED_LQR_H
|
|
|
|
#define WHEEL_LEGGED_LQR_H
|
|
|
|
|
2024-03-06 19:44:56 +08:00
|
|
|
#include <matrix.h>
|
|
|
|
template <int _state,int _control>
|
|
|
|
class LQR {
|
|
|
|
public:
|
|
|
|
LQR(){};
|
|
|
|
void update(float* new_state,float* target_state);
|
|
|
|
void set_k(float *K_value);
|
|
|
|
Matrixf<_control,1> get_control();
|
|
|
|
private:
|
|
|
|
Matrixf<_state,1> state_vec_;
|
2024-01-10 18:27:25 +08:00
|
|
|
|
2024-03-06 19:44:56 +08:00
|
|
|
Matrixf<_state,1> state_cmd_;
|
|
|
|
Matrixf<_control,1> control_vec_;
|
2024-01-10 18:27:25 +08:00
|
|
|
|
2024-03-06 19:44:56 +08:00
|
|
|
Matrixf<_control,_state> K_;
|
|
|
|
};
|
2024-01-10 18:27:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif //WHEEL_LEGGED_LQR_H
|