Exemplo n.º 1
0
/*
  handle a GIMBAL_REPORT message
 */
void AP_Mount_SoloGimbal::handle_gimbal_report(mavlink_channel_t chan, const mavlink_message_t *msg)
{
    _gimbal.update_target(_angle_ef_target_rad);
    _gimbal.receive_feedback(chan,msg);

    AP_Logger *df = AP_Logger::get_singleton();
    if (df == nullptr) {
        return;
    }

    if(!_params_saved && df->logging_started()) {
        _gimbal.fetch_params();       //last parameter save might not be stored in dataflash so retry
        _params_saved = true;
    }

    if (_gimbal.get_log_dt() > 1.0f/25.0f) {
        _gimbal.write_logs();
    }
}
Exemplo n.º 2
0
void AP_AutoTune::write_log(float servo, float demanded, float achieved)
{
    AP_Logger *dataflash = AP_Logger::get_singleton();
    if (!dataflash->logging_started()) {
        return;
    }

    struct log_ATRP pkt = {
        LOG_PACKET_HEADER_INIT(LOG_ATRP_MSG),
        time_us    : AP_HAL::micros64(),
        type       : static_cast<uint8_t>(type),
    	state      : (uint8_t)state,
        servo      : (int16_t)(servo*100),
        demanded   : demanded,
        achieved   : achieved,
        P          : current.P.get()
    };
    dataflash->WriteBlock(&pkt, sizeof(pkt));
}