Skip to content

Commit

Permalink
Copter: Grouping judgment conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
muramura committed Apr 23, 2024
1 parent c9f7a3c commit 65f2313
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ArduCopter/mode_guided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,12 +993,12 @@ 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 {
auto_yaw.set_yaw_angle_rate(yaw_cd * 0.01f, use_yaw_rate ? yaw_rate_cds * 0.01f : 0.0f);
}
} else if (use_yaw_rate) {
auto_yaw.set_rate(yaw_rate_cds);
} else {
Expand Down

0 comments on commit 65f2313

Please sign in to comment.