Ejemplo n.º 1
0
void 
AP_GPS::send_mavlink_gps2_raw(mavlink_channel_t chan)
{
    static uint32_t last_send_time_ms2;
    if (num_sensors() > 1 && 
        status(1) > AP_GPS::NO_GPS &&
        (last_send_time_ms2 == 0 || last_send_time_ms2 != last_message_time_ms(1))) {
            const Location &loc = location(1);
            last_send_time_ms2 = last_message_time_ms(1);
            mavlink_msg_gps2_raw_send(
                chan,
                last_fix_time_ms(1)*(uint64_t)1000,
                status(1),
                loc.lat,
                loc.lng,
                loc.alt * 10UL,
                get_hdop(1),
                65535,
                ground_speed(1)*100,  // cm/s
                ground_course_cd(1), // 1/100 degrees,
                num_sats(1),
                0,
                0);
    }
}
Ejemplo n.º 2
0
void 
AP_GPS::send_mavlink_gps2_raw(mavlink_channel_t chan)
{
    static uint32_t last_send_time_ms[MAVLINK_COMM_NUM_BUFFERS];
    if (num_sensors() < 2 || status(1) <= AP_GPS::NO_GPS) {
        return;
    }
    // when we have a GPS then only send new data
    if (last_send_time_ms[chan] == last_message_time_ms(1)) {
        return;
    }
    last_send_time_ms[chan] = last_message_time_ms(1);

    const Location &loc = location(1);
    mavlink_msg_gps2_raw_send(
        chan,
        last_fix_time_ms(1)*(uint64_t)1000,
        status(1),
        loc.lat,
        loc.lng,
        loc.alt * 10UL,
        get_hdop(1),
        get_vdop(1),
        ground_speed(1)*100,  // cm/s
        ground_course_cd(1), // 1/100 degrees,
        num_sats(1),
        0,
        0);
}