Tracker: move handling of SET_GPS_GLOBAL_ORIGIN up

This commit is contained in:
Peter Barker 2017-09-19 12:42:32 +10:00 committed by Randy Mackay
parent 5b7f396e23
commit c090818d5e
2 changed files with 6 additions and 16 deletions

View File

@ -434,22 +434,6 @@ void GCS_MAVLINK_Tracker::handleMessage(mavlink_message_t* msg)
{
switch (msg->msgid) {
case MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN:
{
mavlink_set_gps_global_origin_t packet;
mavlink_msg_set_gps_global_origin_decode(msg, &packet);
// sanity check location
if (!check_latlng(packet.latitude, packet.longitude)) {
break;
}
Location ekf_origin {};
ekf_origin.lat = packet.latitude;
ekf_origin.lng = packet.longitude;
ekf_origin.alt = packet.altitude / 10;
tracker.set_ekf_origin(ekf_origin);
break;
}
// If we are currently operating as a proxy for a remote,
// alas we have to look inside each packet to see if it's for us or for the remote
case MAVLINK_MSG_ID_REQUEST_DATA_STREAM:
@ -820,6 +804,11 @@ const AP_FWVersion &GCS_MAVLINK_Tracker::get_fwver() const
return tracker.fwver;
}
void GCS_MAVLINK_Tracker::set_ekf_origin(const Location& loc)
{
tracker.set_ekf_origin(loc);
}
/* dummy methods to avoid having to link against AP_Camera */
void AP_Camera::control_msg(mavlink_message_t const*) {}
void AP_Camera::configure(float, float, float, float, float, float, float) {}

View File

@ -23,6 +23,7 @@ protected:
AP_ServoRelayEvents *get_servorelayevents() const override { return nullptr; }
AP_GPS *get_gps() const override;
const AP_FWVersion &get_fwver() const override;
void set_ekf_origin(const Location& loc) override;
uint8_t sysid_my_gcs() const override;