2017-02-10 01:26:12 -04:00
|
|
|
/// @file AP_MotorsTailsitter.h
|
2018-10-21 14:54:30 -03:00
|
|
|
/// @brief Motor control class for tailsitters and bicopters
|
2017-02-10 01:26:12 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
#include <AP_Math/AP_Math.h>
|
|
|
|
#include <SRV_Channel/SRV_Channel.h>
|
|
|
|
#include "AP_MotorsMulticopter.h"
|
|
|
|
|
|
|
|
/// @class AP_MotorsTailsitter
|
|
|
|
class AP_MotorsTailsitter : public AP_MotorsMulticopter {
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Constructor
|
2022-12-06 21:03:36 -04:00
|
|
|
AP_MotorsTailsitter(uint16_t speed_hz = AP_MOTORS_SPEED_DEFAULT);
|
2017-02-10 01:26:12 -04:00
|
|
|
|
|
|
|
// init
|
2018-11-07 07:00:51 -04:00
|
|
|
void init(motor_frame_class frame_class, motor_frame_type frame_type) override;
|
2017-02-10 01:26:12 -04:00
|
|
|
|
|
|
|
// set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus)
|
2018-11-07 07:00:51 -04:00
|
|
|
void set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) override {}
|
2017-02-10 01:26:12 -04:00
|
|
|
|
2018-10-21 14:54:30 -03:00
|
|
|
// set update rate to motors - a value in hertz
|
|
|
|
void set_update_rate( uint16_t speed_hz ) override;
|
|
|
|
|
2017-02-10 01:26:12 -04:00
|
|
|
// output_to_motors - sends output to named servos
|
2018-11-07 07:00:51 -04:00
|
|
|
void output_to_motors() override;
|
2017-02-10 01:26:12 -04:00
|
|
|
|
2018-10-21 14:54:30 -03:00
|
|
|
// get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used)
|
|
|
|
// this can be used to ensure other pwm outputs (i.e. for servos) do not conflict
|
2021-12-10 12:45:20 -04:00
|
|
|
uint32_t get_motor_mask() override;
|
2017-02-10 01:26:12 -04:00
|
|
|
|
2021-11-14 15:16:22 -04:00
|
|
|
// Set by tailsitters using diskloading minumum outflow velocity limit
|
|
|
|
void set_min_throttle(float val) {_external_min_throttle = val;}
|
|
|
|
|
2017-02-10 01:26:12 -04:00
|
|
|
protected:
|
|
|
|
// calculate motor outputs
|
2018-11-07 07:00:51 -04:00
|
|
|
void output_armed_stabilizing() override;
|
2017-02-10 01:26:12 -04:00
|
|
|
|
2022-01-01 11:55:34 -04:00
|
|
|
const char* _get_frame_string() const override { return "TAILSITTER"; }
|
|
|
|
|
2022-01-27 11:37:06 -04:00
|
|
|
// spin a motor at the pwm value specified
|
|
|
|
void _output_test_seq(uint8_t motor_seq, int16_t pwm) override;
|
|
|
|
|
2017-02-10 01:26:12 -04:00
|
|
|
// calculated outputs
|
|
|
|
float _throttle; // 0..1
|
2018-10-21 14:54:30 -03:00
|
|
|
float _tilt_left; // -1..1
|
|
|
|
float _tilt_right; // -1..1
|
|
|
|
float _thrust_left; // 0..1
|
|
|
|
float _thrust_right; // 0..1
|
2021-11-14 15:16:22 -04:00
|
|
|
|
|
|
|
// Set by tailsitters using diskloading minumum outflow velocity limit
|
|
|
|
float _external_min_throttle;
|
|
|
|
|
|
|
|
// true if differential thrust is available
|
|
|
|
bool _has_diff_thrust;
|
|
|
|
|
2017-02-10 01:26:12 -04:00
|
|
|
};
|