mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Copter: simplify home distance and bearing calculation
This commit is contained in:
parent
f78ffefd66
commit
1aeb9446c0
@ -14,9 +14,7 @@ void Copter::run_nav_updates(void)
|
||||
uint32_t Copter::home_distance()
|
||||
{
|
||||
if (position_ok()) {
|
||||
const Vector3f home = pv_location_to_vector(ahrs.get_home());
|
||||
const Vector3f curr = inertial_nav.get_position();
|
||||
_home_distance = get_horizontal_distance_cm(curr, home);
|
||||
_home_distance = get_distance_cm(current_loc, ahrs.get_home());
|
||||
}
|
||||
return _home_distance;
|
||||
}
|
||||
@ -25,9 +23,7 @@ uint32_t Copter::home_distance()
|
||||
int32_t Copter::home_bearing()
|
||||
{
|
||||
if (position_ok()) {
|
||||
const Vector3f home = pv_location_to_vector(ahrs.get_home());
|
||||
const Vector3f curr = inertial_nav.get_position();
|
||||
_home_bearing = get_bearing_cd(curr,home);
|
||||
_home_bearing = get_bearing_cd(current_loc, ahrs.get_home());
|
||||
}
|
||||
return _home_bearing;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user