mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 04:43:35 +08:00
avoid double promotions
This commit is contained in:
committed by
Lorenz Meier
parent
412f956636
commit
4b8bedef48
+6
-6
@@ -319,7 +319,7 @@ __EXPORT void waypoint_from_heading_and_distance(double lat_start, double lon_st
|
||||
double *lat_target, double *lon_target)
|
||||
{
|
||||
bearing = _wrap_2pi(bearing);
|
||||
double radius_ratio = (double)(fabs(dist) / CONSTANTS_RADIUS_OF_EARTH);
|
||||
double radius_ratio = fabs((double)dist) / CONSTANTS_RADIUS_OF_EARTH;
|
||||
|
||||
double lat_start_rad = lat_start * M_DEG_TO_RAD;
|
||||
double lon_start_rad = lon_start * M_DEG_TO_RAD;
|
||||
@@ -432,7 +432,7 @@ __EXPORT int get_distance_to_line(struct crosstrack_error_s *crosstrack_error, d
|
||||
|
||||
crosstrack_error->distance = (dist_to_end) * sinf(bearing_diff);
|
||||
|
||||
if (sin(bearing_diff) >= 0) {
|
||||
if (sinf(bearing_diff) >= 0) {
|
||||
crosstrack_error->bearing = _wrap_pi(bearing_track - M_PI_2_F);
|
||||
|
||||
} else {
|
||||
@@ -516,10 +516,10 @@ __EXPORT int get_distance_to_arc(struct crosstrack_error_s *crosstrack_error, do
|
||||
// calculate the position of the start and end points. We should not be doing this often
|
||||
// as this function generally will not be called repeatedly when we are out of the sector.
|
||||
|
||||
double start_disp_x = (double)radius * sin(arc_start_bearing);
|
||||
double start_disp_y = (double)radius * cos(arc_start_bearing);
|
||||
double end_disp_x = (double)radius * sin(_wrap_pi((double)(arc_start_bearing + arc_sweep)));
|
||||
double end_disp_y = (double)radius * cos(_wrap_pi((double)(arc_start_bearing + arc_sweep)));
|
||||
double start_disp_x = (double)radius * sin((double)arc_start_bearing);
|
||||
double start_disp_y = (double)radius * cos((double)arc_start_bearing);
|
||||
double end_disp_x = (double)radius * sin((double)_wrap_pi((double)(arc_start_bearing + arc_sweep)));
|
||||
double end_disp_y = (double)radius * cos((double)_wrap_pi((double)(arc_start_bearing + arc_sweep)));
|
||||
double lon_start = lon_now + start_disp_x / 111111.0;
|
||||
double lat_start = lat_now + start_disp_y * cos(lat_now) / 111111.0;
|
||||
double lon_end = lon_now + end_disp_x / 111111.0;
|
||||
|
||||
+1
-1
Submodule src/lib/matrix updated: 499b897e5f...471e96ff6f
Reference in New Issue
Block a user