• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SGPropertyNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getNode

void FGPropertyManager::SetWritable (const string &name, bool state )
{
  SGPropertyNode * node = getNode(name.c_str());
  if (node == 0)
    cerr <<
           "Attempt to set write flag for non-existant property "
           << name << endl;
  else
    node->setAttribute(SGPropertyNode::WRITE, state);
}
开发者ID:AnandBiradar,项目名称:jsbsim,代码行数:10,代码来源:FGPropertyManager.cpp


示例2: getNode

void FGPropertyNode::SetReadable (const string &name, bool state )
{
  SGPropertyNode * node = getNode(name.c_str());
  if (node == 0)
    cerr <<
           "Attempt to set read flag for non-existant property "
           << name << endl;
  else
    node->setAttribute(SGPropertyNode::READ, state);
}
开发者ID:ToninoTarsi,项目名称:jsbsim,代码行数:10,代码来源:FGPropertyManager.cpp


示例3: Actuators_close

void Actuators_close() {
    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/actuators", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "actuator" ) {
	    string module = section->getChild("module", 0, true)->getStringValue();
	    bool enabled = section->getChild("enable", 0, true)->getBoolValue();
	    if ( !enabled ) {
		continue;
	    }
	    if ( module == "null" ) {
		// do nothing
	    } else if ( module == "ardupilot" ) {
		ardupilot_close();
	    } else if ( module == "fgfs" ) {
		fgfs_act_close();
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( module == "mnav" ) {
		// do nothing
#endif // ENABLE_MNAV_SENSOR
	    } else {
		printf("Unknown actuator = '%s' in config file\n",
		       module.c_str());
	    }
	}
    }
}
开发者ID:metiscus,项目名称:microgear,代码行数:29,代码来源:act_mgr.cpp


示例4: AirData_close

void AirData_close() {
    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/sensors/air-data-group", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "airdata" ) {
	    string source = section->getChild("source", 0, true)->getStringValue();
	    string basename = "/sensors/";
	    basename += section->getDisplayName();
	    // printf("i = %d  name = %s source = %s %s\n",
	    //	   i, name.c_str(), source.c_str(), basename.c_str());
	    if ( source == "null" ) {
		// do nothing
	    } else if ( source == "fgfs" ) {
		// nop
	    } else if ( source == "ardupilot" ) {
		// nop
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( source == "mnav" ) {
		// nop
#endif
	    } else {
		printf("Unknown air data source = '%s' in config file\n",
		       source.c_str());
	    }
	}
    }
}
开发者ID:metiscus,项目名称:microgear,代码行数:29,代码来源:airdata_mgr.cpp


示例5: gpsd_send_init

// send our configured init strings to configure gpsd the way we prefer
static void gpsd_send_init() {
    if ( !socket_connected ) {
	return;
    }

    for ( int i = 0; i < configroot->nChildren(); ++i ) {
        SGPropertyNode *child = configroot->getChild(i);
        string cname = child->getName();
        string cval = child->getStringValue();
	if ( cname == "init-string" ) {
	    if ( display_on ) {
		printf("sending to gpsd: %s\n", cval.c_str());
	    }
	    if ( gpsd_sock.send( cval.c_str(), cval.length() ) < 0 ) {
		socket_connected = false;
	    }
	}
    }

    last_init_time = get_Time();
}
开发者ID:metiscus,项目名称:microgear,代码行数:22,代码来源:gps_gpsd.cpp


示例6: Untie

void FGPropertyManager::Untie (const string &name)
{
  SGPropertyNode* property = root->getNode(name.c_str());
  if (!property) {
    cerr << "Attempt to untie a non-existant property." << name << endl;
    return;
  }

  vector <SGPropertyNode_ptr>::iterator it;
  for (it = tied_properties.begin(); it != tied_properties.end(); ++it) {
    if (*it == property) {
      property->untie();
      tied_properties.erase(it);
      if (FGJSBBase::debug_lvl & 0x20) cout << "Untied " << name << endl;
      return;
    }
  }

  cerr << "Failed to untie property " << name << endl
       << "JSBSim is not the owner of this property." << endl;
}
开发者ID:ToninoTarsi,项目名称:jsbsim,代码行数:21,代码来源:FGPropertyManager.cpp


示例7: Actuator_init

