#define THROTTLE_CURVE_ENABLED 1 // throttle curve disabled by default
#define THROTTLE_CURVE_MID_THRUST 52 // throttle which produces 1/2 the maximum thrust. expressed as a percentage of the full throttle range (i.e 0 ~ 100)
#define THROTTLE_CURVE_MAX_THRUST 93 // throttle which produces the maximum thrust. expressed as a percentage of the full throttle range (i.e 0 ~ 100)
// bit mask for recording which limits we have reached when outputting to motors
// enable - starts allowing signals to be sent to motors
virtualvoidenable(){
};
// arm, disarm or check status status of motors
virtualboolarmed(){
return_armed;
};
virtualvoidarmed(boolarm){
_armed=arm;
};
// check or set status of auto_armed - controls whether autopilot can take control of throttle
// Note: this should probably be moved out of this class as it has little to do with the motors
virtualboolauto_armed(){
return_auto_armed;
};
virtualvoidauto_armed(boolarm){
_auto_armed=arm;
};
// set_min_throttle - sets the minimum throttle that will be sent to the engines when they're not off (i.e. to prevents issues with some motors spinning and some not at very low throttle)
// throttle_pass_through - passes throttle through to motors - dangerous but required for initialising ESCs
virtualvoidthrottle_pass_through();
// setup_throttle_curve - used to linearlise thrust output by motors
// returns true if curve is created successfully
virtualboolsetup_throttle_curve();
// 1 if motor is enabled, 0 otherwise
AP_Int8motor_enabled[AP_MOTORS_MAX_NUM_MOTORS];
// final output values sent to the motors. public (for now) so that they can be access for logging
int16_tmotor_out[AP_MOTORS_MAX_NUM_MOTORS];
// power ratio of upper vs lower motors (only used by y6 and octa quad copters)
AP_Floattop_bottom_ratio;
// var_info for holding Parameter information
staticconststructAP_Param::GroupInfovar_info[];
protected:
// output functions that should be overloaded by child classes
virtualvoidoutput_armed(){
};
virtualvoidoutput_disarmed(){
};
RC_Channel*_rc_roll,*_rc_pitch,*_rc_throttle,*_rc_yaw;// input in from users
uint8_t_motor_to_channel_map[AP_MOTORS_MAX_NUM_MOTORS];// mapping of motor number (as received from upper APM code) to RC channel output - used to account for differences between APM1 and APM2
uint16_t_speed_hz;// speed in hz to send updates to motors
bool_armed;// true if motors are armed
bool_auto_armed;// true is throttle is above zero, allows auto pilot to take control of throttle
int16_t_min_throttle;// the minimum throttle to be sent to the engines when they're on (prevents issues with some motors on while other off at very low throttle)
int16_t_max_throttle;// the minimum throttle to be sent to the engines when they're on (prevents issues with some motors on while other off at very low throttle)
AP_CurveInt16_Size4_throttle_curve;// curve used to linearize the pwm->thrust
AP_Int8_throttle_curve_mid;// throttle which produces 1/2 the maximum thrust. expressed as a percentage (i.e. 0 ~ 100 ) of the full throttle range
AP_Int8_throttle_curve_max;// throttle which produces the maximum thrust. expressed as a percentage (i.e. 0 ~ 100 ) of the full throttle range
uint8_t_reached_limit;// bit mask to record which motor limits we hit (if any) during most recent output. Used to provide feedback to attitude controllers