2017-08-26 08:53:53 -03:00
|
|
|
/// @file AP_MotorsHeli_Quad.h
|
|
|
|
/// @brief Motor control class collective pitch quad helicopter (such as stingray)
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
#include <AP_Math/AP_Math.h>
|
|
|
|
#include <RC_Channel/RC_Channel.h>
|
|
|
|
|
|
|
|
#include "AP_MotorsHeli.h"
|
|
|
|
#include "AP_MotorsHeli_RSC.h"
|
|
|
|
|
|
|
|
// default collective min, max and midpoints for the rear swashplate
|
|
|
|
#define AP_MOTORS_HELI_QUAD_COLLECTIVE_MIN 1100
|
|
|
|
#define AP_MOTORS_HELI_QUAD_COLLECTIVE_MAX 1900
|
|
|
|
|
|
|
|
#define AP_MOTORS_HELI_QUAD_NUM_MOTORS 4
|
|
|
|
|
|
|
|
class AP_MotorsHeli_Quad : public AP_MotorsHeli {
|
|
|
|
public:
|
|
|
|
// constructor
|
2022-12-06 21:03:36 -04:00
|
|
|
AP_MotorsHeli_Quad(uint16_t speed_hz = AP_MOTORS_HELI_SPEED_DEFAULT) :
|
|
|
|
AP_MotorsHeli(speed_hz)
|
2017-08-26 08:53:53 -03:00
|
|
|
{
|
|
|
|
AP_Param::setup_object_defaults(this, var_info);
|
|
|
|
};
|
|
|
|
|
|
|
|
// set_update_rate - set update rate to motors
|
|
|
|
void set_update_rate( uint16_t speed_hz ) override;
|
|
|
|
|
2018-12-28 02:32:05 -04:00
|
|
|
// output_to_motors - sends values out to the motors
|
|
|
|
void output_to_motors() override;
|
|
|
|
|
2017-08-26 08:53:53 -03:00
|
|
|
// calculate_scalars - recalculates various scalars used
|
|
|
|
void calculate_scalars() override;
|
|
|
|
|
|
|
|
// calculate_armed_scalars - recalculates scalars that can change while armed
|
|
|
|
void calculate_armed_scalars() override;
|
|
|
|
|
|
|
|
// servo_test - move servos through full range of movement
|
|
|
|
void servo_test() override;
|
|
|
|
|
2024-08-06 11:59:17 -03:00
|
|
|
#if HAL_LOGGING_ENABLED
|
|
|
|
// heli motors logging - called at 10 Hz
|
|
|
|
void Log_Write(void) override;
|
|
|
|
#endif
|
|
|
|
|
2017-08-26 08:53:53 -03:00
|
|
|
// var_info for holding Parameter information
|
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// init_outputs
|
2023-06-30 15:32:10 -03:00
|
|
|
void init_outputs () override;
|
2017-08-26 08:53:53 -03:00
|
|
|
|
|
|
|
// update_motor_controls - sends commands to motor controllers
|
2023-12-12 22:52:56 -04:00
|
|
|
void update_motor_control(AP_MotorsHeli_RSC::RotorControlState state) override;
|
2017-08-26 08:53:53 -03:00
|
|
|
|
|
|
|
// calculate_roll_pitch_collective_factors - setup rate factors
|
2019-01-12 00:17:15 -04:00
|
|
|
void calculate_roll_pitch_collective_factors ();
|
2017-08-26 08:53:53 -03:00
|
|
|
|
|
|
|
// move_actuators - moves swash plate to attitude of parameters passed in
|
|
|
|
void move_actuators(float roll_out, float pitch_out, float coll_in, float yaw_out) override;
|
|
|
|
|
2022-01-01 11:55:34 -04:00
|
|
|
const char* _get_frame_string() const override { return "HELI_QUAD"; }
|
|
|
|
|
2017-08-26 08:53:53 -03:00
|
|
|
// rate factors
|
|
|
|
float _rollFactor[AP_MOTORS_HELI_QUAD_NUM_MOTORS];
|
|
|
|
float _pitchFactor[AP_MOTORS_HELI_QUAD_NUM_MOTORS];
|
|
|
|
float _collectiveFactor[AP_MOTORS_HELI_QUAD_NUM_MOTORS];
|
|
|
|
float _yawFactor[AP_MOTORS_HELI_QUAD_NUM_MOTORS];
|
2018-12-28 02:32:05 -04:00
|
|
|
float _out[AP_MOTORS_HELI_QUAD_NUM_MOTORS];
|
2017-08-26 08:53:53 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|