Skip to content

Commit 7be2cfc

Browse files
committed
Plane: use radians(0.01f) to convert to radians from cd
1 parent ad60e34 commit 7be2cfc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ArduPlane/mode_cruise.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void ModeCruise::navigate()
6161

6262
// check if we are moving in the direction of the front of the vehicle
6363
const int32_t ground_course_cd = plane.gps.ground_course_cd();
64-
const bool moving_forwards = fabsf(wrap_PI(radians(ground_course_cd * 0.01) - plane.ahrs.get_yaw())) < M_PI_2;
64+
const bool moving_forwards = fabsf(wrap_PI(ground_course_cd * radians(0.01) - plane.ahrs.get_yaw())) < M_PI_2;
6565

6666
if (!locked_heading &&
6767
plane.channel_roll->get_control_in() == 0 &&

ArduPlane/quadplane.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ void QuadPlane::multicopter_attitude_rate_update(float yaw_rate_cds)
930930
float yaw2roll_scale = roll_limit / yaw_rate_limit;
931931

932932
// Rotate as a function of Euler pitch and swap roll/yaw
933-
float euler_pitch = radians(.01f * plane.nav_pitch_cd);
933+
float euler_pitch = radians(.01f) * plane.nav_pitch_cd;
934934
float spitch = fabsf(sinf(euler_pitch));
935935
float y2r_scale = linear_interpolate(1, yaw2roll_scale, spitch, 0, 1);
936936

@@ -1136,7 +1136,7 @@ void QuadPlane::get_pilot_desired_lean_angles(float &roll_out_cd, float &pitch_o
11361136
}
11371137

11381138
// apply lateral tilt to euler roll conversion
1139-
roll_out_cd = 100 * degrees(atanf(cosf(radians(pitch_out_cd*0.01))*tanf(radians(roll_out_cd*0.01))));
1139+
roll_out_cd = 100 * degrees(atanf(cosf(pitch_out_cd * radians(0.01)) * tanf(roll_out_cd * radians(0.01))));
11401140
}
11411141

11421142
/*

0 commit comments

Comments
 (0)