Skip to content

Commit ad60e34

Browse files
committed
Rover: use radians(0.01f) to convert to radians from cd
1 parent 64e5ef4 commit ad60e34

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Rover/mode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void Mode::calc_steering_from_lateral_acceleration(float lat_accel, bool reverse
496496
void Mode::calc_steering_to_heading(float desired_heading_cd, float rate_max_degs)
497497
{
498498
// call heading controller
499-
const float steering_out = attitude_control.get_steering_out_heading(radians(desired_heading_cd*0.01f),
499+
const float steering_out = attitude_control.get_steering_out_heading(desired_heading_cd * radians(0.01f),
500500
radians(rate_max_degs),
501501
g2.motors.limit.steer_left,
502502
g2.motors.limit.steer_right,

Rover/mode_guided.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void ModeGuided::update()
8282
}
8383
if (have_attitude_target) {
8484
// run steering and throttle controllers
85-
float steering_out = attitude_control.get_steering_out_rate(radians(_desired_yaw_rate_cds * 0.01f),
85+
float steering_out = attitude_control.get_steering_out_rate(_desired_yaw_rate_cds * radians(0.01f),
8686
g2.motors.limit.steer_left,
8787
g2.motors.limit.steer_right,
8888
rover.G_Dt);

Rover/sailboat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ float Sailboat::get_VMG() const
317317
return speed;
318318
}
319319

320-
return (speed * cosf(wrap_PI(radians(rover.g2.wp_nav.wp_bearing_cd() * 0.01f) - rover.ahrs.get_yaw())));
320+
return (speed * cosf(wrap_PI(rover.g2.wp_nav.wp_bearing_cd() * radians(0.01f) - rover.ahrs.get_yaw())));
321321
}
322322

323323
// handle user initiated tack while in acro mode
@@ -384,7 +384,7 @@ bool Sailboat::use_indirect_route(float desired_heading_cd) const
384384
}
385385

386386
// convert desired heading to radians
387-
const float desired_heading_rad = radians(desired_heading_cd * 0.01f);
387+
const float desired_heading_rad = desired_heading_cd * radians(0.01f);
388388

389389
// check if desired heading is in the no go zone, if it is we can't go direct
390390
// pad no go zone, this allows use of heading controller rather than L1 when close to the wind
@@ -404,7 +404,7 @@ float Sailboat::calc_heading(float desired_heading_cd)
404404
const AP_WindVane::Sailboat_Tack current_tack = rover.g2.windvane.get_current_tack();
405405

406406
// convert desired heading to radians
407-
const float desired_heading_rad = radians(desired_heading_cd * 0.01f);
407+
const float desired_heading_rad = desired_heading_cd * radians(0.01f);
408408

409409
// if the desired heading is outside the no go zone there is no need to change it
410410
// this allows use of heading controller rather than L1 when desired

0 commit comments

Comments
 (0)