Skip to content

Commit

Permalink
Copter: Grouping judgment conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
muramura authored and peterbarker committed Sep 27, 2024
1 parent 946e148 commit c116fac
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ArduCopter/mode_guided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,12 +1011,16 @@ void ModeGuided::angle_control_run()
// helper function to set yaw state and targets
void ModeGuided::set_yaw_state(bool use_yaw, float yaw_cd, bool use_yaw_rate, float yaw_rate_cds, bool relative_angle)
{
if (use_yaw && relative_angle) {
auto_yaw.set_fixed_yaw(yaw_cd * 0.01f, 0.0f, 0, relative_angle);
} else if (use_yaw && use_yaw_rate) {
auto_yaw.set_yaw_angle_rate(yaw_cd * 0.01f, yaw_rate_cds * 0.01f);
} else if (use_yaw && !use_yaw_rate) {
auto_yaw.set_yaw_angle_rate(yaw_cd * 0.01f, 0.0f);
if (use_yaw) {
if (relative_angle) {
auto_yaw.set_fixed_yaw(yaw_cd * 0.01f, 0.0f, 0, relative_angle);
} else {
float rate = 0.0f;
if (use_yaw_rate) {
rate = yaw_rate_cds * 0.01f;
}
auto_yaw.set_yaw_angle_rate(yaw_cd * 0.01f, rate);
}
} else if (use_yaw_rate) {
auto_yaw.set_rate(yaw_rate_cds);
} else {
Expand Down

0 comments on commit c116fac

Please sign in to comment.