How distance to home is calculated

Hi,
I develop free available QCZEK LRS RC control system, which provides limited (due to slow downlink) mavlink support and i wonder which messages are required to calculate distance to home value.
Currently only following messages are transfered,

  • MAVLINK_MSG_ID_HEARTBEAT
  • MAVLINK_MSG_ID_ATTITUDE
  • MAVLINK_MSG_ID_GLOBAL_POSITION_INT
  • MAVLINK_MSG_ID_SYS_STATUS
  • MAVLINK_MSG_ID_RC_CHANNELS_RAW
  • MAVLINK_MSG_ID_GPS_RAW_INT
  • MAVLINK_MSG_ID_VFR_HUD
  • MAVLINK_MSG_ID_RADIO_STATUS

But it’s not enough for distance to home calculation.
Does Tower need HOME_POSITION msg ( #242 ) to get home position which is stored by FC?
Thank you in advance
Kris

Hi,

Interesting project.

While I do not fully grasp the Tower source, I believe yes, it takes the home position from the drone to calculate the distance from home. How else should it calculate the distance to home otherwise?

But see for yourself, I believe this is the relevant part in the Tower source:

Cheers

Thanks,
I found this piece of code, by i can’t find where mavlink stream is processed, and where high level notifications are send. I expect something like big case, and depending on message type different event is generated… :slight_smile:Do you where it’s located in the code?
Thx
Kris