当前位置: 首页>>代码示例>>C++>>正文


C++ LOG_PACKET_HEADER_INIT函数代码示例

本文整理汇总了C++中LOG_PACKET_HEADER_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_PACKET_HEADER_INIT函数的具体用法?C++ LOG_PACKET_HEADER_INIT怎么用?C++ LOG_PACKET_HEADER_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOG_PACKET_HEADER_INIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write_version

int write_version(int fd)
{
	/* construct version message */
	struct {
		LOG_PACKET_HEADER;
		struct log_VER_s body;
	} log_msg_VER = {
		LOG_PACKET_HEADER_INIT(LOG_VER_MSG),
	};

	/* fill version message and write it */
	strncpy(log_msg_VER.body.fw_git, FW_GIT, sizeof(log_msg_VER.body.fw_git));
	strncpy(log_msg_VER.body.arch, HW_ARCH, sizeof(log_msg_VER.body.arch));
	return write(fd, &log_msg_VER, sizeof(log_msg_VER));
}
开发者ID:cabralmachado,项目名称:Firmware,代码行数:15,代码来源:sdlog2.c

示例2: LOG_PACKET_HEADER_INIT

// Private Methods /////////////////////////////////////////////////////////////
void AP_GPS_UBLOX::log_mon_hw(void)
{
    if (!should_df_log()) {
        return;
    }
    struct log_Ubx1 pkt = {
        LOG_PACKET_HEADER_INIT(_ubx_msg_log_index(LOG_GPS_UBX1_MSG)),
        time_us    : AP_HAL::micros64(),
        instance   : state.instance,
        noisePerMS : _buffer.mon_hw_60.noisePerMS,
        jamInd     : _buffer.mon_hw_60.jamInd,
        aPower     : _buffer.mon_hw_60.aPower,
        agcCnt     : _buffer.mon_hw_60.agcCnt,
        config     : _unconfigured_messages,
    };
开发者ID:DroneBuster,项目名称:ardupilot,代码行数:16,代码来源:AP_GPS_UBLOX.cpp

示例3: LOG_PACKET_HEADER_INIT

void
AP_GPS_SBP::logging_log_full_update()
{

    if (!should_df_log()) {
        return;
    }

    struct log_SbpHealth pkt = {
        LOG_PACKET_HEADER_INIT(LOG_MSG_SBPHEALTH),
        time_us                    : AP_HAL::micros64(),
        crc_error_counter          : crc_error_counter,
        last_injected_data_ms      : last_injected_data_ms,
        last_iar_num_hypotheses    : last_iar_num_hypotheses,
    };
开发者ID:BrendanSmith,项目名称:ardupilot,代码行数:15,代码来源:AP_GPS_SBP.cpp

示例4: LOG_PACKET_HEADER_INIT

// Write an Autotune data packet
void Copter::ModeAutoTune::Log_Write_AutoTune(uint8_t _axis, uint8_t tune_step, float meas_target, float meas_min, float meas_max, float new_gain_rp, float new_gain_rd, float new_gain_sp, float new_ddt)
{
    struct log_AutoTune pkt = {
        LOG_PACKET_HEADER_INIT(LOG_AUTOTUNE_MSG),
        time_us     : AP_HAL::micros64(),
        axis        : _axis,
        tune_step   : tune_step,
        meas_target : meas_target,
        meas_min    : meas_min,
        meas_max    : meas_max,
        new_gain_rp : new_gain_rp,
        new_gain_rd : new_gain_rd,
        new_gain_sp : new_gain_sp,
        new_ddt     : new_ddt
    };
开发者ID:dgrat,项目名称:ardupilot,代码行数:16,代码来源:Log.cpp

示例5: LOG_PACKET_HEADER_INIT

// Write a navigation tuning packe
void Plane::Log_Write_Nav_Tuning()
{
    struct log_Nav_Tuning pkt = {
        LOG_PACKET_HEADER_INIT(LOG_NTUN_MSG),
        time_us             : hal.scheduler->micros64(),
        yaw                 : (uint16_t)ahrs.yaw_sensor,
        wp_distance         : auto_state.wp_distance,
        target_bearing_cd   : (int16_t)nav_controller->target_bearing_cd(),
        nav_bearing_cd      : (int16_t)nav_controller->nav_bearing_cd(),
        altitude_error_cm   : (int16_t)altitude_error_cm,
        airspeed_cm         : (int16_t)airspeed.get_airspeed_cm(),
        altitude            : barometer.get_altitude(),
        groundspeed_cm      : (uint32_t)(gps.ground_speed()*100)
    };
    DataFlash.WriteBlock(&pkt, sizeof(pkt));
}
开发者ID:czq13,项目名称:THUF35,代码行数:17,代码来源:Log.cpp

示例6: LOG_PACKET_HEADER_INIT

// Write a throttle control packet
void Rover::Log_Write_Throttle()
{
    const Vector3f accel = ins.get_accel();
    float speed = DataFlash.quiet_nanf();
    g2.attitude_control.get_forward_speed(speed);
    struct log_Throttle pkt = {
        LOG_PACKET_HEADER_INIT(LOG_THR_MSG),
        time_us         : AP_HAL::micros64(),
        throttle_in     : channel_throttle->get_control_in(),
        throttle_out    : g2.motors.get_throttle(),
        desired_speed   : g2.attitude_control.get_desired_speed(),
        speed           : speed,
        accel_y         : accel.y
    };
    DataFlash.WriteBlock(&pkt, sizeof(pkt));
}
开发者ID:ShingoMatsuura,项目名称:ardupilot,代码行数:17,代码来源:Log.cpp

示例7: LOG_PACKET_HEADER_INIT

void AP_GPS_UBLOX::log_mon_hw2(void)
{
    if (gps._DataFlash == NULL || !gps._DataFlash->logging_started()) {
        return;
    }

    struct log_Ubx2 pkt = {
        LOG_PACKET_HEADER_INIT(_ubx_msg_log_index(LOG_GPS_UBX2_MSG)),
        time_us   : AP_HAL::micros64(),
        instance  : state.instance,
        ofsI      : _buffer.mon_hw2.ofsI,
        magI      : _buffer.mon_hw2.magI,
        ofsQ      : _buffer.mon_hw2.ofsQ,
        magQ      : _buffer.mon_hw2.magQ,
    };
    gps._DataFlash->WriteBlock(&pkt, sizeof(pkt));
}
开发者ID:Parrot-Developers,项目名称:ardupilot,代码行数:17,代码来源:AP_GPS_UBLOX.cpp

示例8: LOG_PACKET_HEADER_INIT

void AP_GPS_UBLOX::log_mon_hw2(void)
{
    if (gps._DataFlash == NULL || !gps._DataFlash->logging_started()) {
        return;
    }

    struct log_Ubx2 pkt = {
        LOG_PACKET_HEADER_INIT(LOG_UBX2_MSG),
        timestamp : hal.scheduler->millis(),
        instance  : state.instance,
        ofsI      : _buffer.mon_hw2.ofsI,
        magI      : _buffer.mon_hw2.magI,
        ofsQ      : _buffer.mon_hw2.ofsQ,
        magQ      : _buffer.mon_hw2.magQ,
    };
    gps._DataFlash->WriteBlock(&pkt, sizeof(pkt));    
}
开发者ID:40041572,项目名称:ardupilot,代码行数:17,代码来源:AP_GPS_UBLOX.cpp

示例9: logging_write_headers

void 
AP_GPS_SBP::logging_log_full_update()
{

    if (gps._DataFlash == NULL || !gps._DataFlash->logging_started()) {
      return;
    }

    logging_write_headers();

    struct log_SbpHealth pkt = {
        LOG_PACKET_HEADER_INIT(LOG_MSG_SBPHEALTH),
        timestamp       : hal.scheduler->millis(),
        crc_error_counter          : crc_error_counter,
        last_injected_data_ms      : last_injected_data_ms,
        last_iar_num_hypotheses    : last_iar_num_hypotheses,
    };
开发者ID:1000000007,项目名称:ardupilot,代码行数:17,代码来源:AP_GPS_SBP.cpp

示例10: LOG_PACKET_HEADER_INIT

// Write a performance monitoring packet. Total length : 19 bytes
void Rover::Log_Write_Performance()
{
    struct log_Performance pkt = {
        LOG_PACKET_HEADER_INIT(LOG_PERFORMANCE_MSG),
        time_us         : AP_HAL::micros64(),
        loop_time       : millis()- perf_mon_timer,
        main_loop_count : mainLoop_count,
        g_dt_max        : G_Dt_max,
        gyro_drift_x    : (int16_t)(ahrs.get_gyro_drift().x * 1000),
        gyro_drift_y    : (int16_t)(ahrs.get_gyro_drift().y * 1000),
        gyro_drift_z    : (int16_t)(ahrs.get_gyro_drift().z * 1000),
        i2c_lockup_count: 0,
        ins_error_count : ins.error_count(),
        hal.util->available_memory()
    };
    DataFlash.WriteBlock(&pkt, sizeof(pkt));
}
开发者ID:Hurisa,项目名称:ardupilot,代码行数:18,代码来源:Log.cpp

示例11: LOG_PACKET_HEADER_INIT

void DataFlashTest_AllTypes::Log_Write_TypeMessages()
{
    dataflash.StartNewLog();
    log_num = dataflash.find_last_log();
    hal.console->printf("Using log number %u\n", log_num);

    struct log_TYP1 typ1 = {
        LOG_PACKET_HEADER_INIT(LOG_TYP1_MSG),
        time_us : AP_HAL::micros64(),
        b : -17, // int8_t
        B : 42,  // uint8_t
        h : -12372,  // int16_t
        H : 19812,   // uint16_t
        i : -98234729,   // int32_t
        I : 74627293,    // uint32_t
        f : 35.87654,  // float
        d : 67.7393274658293,   // double
        n : { 'A', 'B', 'C', 'D' }, // char[4]
开发者ID:alessandro-benini,项目名称:ardupilot,代码行数:18,代码来源:DataFlash_AllTypes.cpp

示例12: LOG_PACKET_HEADER_INIT

void AP_AutoTune::write_log(float servo, float demanded, float achieved)
{
    if (!dataflash.logging_started()) {
        return;
    }

    struct log_ATRP pkt = {
        LOG_PACKET_HEADER_INIT(LOG_ATRP_MSG),
        time_us    : AP_HAL::micros64(),
        type       : type,
    	state      : (uint8_t)state,
        servo      : (int16_t)(servo*100),
        demanded   : demanded,
        achieved   : achieved,
        P          : current.P.get()
    };
    dataflash.WriteBlock(&pkt, sizeof(pkt));
}
开发者ID:JunHwanHuh,项目名称:MNC-Bachelor-2015-Dontbe,代码行数:18,代码来源:AP_AutoTune.cpp

示例13: LOG_PACKET_HEADER_INIT

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));
}
开发者ID:KIrill-ka,项目名称:ardupilot,代码行数:19,代码来源:AP_AutoTune.cpp

示例14: LOG_PACKET_HEADER_INIT

void
AP_GPS_SBP2::logging_log_full_update()
{
    if (!should_df_log()) {
      return;
    }

    //TODO: Expand with heartbeat info.
    //TODO: Get rid of IAR NUM HYPO

    struct log_SbpHealth pkt = {
        LOG_PACKET_HEADER_INIT(LOG_MSG_SBPHEALTH),
        time_us                    : AP_HAL::micros64(),
        crc_error_counter          : crc_error_counter,
        last_injected_data_ms      : last_injected_data_ms,
        last_iar_num_hypotheses    : 0,
    };
    DataFlash_Class::instance()->WriteBlock(&pkt, sizeof(pkt));
};
开发者ID:DroneBuster,项目名称:ardupilot,代码行数:19,代码来源:AP_GPS_SBP2.cpp

示例15: write_formats

void write_formats(int fd)
{
	/* construct message format packet */
	struct {
		LOG_PACKET_HEADER;
		struct log_format_s body;
	} log_format_packet = {
		LOG_PACKET_HEADER_INIT(LOG_FORMAT_MSG),
	};

	/* fill message format packet for each format and write to log */
	int i;

	for (i = 0; i < log_formats_num; i++) {
		log_format_packet.body = log_formats[i];
		log_bytes_written += write(fd, &log_format_packet, sizeof(log_format_packet));
	}

	fsync(fd);
}
开发者ID:Nox997,项目名称:Firmware,代码行数:20,代码来源:sdlog2.c


注:本文中的LOG_PACKET_HEADER_INIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。