示例#1
0
 /// <summary>
 ///     Initializes the NavX singleton
 /// </summary>
 /// <param name="serialPortId">port that the NavX is plugged into</param>
 /// <param name="dataType">sets the type of data, processed or raw</param>
 /// <param name="updateRateHz">the update rate of the NavX - default 50Hz</param>
 internal static NavX InitializeNavX(SerialPort.Port serialPortId,
                                     SerialDataType dataType = SerialDataType.KProcessedData, byte updateRateHz = 50)
 {
     if (_lazy != null)
     {
         Report.Error(
             @"A NavX instance already been created, someone other than Config is trying to create an instance.");
     }
     _lazy = new Lazy <NavX>(() => new NavX(serialPortId, dataType, updateRateHz));
     return(Instance);
 }
示例#2
0
        const bool debug = false; /* Set to true to enable debug output (to smart dashboard) */

        public SerialIO(SerialPort.Port port_id, byte update_rate_hz, bool processed_data, IIoCompleteNotification notify_sink, IBoardCapabilities board_capabilities)
        {
            this.serial_port_id = port_id;
            ypr_update_data = new IMUProtocol.YPRUpdate();
            gyro_update_data = new IMUProtocol.GyroUpdate();
            ahrs_update_data = new AHRSProtocol.AHRSUpdate();
            ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
            board_id = new AHRSProtocol.BoardID();
            board_state = new BoardState();
            this.notify_sink = notify_sink;
            this.board_capabilities = board_capabilities;
            serial_port = GetMaybeCreateSerialPort();
            this.update_rate_hz = update_rate_hz;
            if (processed_data)
            {
                update_type = AHRSProtocol.MSGID_AHRSPOS_UPDATE;
            }
            else {
                update_type = IMUProtocol.MSGID_GYRO_UPDATE;
            }
        }
示例#3
0
        const bool debug = false; /* Set to true to enable debug output (to smart dashboard) */

        public SerialIO(SerialPort.Port port_id, byte update_rate_hz, bool processed_data, IIoCompleteNotification notify_sink, IBoardCapabilities board_capabilities)
        {
            this.serial_port_id     = port_id;
            ypr_update_data         = new IMUProtocol.YPRUpdate();
            gyro_update_data        = new IMUProtocol.GyroUpdate();
            ahrs_update_data        = new AHRSProtocol.AHRSUpdate();
            ahrspos_update_data     = new AHRSProtocol.AHRSPosUpdate();
            board_id                = new AHRSProtocol.BoardID();
            board_state             = new BoardState();
            this.notify_sink        = notify_sink;
            this.board_capabilities = board_capabilities;
            serial_port             = GetMaybeCreateSerialPort();
            this.update_rate_hz     = update_rate_hz;
            if (processed_data)
            {
                update_type = AHRSProtocol.MSGID_AHRSPOS_UPDATE;
            }
            else
            {
                update_type = IMUProtocol.MSGID_GYRO_UPDATE;
            }
        }
示例#4
0
 private NavX(SerialPort.Port serialPortId, SerialDataType dataType = SerialDataType.KProcessedData,
              byte updateRateHz = 50) : base(serialPortId, dataType, updateRateHz)
 {
 }