void Actuator_init() {
    debug6a.set_name("debug6a act update and output");
    debug6b.set_name("debug6b act console logging");

    // bind properties
    output_aileron_node = fgGetNode("/controls/flight/aileron", true);
    output_elevator_node = fgGetNode("/controls/flight/elevator", true);
    output_elevator_damp_node = fgGetNode("/controls/flight/elevator-damp", true);
    output_throttle_node = fgGetNode("/controls/engine/throttle", true);
    output_rudder_node = fgGetNode("/controls/flight/rudder", true);

    act_elevon_mix_node = fgGetNode("/config/actuators/elevon-mixing", true);
    agl_alt_ft_node = fgGetNode("/position/altitude-agl-ft", true);

    act_timestamp_node = fgGetNode("/actuators/actuator/time-stamp", true);
    act_aileron_node = fgGetNode("/actuators/actuator/channel", 0, true);
    act_elevator_node = fgGetNode("/actuators/actuator/channel", 1, true);
    act_throttle_node = fgGetNode("/actuators/actuator/channel", 2, true);
    act_rudder_node = fgGetNode("/actuators/actuator/channel", 3, true);
    act_channel5_node = fgGetNode("/actuators/actuator/channel", 4, true);
    act_channel6_node = fgGetNode("/actuators/actuator/channel", 5, true);
    act_channel7_node = fgGetNode("/actuators/actuator/channel", 6, true);
    act_channel8_node = fgGetNode("/actuators/actuator/channel", 7, true);

    // initialize comm nodes
    act_console_skip = fgGetNode("/config/remote-link/actuator-skip", true);
    act_logging_skip = fgGetNode("/config/logging/actuator-skip", true);

    // throttle safety
    throttle_safety_prop_node
	= fgGetNode("/config/actuators/throttle-safety/prop", true);
    if ( (string)throttle_safety_prop_node->getStringValue() != (string)"" ) {
	throttle_safety_val_node
	    = fgGetNode(throttle_safety_prop_node->getStringValue(), true);
    }
    throttle_safety_min_node
	= fgGetNode("/config/actuators/throttle-safety/min-value", true);

    // master autopilot switch
    ap_master_switch_node = fgGetNode("/autopilot/master-switch", true);
    fcs_mode_node = fgGetNode("/config/fcs/mode", true);

    // default to ap on unless pilot inputs turn it off (so we can run
    // with no pilot inputs connected)
    ap_master_switch_node->setBoolValue( true );

    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/actuators", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "actuator" ) {
	    string module = section->getChild("module", 0, true)->getStringValue();
	    bool enabled = section->getChild("enable", 0, true)->getBoolValue();
	    if ( !enabled ) {
		continue;
	    }
	    printf("i = %d  name = %s module = %s\n",
	    	   i, name.c_str(), module.c_str());

	    if ( module == "null" ) {
		// do nothing
	    } else if ( module == "ardupilot" ) {
		ardupilot_init( section );
	    } else if ( module == "fgfs" ) {
		fgfs_act_init( section );
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( module == "mnav" ) {
		mnav_act_init();
#endif // ENABLE_MNAV_SENSOR
	    } else {
		printf("Unknown actuator = '%s' in config file\n",
		       module.c_str());
	    }
	}
    }
}
开发者ID:metiscus,项目名称:microgear,代码行数:77,代码来源:act_mgr.cpp


示例8: Actuator_update

bool Actuator_update() {
    debug6a.start();

    // time stamp for logging
    act_timestamp_node->setDoubleValue( get_Time() );
    if ( ap_master_switch_node->getBoolValue() ) {
	set_actuator_values_ap();
    } else {
	set_actuator_values_pilot();
    }

    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/actuators", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "actuator" ) {
	    string module = section->getChild("module", 0, true)->getStringValue();
	    bool enabled = section->getChild("enable", 0, true)->getBoolValue();
	    if ( !enabled ) {
		continue;
	    }
	    if ( module == "null" ) {
		// do nothing
	    } else if ( module == "ardupilot" ) {
		ardupilot_update();
	    } else if ( module == "fgfs" ) {
		fgfs_act_update();
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( module == "mnav" ) {
		mnav_send_short_servo_cmd( /* &servo_out */ );
#endif // ENABLE_MNAV_SENSOR
	    } else {
		printf("Unknown actuator = '%s' in config file\n",
		       module.c_str());
	    }
	}
    }

    debug6a.stop();

    debug6b.start();

    if ( remote_link_on || log_to_file ) {
	// actuators

	uint8_t buf[256];
	int size = packetizer->packetize_actuator( buf );

	if ( remote_link_on ) {
	    remote_link_actuator( buf, size, act_console_skip->getIntValue() );
	}

	if ( log_to_file ) {
	    log_actuator( buf, size, act_logging_skip->getIntValue() );
	}
    }

    debug6b.stop();

    return true;
}
开发者ID:metiscus,项目名称:microgear,代码行数:62,代码来源:act_mgr.cpp


示例9: AirData_init

