Eigen
Dependencies: Eigen
Dependents: optWingforHAPS_Eigen
Autopilot.hpp
- Committer:
- NaotoMorita
- Date:
- 2021-11-19
- Revision:
- 8:7f3ff375fd30
- Parent:
- 6:1f5e6efff5b4
File content as of revision 8:7f3ff375fd30:
#ifndef __AUTOPILOT_HPP__ #define __AUTOPILOT_HPP__ #include "mbed.h" #include "Vector3.hpp" #include <cmath> #define M_PI 3.141592f #define G 9.8f class Autopilot { private: //観測値 float roll; float pitch; float yaw; float alt; Vector3 pos_ned; Vector3 vel_ned; //対地速度 //目標値 float roll_obj; float pitch_obj; float yaw_obj; float alt_obj; float vel_obj; //対地速度 float dT_obj; Vector3 destination; //誘導地点NED座標 Vector3 turn_center; //旋回中心NED座標 float turn_r; //旋回半径 void limit_obj(); float p_control(float diff, float kp); //比例制御(diff:目標値-現在値, kp:比例ゲイン) float angdiff_pi(float rad); //角度を[-pi, pi]の範囲で出力 float deg2rad(float deg); //degからradに変換 public: Autopilot(); void set_dest(float x, float y); //誘導地点の設定 void set_turn(float x, float y, float r); //定点旋回の設定 void set_alt(float alt, float vel); //高度,速度の設定 void update_val(const Vector3 rpy, const float altitude, const Vector3 pos, const Vector3 vel); //姿勢角等の更新 void level(); //水平飛行 void guide(); //定点誘導 void turn(); //定点旋回(時計回り) void keep_alt(); //高度,速度維持 void return_val(float &r_obj, float &p_obj, float &t_obj); //目標値を代入 }; #endif