示例#1
0
Rover::Rover(void) :
    param_loader(var_info),
    channel_steer(nullptr),
    channel_throttle(nullptr),
    channel_learn(nullptr),
    DataFlash{FIRMWARE_STRING},
    in_log_download(false),
    modes(&g.mode1),
    L1_controller(ahrs),
    nav_controller(&L1_controller),
    steerController(ahrs),
    mission(ahrs,
            FUNCTOR_BIND_MEMBER(&Rover::start_command, bool, const AP_Mission::Mission_Command&),
            FUNCTOR_BIND_MEMBER(&Rover::verify_command_callback, bool, const AP_Mission::Mission_Command&),
            FUNCTOR_BIND_MEMBER(&Rover::exit_mission, void)),
    num_gcs(MAVLINK_COMM_NUM_BUFFERS),
    ServoRelayEvents(relay),
#if CAMERA == ENABLED
    camera(&relay),
#endif
#if MOUNT == ENABLED
    camera_mount(ahrs, current_loc),
#endif
    control_mode(INITIALISING),
    ground_start_count(20),
    throttle(500),
#if FRSKY_TELEM_ENABLED == ENABLED
    frsky_telemetry(ahrs, battery, sonar),
#endif
    home(ahrs.get_home()),
    G_Dt(0.02)
{
}
示例#2
0
void GCS_Tracker::setup_uarts(AP_SerialManager &serial_manager)
{
    GCS::setup_uarts(serial_manager);

    for (uint8_t i = 1; i < num_gcs(); i++) {
        gcs().chan(i).set_snoop(mavlink_snoop_static);
    }
}
示例#3
0
void GCS_Plane::send_airspeed_calibration(const Vector3f &vg)
{
    for (uint8_t i=0; i<num_gcs(); i++) {
        if (_chan[i].initialised) {
            if (HAVE_PAYLOAD_SPACE((mavlink_channel_t)i, AIRSPEED_AUTOCAL)) {
                plane.airspeed.log_mavlink_send((mavlink_channel_t)i, vg);
            }
        }
    }
}
示例#4
0
/*
  install an alternative protocol handler. This allows another
  protocol to take over the link if MAVLink goes idle. It is used to
  allow for the AP_BLHeli pass-thru protocols to run on hal.uartA
 */
bool GCS::install_alternative_protocol(mavlink_channel_t c, GCS_MAVLINK::protocol_handler_fn_t handler)
{
    if (c >= num_gcs()) {
        return false;
    }
    if (chan(c).alternative.handler) {
        // already have one installed - we may need to add support for
        // multiple alternative handlers
        return false;
    }
    chan(c).alternative.handler = handler;
    return true;
}
示例#5
0
void GCS_Plane::handle_interactive_setup()
{
    if (plane.g.cli_enabled == 1) {
        const char *msg = "\nPress ENTER 3 times to start interactive setup\n";
        plane.cliSerial->printf("%s\n", msg);
        if (_chan[1].initialised && (_chan[1].get_uart() != NULL)) {
            _chan[1].get_uart()->printf("%s\n", msg);
        }
        if (num_gcs() > 2 && _chan[2].initialised && (_chan[2].get_uart() != NULL)) {
            _chan[2].get_uart()->printf("%s\n", msg);
        }
    }
}
示例#6
0
void GCS_Tracker::request_datastream_airpressure(const uint8_t sysid, const uint8_t compid)
{
    for (uint8_t i=0; i < num_gcs(); i++) {
        if (gcs().chan(i).initialised) {
            // request air pressure
            if (HAVE_PAYLOAD_SPACE((mavlink_channel_t)i, DATA_STREAM)) {
                mavlink_msg_request_data_stream_send(
                    (mavlink_channel_t)i,
                    sysid,
                    compid,
                    MAV_DATA_STREAM_RAW_SENSORS,
                    tracker.g.mavlink_update_rate,
                    1); // start streaming
            }
        }
    }
}