void AirData_init() {
    debug2b1.set_name("debug2b1 airdata update");
    debug2b2.set_name("debug2b2 airdata console link");

    // initialize air data property nodes
    airdata_timestamp_node = fgGetNode("/sensors/air-data/time-stamp", true);
    airdata_altitude_node = fgGetNode("/sensors/air-data/altitude-m", true);
    airdata_airspeed_node = fgGetNode("/sensors/air-data/airspeed-kt", true);

    // input property nodes
    filter_timestamp_node = fgGetNode("/filters/filter/time-stamp", true);
    filter_alt_node = fgGetNode("/position/altitude-m", true);

    // filtered/computed output property nodes
    altitude_filt_node = fgGetNode("/position/altitude-pressure-m", true);
    airspeed_filt_node = fgGetNode("/velocity/airspeed-kt", true);

    true_alt_ft_node = fgGetNode("/position/altitude-true-combined-ft",true);
    agl_alt_ft_node = fgGetNode("/position/altitude-pressure-agl-ft", true);

    pressure_error_m_node
	= fgGetNode("/position/pressure-error-m", true);
    vert_fps_node
	= fgGetNode("/velocity/pressure-vertical-speed-fps",true);
    forward_accel_node = fgGetNode("/acceleration/airspeed-ktps",true);
    ground_alt_press_m_node
        = fgGetNode("/position/ground-altitude-pressure-m", true);

    // initialize comm nodes
    airdata_console_skip = fgGetNode("/config/remote-link/airdata-skip", true);
    airdata_logging_skip = fgGetNode("/config/logging/airdata-skip", true);

    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/sensors/air-data-group", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "air-data" ) {
	    string source = section->getChild("source", 0, true)->getStringValue();
	    bool enabled = section->getChild("enable", 0, true)->getBoolValue();
	    if ( !enabled ) {
		continue;
	    }
	    string basename = "/sensors/";
	    basename += section->getDisplayName();
	    printf("i = %d  name = %s source = %s %s\n",
		   i, name.c_str(), source.c_str(), basename.c_str());
	    if ( source == "null" ) {
		// do nothing
	    } else if ( source == "ardupilot" ) {
		ardupilot_airdata_init( basename );
	    } else if ( source == "fgfs" ) {
		fgfs_airdata_init( basename );
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( source == "mnav" ) {
		mnav_airdata_init( basename );
#endif // ENABLE_MNAV_SENSOR
	    } else {
		printf("Unknown air data source = '%s' in config file\n",
		       source.c_str());
	    }
	}
    }
}
开发者ID:metiscus,项目名称:microgear,代码行数:64,代码来源:airdata_mgr.cpp


示例10: AirData_update

bool AirData_update() {
    debug2b1.start();

    air_prof.start();

    bool fresh_data = false;

    // traverse configured modules
    SGPropertyNode *toplevel = fgGetNode("/config/sensors/air-data-group", true);
    for ( int i = 0; i < toplevel->nChildren(); ++i ) {
	SGPropertyNode *section = toplevel->getChild(i);
	string name = section->getName();
	if ( name == "air-data" ) {
	    string source = section->getChild("source", 0, true)->getStringValue();
	    bool enabled = section->getChild("enable", 0, true)->getBoolValue();
	    if ( !enabled ) {
		continue;
	    }
	    string basename = "/sensors/";
	    basename += section->getDisplayName();
	    // printf("i = %d  name = %s source = %s %s\n",
	    //	   i, name.c_str(), source.c_str(), basename.c_str());
	    if ( source == "null" ) {
		// do nothing
	    } else if ( source == "ardupilot" ) {
		fresh_data = ardupilot_airdata_update();
	    } else if ( source == "fgfs" ) {
		fresh_data = fgfs_airdata_update();
#ifdef ENABLE_MNAV_SENSOR
	    } else if ( source == "mnav" ) {
		fresh_data = mnav_get_airdata();
#endif // ENABLE_MNAV_SENSOR
	    } else {
		printf("Unknown air data source = '%s' in config file\n",
		       source.c_str());
	    }
	}
    }

    debug2b1.stop();
    debug2b2.start();

    if ( fresh_data ) {
	update_pressure_helpers();

	if ( remote_link_on || log_to_file ) {
	    uint8_t buf[256];
	    int size = packetizer->packetize_airdata( buf );

	    if ( remote_link_on ) {
		// printf("sending filter packet\n");
		remote_link_airdata( buf, size,
				      airdata_console_skip->getIntValue() );
	    }

	    if ( log_to_file ) {
		log_airdata( buf, size, airdata_logging_skip->getIntValue() );
	    }
	}
    }

    debug2b2.stop();

    air_prof.stop();

    return fresh_data;
}
开发者ID:metiscus,项目名称:microgear,代码行数:67,代码来源:airdata_mgr.cpp


示例11: bind_output

// initialize gpsd output property nodes 
static void bind_output( string rootname ) {
    SGPropertyNode *outputroot = fgGetNode( rootname.c_str(), true );
    gps_timestamp_node = outputroot->getChild("time-stamp", 0, true);
    gps_lat_node = outputroot->getChild("latitude-deg", 0, true);
    gps_lon_node = outputroot->getChild("longitude-deg", 0, true);
    gps_alt_node = outputroot->getChild("altitude-m", 0, true);
    gps_ve_node = outputroot->getChild("ve-ms", 0, true);
    gps_vn_node = outputroot->getChild("vn-ms", 0, true);
    gps_vd_node = outputroot->getChild("vd-ms", 0, true);
    gps_unix_sec_node = outputroot->getChild("unix-time-sec", 0, true);

    gps_device_name = outputroot->getChild("device-name", 0, true);
    gps_satellites = outputroot->getChild("satellites", 0, true);
    gps_nmode = outputroot->getChild("nmea-mode", 0, true);
}
开发者ID:metiscus,项目名称:microgear,代码行数:16,代码来源:gps_gpsd.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SGVector类代码示例发布时间:2022-05-31
下一篇:
C++ SGMatrix类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap