Skip to content

Commit

Permalink
Copter: autoyaw: correct units returned by look_ahead_yaw
Browse files Browse the repository at this point in the history
there are other methods on the autoyaw object which make it clear that they're working in cd, and others in there that work in degrees.  This method doesn't specify cd yet returns in that unit.

Change the method and state variable to store in degrees (as our naming standards suggest)
  • Loading branch information
peterbarker committed Apr 9, 2024
1 parent 5e5fde7 commit 1aaa56d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ArduCopter/autoyaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ float Mode::AutoYaw::look_ahead_yaw()
const float speed_sq = vel.xy().length_squared();
// Commanded Yaw to automatically look ahead.
if (copter.position_ok() && (speed_sq > (YAW_LOOK_AHEAD_MIN_SPEED * YAW_LOOK_AHEAD_MIN_SPEED))) {
_look_ahead_yaw = degrees(atan2f(vel.y,vel.x))*100.0f;
_look_ahead_yaw = degrees(atan2f(vel.y,vel.x));
}
return _look_ahead_yaw;
}
Expand Down Expand Up @@ -80,7 +80,7 @@ void Mode::AutoYaw::set_mode(Mode yaw_mode)

case Mode::LOOK_AHEAD:
// Commanded Yaw to automatically look ahead.
_look_ahead_yaw = copter.ahrs.yaw_sensor;
_look_ahead_yaw = copter.ahrs.yaw_sensor * 0.01; // cdeg -> deg
break;

case Mode::RESETTOARMEDYAW:
Expand Down Expand Up @@ -230,7 +230,7 @@ float Mode::AutoYaw::yaw_cd()

case Mode::LOOK_AHEAD:
// Commanded Yaw to automatically look ahead.
_yaw_angle_cd = look_ahead_yaw();
_yaw_angle_cd = look_ahead_yaw() * 100.0;
break;

case Mode::RESETTOARMEDYAW:
Expand Down

0 comments on commit 1aaa56d

Please sign in to comment.