mirror of https://github.com/ArduPilot/ardupilot
Copter: rename variable ROLL_PITCH_YAW_INPUT_MAX
No functional change
This commit is contained in:
parent
5a344b8487
commit
8cd8f0d570
|
@ -18,7 +18,7 @@ void Copter::get_pilot_desired_lean_angles(float roll_in, float pitch_in, float
|
||||||
angle_max = constrain_float(angle_max, 1000, aparm.angle_max);
|
angle_max = constrain_float(angle_max, 1000, aparm.angle_max);
|
||||||
|
|
||||||
// scale roll_in, pitch_in to ANGLE_MAX parameter range
|
// scale roll_in, pitch_in to ANGLE_MAX parameter range
|
||||||
float scaler = aparm.angle_max/(float)ROLL_PITCH_INPUT_MAX;
|
float scaler = aparm.angle_max/(float)ROLL_PITCH_YAW_INPUT_MAX;
|
||||||
roll_in *= scaler;
|
roll_in *= scaler;
|
||||||
pitch_in *= scaler;
|
pitch_in *= scaler;
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ float Copter::get_pilot_desired_yaw_rate(int16_t stick_angle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// yaw expo
|
// yaw expo
|
||||||
y_in = float(stick_angle)/ROLL_PITCH_INPUT_MAX;
|
y_in = float(stick_angle)/ROLL_PITCH_YAW_INPUT_MAX;
|
||||||
y_in3 = y_in*y_in*y_in;
|
y_in3 = y_in*y_in*y_in;
|
||||||
y_out = (g2.acro_y_expo * y_in3) + ((1.0f - g2.acro_y_expo) * y_in);
|
y_out = (g2.acro_y_expo * y_in3) + ((1.0f - g2.acro_y_expo) * y_in);
|
||||||
yaw_request = ROLL_PITCH_INPUT_MAX * y_out * g.acro_yaw_p;
|
yaw_request = ROLL_PITCH_YAW_INPUT_MAX * y_out * g.acro_yaw_p;
|
||||||
}
|
}
|
||||||
// convert pilot input to the desired yaw rate
|
// convert pilot input to the desired yaw rate
|
||||||
return yaw_request;
|
return yaw_request;
|
||||||
|
|
|
@ -508,8 +508,8 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Stabilize Rate Control
|
// Stabilize Rate Control
|
||||||
//
|
//
|
||||||
#ifndef ROLL_PITCH_INPUT_MAX
|
#ifndef ROLL_PITCH_YAW_INPUT_MAX
|
||||||
# define ROLL_PITCH_INPUT_MAX 4500 // roll, pitch input range
|
# define ROLL_PITCH_YAW_INPUT_MAX 4500 // roll, pitch and yaw input range
|
||||||
#endif
|
#endif
|
||||||
#ifndef DEFAULT_ANGLE_MAX
|
#ifndef DEFAULT_ANGLE_MAX
|
||||||
# define DEFAULT_ANGLE_MAX 4500 // ANGLE_MAX parameters default value
|
# define DEFAULT_ANGLE_MAX 4500 // ANGLE_MAX parameters default value
|
||||||
|
|
|
@ -62,8 +62,8 @@ void Copter::get_pilot_desired_angle_rates(int16_t roll_in, int16_t pitch_in, in
|
||||||
// apply circular limit to pitch and roll inputs
|
// apply circular limit to pitch and roll inputs
|
||||||
float total_in = norm(pitch_in, roll_in);
|
float total_in = norm(pitch_in, roll_in);
|
||||||
|
|
||||||
if (total_in > ROLL_PITCH_INPUT_MAX) {
|
if (total_in > ROLL_PITCH_YAW_INPUT_MAX) {
|
||||||
float ratio = (float)ROLL_PITCH_INPUT_MAX / total_in;
|
float ratio = (float)ROLL_PITCH_YAW_INPUT_MAX / total_in;
|
||||||
roll_in *= ratio;
|
roll_in *= ratio;
|
||||||
pitch_in *= ratio;
|
pitch_in *= ratio;
|
||||||
}
|
}
|
||||||
|
@ -82,16 +82,16 @@ void Copter::get_pilot_desired_angle_rates(int16_t roll_in, int16_t pitch_in, in
|
||||||
}
|
}
|
||||||
|
|
||||||
// roll expo
|
// roll expo
|
||||||
rp_in = float(roll_in)/ROLL_PITCH_INPUT_MAX;
|
rp_in = float(roll_in)/ROLL_PITCH_YAW_INPUT_MAX;
|
||||||
rp_in3 = rp_in*rp_in*rp_in;
|
rp_in3 = rp_in*rp_in*rp_in;
|
||||||
rp_out = (g.acro_rp_expo * rp_in3) + ((1.0f - g.acro_rp_expo) * rp_in);
|
rp_out = (g.acro_rp_expo * rp_in3) + ((1.0f - g.acro_rp_expo) * rp_in);
|
||||||
rate_bf_request.x = ROLL_PITCH_INPUT_MAX * rp_out * g.acro_rp_p;
|
rate_bf_request.x = ROLL_PITCH_YAW_INPUT_MAX * rp_out * g.acro_rp_p;
|
||||||
|
|
||||||
// pitch expo
|
// pitch expo
|
||||||
rp_in = float(pitch_in)/ROLL_PITCH_INPUT_MAX;
|
rp_in = float(pitch_in)/ROLL_PITCH_YAW_INPUT_MAX;
|
||||||
rp_in3 = rp_in*rp_in*rp_in;
|
rp_in3 = rp_in*rp_in*rp_in;
|
||||||
rp_out = (g.acro_rp_expo * rp_in3) + ((1.0f - g.acro_rp_expo) * rp_in);
|
rp_out = (g.acro_rp_expo * rp_in3) + ((1.0f - g.acro_rp_expo) * rp_in);
|
||||||
rate_bf_request.y = ROLL_PITCH_INPUT_MAX * rp_out * g.acro_rp_p;
|
rate_bf_request.y = ROLL_PITCH_YAW_INPUT_MAX * rp_out * g.acro_rp_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate yaw rate request
|
// calculate yaw rate request
|
||||||
|
|
|
@ -27,9 +27,9 @@ void Copter::init_rc_in()
|
||||||
channel_yaw = RC_Channel::rc_channel(rcmap.yaw()-1);
|
channel_yaw = RC_Channel::rc_channel(rcmap.yaw()-1);
|
||||||
|
|
||||||
// set rc channel ranges
|
// set rc channel ranges
|
||||||
channel_roll->set_angle(ROLL_PITCH_INPUT_MAX);
|
channel_roll->set_angle(ROLL_PITCH_YAW_INPUT_MAX);
|
||||||
channel_pitch->set_angle(ROLL_PITCH_INPUT_MAX);
|
channel_pitch->set_angle(ROLL_PITCH_YAW_INPUT_MAX);
|
||||||
channel_yaw->set_angle(4500);
|
channel_yaw->set_angle(ROLL_PITCH_YAW_INPUT_MAX);
|
||||||
channel_throttle->set_range(0, 1000);
|
channel_throttle->set_range(0, 1000);
|
||||||
|
|
||||||
channel_roll->set_type(RC_CHANNEL_TYPE_ANGLE_RAW);
|
channel_roll->set_type(RC_CHANNEL_TYPE_ANGLE_RAW);
|
||||||
|
|
Loading…
Reference in New Issue