这篇教程C++ AP_SerialManager类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AP_SerialManager类的典型用法代码示例。如果您正苦于以下问题:C++ AP_SerialManager类的具体用法?C++ AP_SerialManager怎么用?C++ AP_SerialManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AP_SerialManager类的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: protocol/* * init - perform required initialisation * for Copter */void AP_Frsky_Telem::init(const AP_SerialManager &serial_manager, const char *firmware_str, const uint8_t mav_type, AP_Float *fs_batt_voltage, AP_Float *fs_batt_mah, uint32_t *ap_value, int32_t *home_distance, int32_t *home_bearing){ // check for protocol configured for a serial port - only the first serial port with one of these protocols will then run (cannot have FrSky on multiple serial ports) if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_D, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_D; // FrSky D protocol (D-receivers) } else if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_SPort, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_SPort; // FrSky SPort protocol (X-receivers) } else if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_SPort_Passthrough, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_SPort_Passthrough; // FrSky SPort and SPort Passthrough (OpenTX) protocols (X-receivers) // add firmware and frame info to message queue queue_message(MAV_SEVERITY_INFO, firmware_str); // save main parameters locally _params.mav_type = mav_type; // frame type (see MAV_TYPE in Mavlink definition file common.h) _params.fs_batt_voltage = fs_batt_voltage; // failsafe battery voltage in volts _params.fs_batt_mah = fs_batt_mah; // failsafe reserve capacity in mAh _ap.value = ap_value; // ap bit-field _ap.home_distance = home_distance; _ap.home_bearing = home_bearing; } if (_port != NULL) { hal.scheduler->register_io_process(FUNCTOR_BIND_MEMBER(&AP_Frsky_Telem::tick, void)); // we don't want flow control for either protocol _port->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); }
开发者ID:Metello,项目名称:ardupilot,代码行数:29,
示例2: protocol/* * init - perform required initialisation */void AP_Frsky_Telem::init(const AP_SerialManager &serial_manager, const char *firmware_str, const uint8_t mav_type, const AP_Float *fs_batt_voltage, const AP_Float *fs_batt_mah, const uint32_t *ap_valuep){ // check for protocol configured for a serial port - only the first serial port with one of these protocols will then run (cannot have FrSky on multiple serial ports) if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_D, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_D; // FrSky D protocol (D-receivers) } else if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_SPort, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_SPort; // FrSky SPort protocol (X-receivers) } else if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FrSky_SPort_Passthrough, 0))) { _protocol = AP_SerialManager::SerialProtocol_FrSky_SPort_Passthrough; // FrSky SPort and SPort Passthrough (OpenTX) protocols (X-receivers) // make frsky_telemetry available to GCS_MAVLINK (used to queue statustext messages from GCS_MAVLINK) gcs().register_frsky_telemetry_callback(this); // add firmware and frame info to message queue queue_message(MAV_SEVERITY_INFO, firmware_str); // save main parameters locally _params.mav_type = mav_type; // frame type (see MAV_TYPE in Mavlink definition file common.h) _params.fs_batt_voltage = fs_batt_voltage; // failsafe battery voltage in volts _params.fs_batt_mah = fs_batt_mah; // failsafe reserve capacity in mAh if (ap_valuep == nullptr) { // ap bit-field _ap.value = 0x2000; // set "initialised" to 1 for rover and plane _ap.valuep = &_ap.value; } else { _ap.valuep = ap_valuep; } } if (_port != nullptr) { hal.scheduler->register_io_process(FUNCTOR_BIND_MEMBER(&AP_Frsky_Telem::tick, void)); // we don't want flow control for either protocol _port->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); }
开发者ID:FantasyJXF,项目名称:ardupilot,代码行数:33,
示例3: if// init - perform require initialisation including detecting which protocol to usevoid AP_Frsky_Telem::init(const AP_SerialManager& serial_manager){ // check for FRSky_DPort if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FRSky_DPort, 0))) { _protocol = FrSkyDPORT; _initialised_uart = true; // SerialManager initialises uart for us } else if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_FRSky_SPort, 0))) { // check for FRSky_SPort _protocol = FrSkySPORT; _gps_call = 0; _fas_call = 0; _vario_call = 0 ; _various_call = 0 ; _gps_data_ready = false; _battery_data_ready = false; _baro_data_ready = false; _mode_data_ready = false; _sats_data_ready = false; _sport_status = 0; hal.scheduler->register_io_process(AP_HAL_MEMBERPROC(&AP_Frsky_Telem::sport_tick)); } if (_port != NULL) { // we don't want flow control for either protocol _port->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); }}
开发者ID:0919061,项目名称:ardupilot,代码行数:28,
示例4: AP_Beacon_Backend// constructorAP_Beacon_Pozyx::AP_Beacon_Pozyx(AP_Beacon &frontend, AP_SerialManager &serial_manager) : AP_Beacon_Backend(frontend), linebuf_len(0){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Beacon, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Beacon, 0)); }}
开发者ID:ArduPilot,项目名称:ardupilot,代码行数:10,
示例5: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_uLanding::AP_RangeFinder_uLanding(RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager) : AP_RangeFinder_Backend(_state){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Aerotenna_uLanding, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Aerotenna_uLanding, 0)); }}
开发者ID:LanderU,项目名称:ardupilot,代码行数:14,
示例6: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_LeddarOne::AP_RangeFinder_LeddarOne(RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager) : AP_RangeFinder_Backend(_state){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Lidar, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Lidar, 0)); }}
开发者ID:BrendanSmith,项目名称:ardupilot,代码行数:14,
示例7: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_LeddarOne::AP_RangeFinder_LeddarOne(RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager, uint8_t serial_instance) : AP_RangeFinder_Backend(_state){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance)); }}
开发者ID:Benbenbeni,项目名称:ardupilot-1,代码行数:15,
示例8: detect/* The constructor also initialises the proximity sensor. Note that this constructor is not called until detect() returns true, so we already know that we should setup the proximity sensor*/AP_Proximity_LightWareSF40C::AP_Proximity_LightWareSF40C(AP_Proximity &_frontend, AP_Proximity::Proximity_State &_state, AP_SerialManager &serial_manager) : AP_Proximity_Backend(_frontend, _state){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Lidar360, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Lidar360, 0)); }}
开发者ID:ArmaJo,项目名称:ardupilot,代码行数:15,
示例9: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_uLanding::AP_RangeFinder_uLanding(RangeFinder &_ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager) : AP_RangeFinder_Backend(_ranger, instance, _state, MAV_DISTANCE_SENSOR_RADAR){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Aerotenna_uLanding, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Aerotenna_uLanding, 0)); }}
开发者ID:CUAir,项目名称:ardupilot,代码行数:15,
示例10: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_MaxsonarSerialLV::AP_RangeFinder_MaxsonarSerialLV(RangeFinder &_ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager) : AP_RangeFinder_Backend(_ranger, instance, _state){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Lidar, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Lidar, 0)); }}
开发者ID:IISAR,项目名称:ardupilot,代码行数:15,
示例11: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_LightWareSerial::AP_RangeFinder_LightWareSerial(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params, AP_SerialManager &serial_manager, uint8_t serial_instance) : AP_RangeFinder_Backend(_state, _params){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance)); }}
开发者ID:jyl58,项目名称:ardupilot,代码行数:16,
示例12: detect/* The constructor also initialises the rangefinder. Note that this constructor is not called until detect() returns true, so we already know that we should setup the rangefinder*/AP_RangeFinder_Benewake::AP_RangeFinder_Benewake(RangeFinder::RangeFinder_State &_state, AP_SerialManager &serial_manager, uint8_t serial_instance, benewake_model_type model) : AP_RangeFinder_Backend(_state), model_type(model){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Rangefinder, serial_instance)); }}
开发者ID:langfan1990,项目名称:ardupilot,代码行数:17,
示例13: init/// Startup initialisation.void AP_GPS::init(DataFlash_Class *dataflash, const AP_SerialManager& serial_manager){ _DataFlash = dataflash; primary_instance = 0; // search for serial ports with gps protocol _port[0] = serial_manager.find_serial(AP_SerialManager::SerialProtocol_GPS, 0);#if GPS_MAX_INSTANCES > 1 _port[1] = serial_manager.find_serial(AP_SerialManager::SerialProtocol_GPS, 1); _last_instance_swap_ms = 0;#endif}
开发者ID:Bjarne-Madsen,项目名称:ardupilot,代码行数:14,
示例14: AP_Beacon_BackendAP_Beacon_Marvelmind::AP_Beacon_Marvelmind(AP_Beacon &frontend, AP_SerialManager &serial_manager) : AP_Beacon_Backend(frontend){ uart = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Beacon, 0); if (uart != nullptr) { uart->begin(serial_manager.find_baudrate(AP_SerialManager::SerialProtocol_Beacon, 0)); last_update_ms = 0; parse_state = RECV_HDR; // current state of receive data num_bytes_in_block_received = 0; // bytes received data_id = 0; hedge._have_new_values = false; hedge.positions_beacons.num_beacons = 0; hedge.positions_beacons.updated = false; }}
开发者ID:ArduPilot,项目名称:ardupilot,代码行数:16,
示例15: // init - performs any required initialisation for this instancevoid AP_Mount_SToRM32::init(const AP_SerialManager& serial_manager){ // get_mavlink_channel for MAVLink2 if (serial_manager.get_mavlink_channel(AP_SerialManager::SerialProtocol_MAVLink2, _chan)) { _initialised = true; set_mode((enum MAV_MOUNT_MODE)_state._default_mode.get()); }}
开发者ID:APM602,项目名称:APM602,代码行数:9,
示例16: begin/* setup a UART, handling begin() and init() */voidGCS_MAVLINK::setup_uart(const AP_SerialManager& serial_manager, AP_SerialManager::SerialProtocol protocol, uint8_t instance){ // search for serial port AP_HAL::UARTDriver *uart; uart = serial_manager.find_serial(protocol, instance); if (uart == NULL) { // return immediately if not found return; } // get associated mavlink channel mavlink_channel_t mav_chan; if (!serial_manager.get_mavlink_channel(protocol, instance, mav_chan)) { // return immediately in unlikely case mavlink channel cannot be found return; } /* Now try to cope with SiK radios that may be stuck in bootloader mode because CTS was held while powering on. This tells the bootloader to wait for a firmware. It affects any SiK radio with CTS connected that is externally powered. To cope we send 0x30 0x20 at 115200 on startup, which tells the bootloader to reset and boot normally */ uart->begin(115200); AP_HAL::UARTDriver::flow_control old_flow_control = uart->get_flow_control(); uart->set_flow_control(AP_HAL::UARTDriver::FLOW_CONTROL_DISABLE); for (uint8_t i=0; i<3; i++) { hal.scheduler->delay(1); uart->write(0x30); uart->write(0x20); } // since tcdrain() and TCSADRAIN may not be implemented... hal.scheduler->delay(1); uart->set_flow_control(old_flow_control); // now change back to desired baudrate uart->begin(serial_manager.find_baudrate(protocol, instance)); // and init the gcs instance init(uart, mav_chan);}
开发者ID:radiohail,项目名称:ardupilot,代码行数:49,
示例17: initvoid AP_Mount_Alexmos::init(const AP_SerialManager& serial_manager){ // check for alexmos protcol if ((_port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_AlexMos, 0))) { _initialised = true; get_boardinfo(); read_params(0); //we request parameters for profile 0 and therfore get global and profile parameters }}
开发者ID:CUAir,项目名称:ardupilot,代码行数:9,
示例18: // init - performs any required initialisation for this instancevoid AP_Mount_SToRM32_serial::init(const AP_SerialManager& serial_manager){ _port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_SToRM32, 0); if (_port) { _initialised = true; set_mode((enum MAV_MOUNT_MODE)_state._default_mode.get()); }}
开发者ID:CUAir,项目名称:ardupilot,代码行数:10,
示例19: initvoid Network::init(const AP_SerialManager& serial_manager){ port = serial_manager.find_serial(AP_SerialManager::SerialProtocol_Network, 0);#if HAL_NETWORK_DEFAULT == HAL_NETWORK_ESP8266 driver = new Network_esp8266(*this, port);#else driver = NULL;#endif memset (read_buffer,'/0',READ_BUFFER_SIZE); memset (send_buffer,'/0',SEND_BUFFER_SIZE);}
开发者ID:tommp,项目名称:SARGoose,代码行数:10,
示例20: // detect if a Lightware proximity sensor is connected by looking for a configured serial portbool AP_Proximity_LightWareSF40C::detect(AP_SerialManager &serial_manager){ return serial_manager.find_serial(AP_SerialManager::SerialProtocol_Lidar360, 0) != nullptr;}
开发者ID:ArmaJo,项目名称:ardupilot,代码行数:5,
示例21: get_mount_type// init - detect and initialise all mountsvoid AP_Mount::init(DataFlash_Class *dataflash, const AP_SerialManager& serial_manager){ // check init has not been called before if (_num_instances != 0) { return; } _dataflash = dataflash; // default mount to servo mount if rc output channels to control roll, tilt or pan have been defined if (!state[0]._type.configured()) { if (RC_Channel_aux::function_assigned(RC_Channel_aux::Aux_servo_function_t::k_mount_pan) || RC_Channel_aux::function_assigned(RC_Channel_aux::Aux_servo_function_t::k_mount_tilt) || RC_Channel_aux::function_assigned(RC_Channel_aux::Aux_servo_function_t::k_mount_roll)) { state[0]._type.set_and_save(Mount_Type_Servo); } } // primary is reset to the first instantiated mount bool primary_set = false; // create each instance for (uint8_t instance=0; instance<AP_MOUNT_MAX_INSTANCES; instance++) { // default instance's state state[instance]._mode = (enum MAV_MOUNT_MODE)state[instance]._default_mode.get(); MountType mount_type = get_mount_type(instance); // check for servo mounts//OW //XX if (mount_type == Mount_Type_STorM32_Native) { // we check if we can find the respective uart, it would be better to directly test the parameter field // we do this first to ensure that the MNT_TYPE setting is ignored in case a native STorM32 protocol is used // this is quite hacky, as doing it here assumes that AP_MOUNT_MAX_INSTANCES is 1 if (serial_manager.find_serial(AP_SerialManager::SerialProtocol_STorM32_Native, 0)) { _backends[instance] = new BP_Mount_Component(*this, state[instance], instance); _num_instances++; } else//OWEND if (mount_type == Mount_Type_Servo) { _backends[instance] = new AP_Mount_Servo(*this, state[instance], instance); _num_instances++;#if AP_AHRS_NAVEKF_AVAILABLE // check for MAVLink mounts } else if (mount_type == Mount_Type_SoloGimbal) { _backends[instance] = new AP_Mount_SoloGimbal(*this, state[instance], instance); _num_instances++;#endif // check for Alexmos mounts } else if (mount_type == Mount_Type_Alexmos) { _backends[instance] = new AP_Mount_Alexmos(*this, state[instance], instance); _num_instances++; // check for SToRM32 mounts using MAVLink protocol } else if (mount_type == Mount_Type_SToRM32) { _backends[instance] = new AP_Mount_SToRM32(*this, state[instance], instance); _num_instances++; // check for SToRM32 mounts using serial protocol } else if (mount_type == Mount_Type_SToRM32_serial) { _backends[instance] = new AP_Mount_SToRM32_serial(*this, state[instance], instance); _num_instances++; } // init new instance if (_backends[instance] != NULL) { _backends[instance]->init(serial_manager); if (!primary_set) { _primary = instance; primary_set = true; } } }}
开发者ID:imanhabib,项目名称:storm32bgc,代码行数:77,
示例22: setupvoid setup(void){ set_object_value_and_report(&beacon, beacon.var_info, "_TYPE", 2.0f); set_object_value_and_report(&serial_manager, serial_manager.var_info, "0_PROTOCOL", 13.0f); serial_manager.init(); beacon.init();}
开发者ID:CUAir,项目名称:ardupilot,代码行数:7,
示例23: setupvoid setup(void){ serial_manager.init(); ins.init(100); baro.init(); ahrs.init(); gps.init(NULL, serial_manager);}
开发者ID:ArmaJo,项目名称:ardupilot,代码行数:9,
示例24: setupvoid setup(){ hal.console->println("GPS AUTO library test"); hal.console->println("Test Starting"); // Initialise the leds board_led.init(); // Initialize the UART for GPS system serial_manager.init(); gps.init(NULL, serial_manager);}
开发者ID:embpgp,项目名称:ardupilot,代码行数:11,
示例25: setup//to be called only once on boot for initializing objectsvoid setup(){ hal.console->printf("GPS AUTO library test/n"); board_config.init(); // Initialise the leds board_led.init(); // Initialize the UART for GPS system serial_manager.init(); gps.init(serial_manager);}
开发者ID:mblsktxy,项目名称:ardupilot,代码行数:14,
示例26: setupvoid setup(void){ ins.init(100); ahrs.init(); serial_manager.init(); if( compass.init() ) { hal.console->printf("Enabling compass/n"); ahrs.set_compass(&compass); } else { hal.console->printf("No compass detected/n"); } gps.init(NULL, serial_manager);}
开发者ID:CR1995,项目名称:ardupilot,代码行数:14,
示例27: setupvoid setup(void){#ifdef APM2_HARDWARE // we need to stop the barometer from holding the SPI bus hal.gpio->pinMode(40, HAL_HAL_GPIO_OUTPUT); hal.gpio->write(40, HIGH);#endif ins.init(AP_InertialSensor::RATE_100HZ); ahrs.init(); serial_manager.init(); if( compass.init() ) { hal.console->printf("Enabling compass/n"); ahrs.set_compass(&compass); } else { hal.console->printf("No compass detected/n"); } gps.init(NULL, serial_manager);}
开发者ID:hk060655,项目名称:ardupilot,代码行数:21,
注:本文中的AP_SerialManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ APawn类代码示例 C++ AP_Param类代码示例 |