Sub: use gain-ajusted deadzone for pilot_desired_yaw_rate

This commit is contained in:
Willian Galvani 2023-10-31 16:49:06 -03:00
parent 63c198199b
commit 41850ee550
3 changed files with 6 additions and 3 deletions

View File

@ -64,7 +64,8 @@ void ModeAlthold::run()
sub.get_pilot_desired_lean_angles(channel_roll->get_control_in(), channel_pitch->get_control_in(), target_roll, target_pitch, attitude_control->get_althold_lean_angle_max_cd());
// get pilot's desired yaw rate
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(channel_yaw->get_control_in());
float yaw_input = channel_yaw->pwm_to_angle_dz_trim(channel_yaw->get_dead_zone() * sub.gain, channel_yaw->get_radio_trim());
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(yaw_input);
// call attitude controller
if (!is_zero(target_yaw_rate)) { // call attitude controller with rate yaw determined by pilot input

View File

@ -78,7 +78,8 @@ void ModePoshold::run()
// Update attitude //
// get pilot's desired yaw rate
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(channel_yaw->get_control_in());
float yaw_input = channel_yaw->pwm_to_angle_dz_trim(channel_yaw->get_dead_zone() * sub.gain, channel_yaw->get_radio_trim());
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(yaw_input);
// convert pilot input to lean angles
// To-Do: convert get_pilot_desired_lean_angles to return angles as floats

View File

@ -32,7 +32,8 @@ void ModeStabilize::run()
sub.get_pilot_desired_lean_angles(channel_roll->get_control_in(), channel_pitch->get_control_in(), target_roll, target_pitch, sub.aparm.angle_max);
// get pilot's desired yaw rate
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(channel_yaw->get_control_in());
float yaw_input = channel_yaw->pwm_to_angle_dz_trim(channel_yaw->get_dead_zone() * sub.gain, channel_yaw->get_radio_trim());
float target_yaw_rate = sub.get_pilot_desired_yaw_rate(yaw_input);
// call attitude controller
// update attitude controller targets