AC_WPNav: Use the get_bearing_cd() overloaded function provided by AP_Math instead

This commit is contained in:
Dr.-Ing. Amilcar Do Carmo Lucas 2017-12-03 22:05:56 +01:00 committed by Randy Mackay
parent e13281ab2d
commit 1a512609ac
2 changed files with 0 additions and 15 deletions

View File

@ -1,5 +1,4 @@
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_Math/definitions.h>
#include "AC_WPNav.h" #include "AC_WPNav.h"
extern const AP_HAL::HAL& hal; extern const AP_HAL::HAL& hal;
@ -1273,17 +1272,6 @@ bool AC_WPNav::get_vector_NEU(const Location_Class &loc, Vector3f &vec, bool &te
/// shared methods /// shared methods
/// ///
// get_bearing_cd - return bearing in centi-degrees between two positions
// To-Do: move this to math library
float AC_WPNav::get_bearing_cd(const Vector3f &origin, const Vector3f &destination) const
{
float bearing = 9000 + atan2f(-(destination.x-origin.x), destination.y-origin.y) * DEGX100;
if (bearing < 0) {
bearing += 36000;
}
return bearing;
}
/// calc_slow_down_distance - calculates distance before waypoint that target point should begin to slow-down assuming it is travelling at full speed /// calc_slow_down_distance - calculates distance before waypoint that target point should begin to slow-down assuming it is travelling at full speed
void AC_WPNav::calc_slow_down_distance(float speed_cms, float accel_cmss) void AC_WPNav::calc_slow_down_distance(float speed_cms, float accel_cmss)
{ {

View File

@ -197,9 +197,6 @@ public:
/// calculate_wp_leash_length - calculates track speed, acceleration and leash lengths for waypoint controller /// calculate_wp_leash_length - calculates track speed, acceleration and leash lengths for waypoint controller
void calculate_wp_leash_length(); void calculate_wp_leash_length();
/// get_bearing_cd - return bearing in centi-degrees between two positions
float get_bearing_cd(const Vector3f &origin, const Vector3f &destination) const;
/// ///
/// spline methods /// spline methods
/// ///