Beispiel #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);
    }
}
Beispiel #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);
}
Beispiel #3
0
void 
AP_GPS::send_mavlink_gps_raw(mavlink_channel_t chan)
{
    static uint32_t last_send_time_ms[MAVLINK_COMM_NUM_BUFFERS];
    if (status(0) > AP_GPS::NO_GPS) {
        // when we have a GPS then only send new data
        if (last_send_time_ms[chan] == last_message_time_ms(0)) {
            return;
        }
        last_send_time_ms[chan] = last_message_time_ms(0);
    } else {
        // when we don't have a GPS then send at 1Hz
        uint32_t now = AP_HAL::millis();
        if (now - last_send_time_ms[chan] < 1000) {
            return;
        }
        last_send_time_ms[chan] = now;
    }
    const Location &loc = location(0);
    mavlink_msg_gps_raw_int_send(
        chan,
        last_fix_time_ms(0)*(uint64_t)1000,
        status(0),
        loc.lat,        // in 1E7 degrees
        loc.lng,        // in 1E7 degrees
        loc.alt * 10UL, // in mm
        get_hdop(0),
        get_vdop(0),
        ground_speed(0)*100,  // cm/s
        ground_course_cd(0), // 1/100 degrees,
        num_sats(0));
}
Beispiel #4
0
void 
AP_GPS::send_mavlink_gps_raw(mavlink_channel_t chan)
{
    static uint32_t last_send_time_ms;
    if (last_send_time_ms == 0 || last_send_time_ms != last_message_time_ms(0)) {
        last_send_time_ms = last_message_time_ms(0);
        const Location &loc = location(0);
        mavlink_msg_gps_raw_int_send(
            chan,
            last_fix_time_ms(0)*(uint64_t)1000,
            status(0),
            loc.lat,        // in 1E7 degrees
            loc.lng,        // in 1E7 degrees
            loc.alt * 10UL, // in mm
            get_hdop(0),
            65535,
            ground_speed(0)*100,  // cm/s
            ground_course_cd(0), // 1/100 degrees,
            num_sats(0));
    }
}