mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-12 02:48:28 -04:00
Copter: formatting fixes
This commit is contained in:
parent
6e76dff930
commit
593925567b
@ -999,11 +999,11 @@ void Copter::ModeAuto::payload_place_run()
|
|||||||
|
|
||||||
bool Copter::ModeAuto::payload_place_run_should_run()
|
bool Copter::ModeAuto::payload_place_run_should_run()
|
||||||
{
|
{
|
||||||
// muts be armed
|
// must be armed
|
||||||
if (!motors->armed()) {
|
if (!motors->armed()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// muts be auto-armed
|
// must be auto-armed
|
||||||
if (!ap.auto_armed) {
|
if (!ap.auto_armed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@ void Copter::ModeBrake::run()
|
|||||||
// call attitude controller
|
// call attitude controller
|
||||||
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(wp_nav->get_roll(), wp_nav->get_pitch(), 0.0f);
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(wp_nav->get_roll(), wp_nav->get_pitch(), 0.0f);
|
||||||
|
|
||||||
// body-frame rate controller is run directly from 100hz loop
|
|
||||||
|
|
||||||
// update altitude target and call position controller
|
// update altitude target and call position controller
|
||||||
// protects heli's from inflight motor interlock disable
|
// protects heli's from inflight motor interlock disable
|
||||||
if (motors->get_desired_spool_state() == AP_Motors::DESIRED_GROUND_IDLE && !ap.land_complete) {
|
if (motors->get_desired_spool_state() == AP_Motors::DESIRED_GROUND_IDLE && !ap.land_complete) {
|
||||||
|
@ -64,7 +64,7 @@ void Copter::ModeCircle::run()
|
|||||||
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(copter.circle_nav->get_roll(),
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(copter.circle_nav->get_roll(),
|
||||||
copter.circle_nav->get_pitch(),
|
copter.circle_nav->get_pitch(),
|
||||||
target_yaw_rate);
|
target_yaw_rate);
|
||||||
}else{
|
} else {
|
||||||
attitude_control->input_euler_angle_roll_pitch_yaw(copter.circle_nav->get_roll(),
|
attitude_control->input_euler_angle_roll_pitch_yaw(copter.circle_nav->get_roll(),
|
||||||
copter.circle_nav->get_pitch(),
|
copter.circle_nav->get_pitch(),
|
||||||
copter.circle_nav->get_yaw(), true);
|
copter.circle_nav->get_yaw(), true);
|
||||||
|
@ -52,7 +52,7 @@ void Copter::ModeDrift::run()
|
|||||||
float roll_vel = vel.y * ahrs.cos_yaw() - vel.x * ahrs.sin_yaw(); // body roll vel
|
float roll_vel = vel.y * ahrs.cos_yaw() - vel.x * ahrs.sin_yaw(); // body roll vel
|
||||||
float pitch_vel = vel.y * ahrs.sin_yaw() + vel.x * ahrs.cos_yaw(); // body pitch vel
|
float pitch_vel = vel.y * ahrs.sin_yaw() + vel.x * ahrs.cos_yaw(); // body pitch vel
|
||||||
|
|
||||||
// gain sceduling for Yaw
|
// gain scheduling for yaw
|
||||||
float pitch_vel2 = MIN(fabsf(pitch_vel), 2000);
|
float pitch_vel2 = MIN(fabsf(pitch_vel), 2000);
|
||||||
float target_yaw_rate = ((float)target_roll/1.0f) * (1.0f - (pitch_vel2 / 5000.0f)) * g.acro_yaw_p;
|
float target_yaw_rate = ((float)target_roll/1.0f) * (1.0f - (pitch_vel2 / 5000.0f)) * g.acro_yaw_p;
|
||||||
|
|
||||||
@ -61,20 +61,20 @@ void Copter::ModeDrift::run()
|
|||||||
|
|
||||||
roll_input = roll_input * .96f + (float)channel_yaw->get_control_in() * .04f;
|
roll_input = roll_input * .96f + (float)channel_yaw->get_control_in() * .04f;
|
||||||
|
|
||||||
//convert user input into desired roll velocity
|
// convert user input into desired roll velocity
|
||||||
float roll_vel_error = roll_vel - (roll_input / DRIFT_SPEEDGAIN);
|
float roll_vel_error = roll_vel - (roll_input / DRIFT_SPEEDGAIN);
|
||||||
|
|
||||||
// Roll velocity is feed into roll acceleration to minimize slip
|
// roll velocity is feed into roll acceleration to minimize slip
|
||||||
target_roll = roll_vel_error * -DRIFT_SPEEDGAIN;
|
target_roll = roll_vel_error * -DRIFT_SPEEDGAIN;
|
||||||
target_roll = constrain_float(target_roll, -4500.0f, 4500.0f);
|
target_roll = constrain_float(target_roll, -4500.0f, 4500.0f);
|
||||||
|
|
||||||
// If we let go of sticks, bring us to a stop
|
// If we let go of sticks, bring us to a stop
|
||||||
if(is_zero(target_pitch)){
|
if (is_zero(target_pitch)) {
|
||||||
// .14/ (.03 * 100) = 4.6 seconds till full braking
|
// .14/ (.03 * 100) = 4.6 seconds till full braking
|
||||||
braker += .03f;
|
braker += .03f;
|
||||||
braker = MIN(braker, DRIFT_SPEEDGAIN);
|
braker = MIN(braker, DRIFT_SPEEDGAIN);
|
||||||
target_pitch = pitch_vel * braker;
|
target_pitch = pitch_vel * braker;
|
||||||
}else{
|
} else {
|
||||||
braker = 0.0f;
|
braker = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ void Copter::ModeFlowHold::run()
|
|||||||
copter.pos_control->set_max_accel_z(copter.g.pilot_accel_z);
|
copter.pos_control->set_max_accel_z(copter.g.pilot_accel_z);
|
||||||
|
|
||||||
// apply SIMPLE mode transform to pilot inputs
|
// apply SIMPLE mode transform to pilot inputs
|
||||||
copter.update_simple_mode();
|
update_simple_mode();
|
||||||
|
|
||||||
// check for filter change
|
// check for filter change
|
||||||
if (!is_equal(flow_filter.get_cutoff_freq(), flow_filter_hz.get())) {
|
if (!is_equal(flow_filter.get_cutoff_freq(), flow_filter_hz.get())) {
|
||||||
|
@ -103,7 +103,7 @@ bool Copter::ModePosHold::init(bool ignore_checks)
|
|||||||
// if landed begin in loiter mode
|
// if landed begin in loiter mode
|
||||||
poshold.roll_mode = POSHOLD_LOITER;
|
poshold.roll_mode = POSHOLD_LOITER;
|
||||||
poshold.pitch_mode = POSHOLD_LOITER;
|
poshold.pitch_mode = POSHOLD_LOITER;
|
||||||
}else{
|
} else {
|
||||||
// if not landed start in pilot override to avoid hard twitch
|
// if not landed start in pilot override to avoid hard twitch
|
||||||
poshold.roll_mode = POSHOLD_PILOT_OVERRIDE;
|
poshold.roll_mode = POSHOLD_PILOT_OVERRIDE;
|
||||||
poshold.pitch_mode = POSHOLD_PILOT_OVERRIDE;
|
poshold.pitch_mode = POSHOLD_PILOT_OVERRIDE;
|
||||||
|
@ -46,8 +46,6 @@ void Copter::ModeStabilize::run()
|
|||||||
// call attitude controller
|
// call attitude controller
|
||||||
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(target_roll, target_pitch, target_yaw_rate);
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(target_roll, target_pitch, target_yaw_rate);
|
||||||
|
|
||||||
// body-frame rate controller is run directly from 100hz loop
|
|
||||||
|
|
||||||
// output pilot's throttle
|
// output pilot's throttle
|
||||||
attitude_control->set_throttle_out(get_pilot_desired_throttle(),
|
attitude_control->set_throttle_out(get_pilot_desired_throttle(),
|
||||||
true,
|
true,
|
||||||
|
Loading…
Reference in New Issue
Block a user