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


C++ AP_Param::configured方法代码示例

本文整理汇总了C++中AP_Param::configured方法的典型用法代码示例。如果您正苦于以下问题:C++ AP_Param::configured方法的具体用法?C++ AP_Param::configured怎么用?C++ AP_Param::configured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AP_Param的用法示例。


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

示例1: Aircraft

FlightAxis::FlightAxis(const char *home_str, const char *frame_str) :
    Aircraft(home_str, frame_str)
{
    use_time_sync = false;
    rate_hz = 250 / target_speedup;
    heli_demix = strstr(frame_str, "helidemix") != nullptr;
    rev4_servos = strstr(frame_str, "rev4") != nullptr;
    const char *colon = strchr(frame_str, ':');
    if (colon) {
        controller_ip = colon+1;
    }
    for (uint8_t i=0; i<ARRAY_SIZE(sim_defaults); i++) {
        AP_Param::set_default_by_name(sim_defaults[i].name, sim_defaults[i].value);
        if (sim_defaults[i].save) {
            enum ap_var_type ptype;
            AP_Param *p = AP_Param::find(sim_defaults[i].name, &ptype);
            if (!p->configured()) {
                p->save();
            }
        }
    }

    /* Create the thread that will be waiting for data from FlightAxis */
    mutex = hal.util->new_semaphore();

    int ret = pthread_create(&thread, NULL, update_thread, this);
    if (ret != 0) {
        AP_HAL::panic("SIM_FlightAxis: failed to create thread");
    }
}
开发者ID:Javiercerna,项目名称:ardupilot,代码行数:30,代码来源:SIM_FlightAxis.cpp

示例2: Aircraft

Morse::Morse(const char *home_str, const char *frame_str) :
    Aircraft(home_str, frame_str)
{
    char *saveptr = nullptr;
    char *s = strdup(frame_str);
    char *frame_option = strtok_r(s, ":", &saveptr);
    char *args1 = strtok_r(nullptr, ":", &saveptr);
    char *args2 = strtok_r(nullptr, ":", &saveptr);
    char *args3 = strtok_r(nullptr, ":", &saveptr);
    /*
      allow setting of IP, sensors port and control port
      format morse:IPADDRESS:SENSORS_PORT:CONTROL_PORT
     */
    if (args1) {
        morse_ip = args1;
    }
    if (args2) {
        morse_sensors_port = atoi(args2);
        morse_control_port = morse_sensors_port+1;
    }
    if (args3) {
        morse_control_port = atoi(args3);
    }

    if (strstr(frame_option, "-rover")) {
        output_type = OUTPUT_ROVER;
    } else if (strstr(frame_option, "-quad")) {
        output_type = OUTPUT_QUAD;
    } else if (strstr(frame_option, "-pwm")) {
        output_type = OUTPUT_PWM;
    } else {
        // default to rover
        output_type = OUTPUT_ROVER;
    }

    for (uint8_t i=0; i<ARRAY_SIZE(sim_defaults); i++) {
        AP_Param::set_default_by_name(sim_defaults[i].name, sim_defaults[i].value);
        if (sim_defaults[i].save) {
            enum ap_var_type ptype;
            AP_Param *p = AP_Param::find(sim_defaults[i].name, &ptype);
            if (!p->configured()) {
                p->save();
            }
        }
    }
    printf("Started Morse with %s:%u:%u type %u\n",
           morse_ip, morse_sensors_port, morse_control_port,
           (unsigned)output_type);
}
开发者ID:KIrill-ka,项目名称:ardupilot,代码行数:49,代码来源:SIM_Morse.cpp


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