26 const float thrust_scale,
32 const float arm_scale =
radians(5000);
33 const float yaw_scale =
radians(400);
42 thrust(0, 0, -motor_speed);
48 float roll = 0, pitch = 0;
75 thrust = rotation * thrust;
76 rotor_torque = rotation * rotor_torque;
80 rot_accel = (arm % thrust) + rotor_torque;
83 thrust = thrust * thrust_scale;
98 }
else if (demand < 1300) {
107 float max_change = 1000 * (dt /
servo_rate) * 60.0
f / 90.0
f;
108 last_value =
constrain_float(demand, last_value-max_change, last_value+max_change);
109 return uint16_t(last_value+0.5);
int16_t constrain_int16(const int16_t amt, const int16_t low, const int16_t high)
void from_euler(float roll, float pitch, float yaw)
void calculate_forces(const Aircraft::sitl_input &input, float thrust_scale, uint8_t motor_offset, Vector3f &rot_accel, Vector3f &body_thrust)
bool is_zero(const T fVal1)
enum SITL::Motor::@208 servo_type
float constrain_float(const float amt, const float low, const float high)
static constexpr float radians(float deg)
uint16_t update_servo(uint16_t demand, uint64_t time_usec, float &last_value)
uint64_t last_change_usec