Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AC_AttitudeControl/AC_AttitudeControl_Multi_6DoF.h
Views: 1798
#pragma once1#if AP_SCRIPTING_ENABLED23#include "AC_AttitudeControl_Multi.h"45class AC_AttitudeControl_Multi_6DoF : public AC_AttitudeControl_Multi {6public:7AC_AttitudeControl_Multi_6DoF(AP_AHRS_View &ahrs, const AP_MultiCopter &aparm, AP_MotorsMulticopter& motors):8AC_AttitudeControl_Multi(ahrs,aparm,motors) {910if (_singleton != nullptr) {11AP_HAL::panic("Can only be one AC_AttitudeControl_Multi_6DoF");12}13_singleton = this;14}1516static AC_AttitudeControl_Multi_6DoF *get_singleton() {17return _singleton;18}1920// Command a Quaternion attitude with feedforward and smoothing21// attitude_desired_quat: is updated on each time_step (_dt) by the integral of the angular velocity22void input_quaternion(Quaternion& attitude_desired_quat, Vector3f ang_vel_body) override;23/*24override input functions to attitude controller and convert desired angles into thrust angles and substitute for offset angles25*/2627// Command an euler roll and pitch angle and an euler yaw rate with angular velocity feedforward and smoothing28void input_euler_angle_roll_pitch_euler_rate_yaw(float euler_roll_angle_cd, float euler_pitch_angle_cd, float euler_yaw_rate_cds) override;2930// Command an euler roll, pitch and yaw angle with angular velocity feedforward and smoothing31void input_euler_angle_roll_pitch_yaw(float euler_roll_angle_cd, float euler_pitch_angle_cd, float euler_yaw_angle_cd, bool slew_yaw) override;3233// Command a thrust vector in the earth frame and a heading angle and/or rate34void input_thrust_vector_rate_heading(const Vector3f& thrust_vector, float heading_rate_cds, bool slew_yaw = true) override;35void input_thrust_vector_heading(const Vector3f& thrust_vector, float heading_angle_cd, float heading_rate_cds) override;3637/*38all other input functions should zero thrust vectoring and behave as a normal copter39*/4041// Command euler yaw rate and pitch angle with roll angle specified in body frame42// (used only by tailsitter quadplanes)43void input_euler_rate_yaw_euler_angle_pitch_bf_roll(bool plane_controls, float euler_roll_angle_cd, float euler_pitch_angle_cd, float euler_yaw_rate_cds) override;4445// Command an euler roll, pitch, and yaw rate with angular velocity feedforward and smoothing46void input_euler_rate_roll_pitch_yaw(float euler_roll_rate_cds, float euler_pitch_rate_cds, float euler_yaw_rate_cds) override;4748// Command an angular velocity with angular velocity feedforward and smoothing49void input_rate_bf_roll_pitch_yaw(float roll_rate_bf_cds, float pitch_rate_bf_cds, float yaw_rate_bf_cds) override;5051// Command an angular velocity with angular velocity feedforward and smoothing52void input_rate_bf_roll_pitch_yaw_2(float roll_rate_bf_cds, float pitch_rate_bf_cds, float yaw_rate_bf_cds) override;5354// Command an angular velocity with angular velocity smoothing using rate loops only with integrated rate error stabilization55void input_rate_bf_roll_pitch_yaw_3(float roll_rate_bf_cds, float pitch_rate_bf_cds, float yaw_rate_bf_cds) override;5657// Command an angular step (i.e change) in body frame angle58void input_angle_step_bf_roll_pitch_yaw(float roll_angle_step_bf_cd, float pitch_angle_step_bf_cd, float yaw_angle_step_bf_cd) override;5960// run lowest level body-frame rate controller and send outputs to the motors61void rate_controller_run() override;6263// limiting lean angle based on throttle makes no sense for 6DoF, always allow 90 deg, return in centi-degrees64float get_althold_lean_angle_max_cd() const override { return 9000.0f; }6566// set the attitude that will be used in 6DoF flight67void set_offset_roll_pitch(float roll_deg, float pitch_deg) {68roll_offset_deg = roll_deg;69pitch_offset_deg = pitch_deg;70}7172// these flags enable or disable lateral or forward thrust, with both disabled the vehicle acts like a traditional copter73// it will roll and pitch to move, its also possible to enable only forward or lateral to suit the vehicle configuration.74// by default the vehicle is full 6DoF, these can be set in flight via scripting75void set_forward_enable(bool b) {76forward_enable = b;77}78void set_lateral_enable(bool b) {79lateral_enable = b;80}8182private:8384void set_forward_lateral(float &euler_pitch_angle_cd, float &euler_roll_angle_cd);8586float roll_offset_deg;87float pitch_offset_deg;8889bool forward_enable = true;90bool lateral_enable = true;9192static AC_AttitudeControl_Multi_6DoF *_singleton;9394};9596#endif // AP_SCRIPTING_ENABLED979899