|
|
|
@ -61,7 +61,12 @@ void Tracker::update_bearing_and_distance()
@@ -61,7 +61,12 @@ void Tracker::update_bearing_and_distance()
|
|
|
|
|
nav_status.distance = get_distance(current_loc, vehicle.location_estimate); |
|
|
|
|
|
|
|
|
|
// calculate altitude difference to vehicle using gps
|
|
|
|
|
nav_status.alt_difference_gps = (vehicle.location_estimate.alt - current_loc.alt) / 100.0f; |
|
|
|
|
if (g.alt_source == ALT_SOURCE_GPS){ |
|
|
|
|
nav_status.alt_difference_gps = (vehicle.location_estimate.alt - current_loc.alt) / 100.0f; |
|
|
|
|
} else { |
|
|
|
|
// g.alt_source == ALT_SOURCE_GPS_VEH_ONLY
|
|
|
|
|
nav_status.alt_difference_gps = vehicle.relative_alt / 100.0f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// calculate pitch to vehicle
|
|
|
|
|
// To-Do: remove need for check of control_mode
|
|
|
|
@ -127,6 +132,7 @@ void Tracker::tracking_update_position(const mavlink_global_position_int_t &msg)
@@ -127,6 +132,7 @@ void Tracker::tracking_update_position(const mavlink_global_position_int_t &msg)
|
|
|
|
|
vehicle.location.lat = msg.lat; |
|
|
|
|
vehicle.location.lng = msg.lon; |
|
|
|
|
vehicle.location.alt = msg.alt/10; |
|
|
|
|
vehicle.relative_alt = msg.relative_alt/10; |
|
|
|
|
vehicle.vel = Vector3f(msg.vx/100.0f, msg.vy/100.0f, msg.vz/100.0f); |
|
|
|
|
vehicle.last_update_us = AP_HAL::micros(); |
|
|
|
|
vehicle.last_update_ms = AP_HAL::millis(); |
|
|
|
|