Skip to content

Commit

Permalink
Sub: use gain-ajusted deadzone for pilot_desired_yaw_rate
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Oct 31, 2023
1 parent 5087a42 commit abbaae0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ArduSub/mode_althold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ArduSub/mode_poshold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ArduSub/mode_stabilize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit abbaae0

Please sign in to comment.