Exemplo n.º 1
0
        //constructor
        public CAHRS(FormGPS _f)
        {
            mf = _f;

            //non GPS AHRS sensors
            isHeadingCorrectionFromAutoSteer = Properties.Settings.Default.setIMU_isHeadingCorrectionFromAutoSteer;
            isHeadingCorrectionFromBrick     = Properties.Settings.Default.setIMU_isHeadingCorrectionFromBrick;
            //isHeadingCorrectionFromExtUDP = Properties.Settings.Default.setIMU_isHeadingCorrectionFromExtUDP;

            isRollFromAutoSteer = Properties.Settings.Default.setIMU_isRollFromAutoSteer;
            isRollFromAVR       = Properties.Settings.Default.setIMU_isRollFromAVR;
            isRollFromOGI       = Properties.Settings.Default.setIMU_isRollFromOGI;

            rollZeroX16  = Properties.Settings.Default.setIMU_rollZeroX16;
            pitchZeroX16 = Properties.Settings.Default.setIMU_pitchZeroX16;

            isAutoSteerAuto = Properties.Settings.Default.setAS_isAutoSteerAutoOn;

            fusionWeight = Properties.Settings.Default.setIMU_fusionWeight;

            //usb IMU Tinker
            if (isHeadingCorrectionFromBrick)
            {
                ipcon = new IPConnection();               // Create IP connection
                imu   = new BrickIMUV2(CAHRS.UID, ipcon); // Create device object

                try
                {
                    ipcon.Connect(HOST, PORT); // Connect to brickd - daemon
                                               // Don't use device before ipcon is connected

                    // Register Orientation callback in AHRS class
                    imu.OrientationCallback += OrientCB;

                    // Set period for Orientation callback to 0.1s (100ms)
                    imu.SetOrientationPeriod(100);

                    //set the mode with mag
                    imu.SetSensorFusionMode(1);

                    imu.LedsOff();
                }
                catch
                {
                }
            }
        }
Exemplo n.º 2
0
        //constructor
        public CAHRS(FormGPS _f)
        {
            mf = _f;

            //non GPS AHRS sensors
            isHeadingBNO   = Properties.Settings.Default.setIMU_isHeadingFromBNO;
            isHeadingBrick = Properties.Settings.Default.setIMU_isHeadingFromBrick;
            isHeadingPAOGI = Properties.Settings.Default.setIMU_isHeadingFromPAOGI;

            isRollDogs  = Properties.Settings.Default.setIMU_isRollFromDogs;
            isRollBrick = Properties.Settings.Default.setIMU_isRollFromBrick;
            isRollPAOGI = Properties.Settings.Default.setIMU_isRollFromPAOGI;

            rollZero  = Properties.Settings.Default.setIMU_rollZero;
            pitchZero = Properties.Settings.Default.setIMU_pitchZero;

            //usb IMU Tinker
            if (isHeadingBrick | isRollBrick)
            {
                ipcon = new IPConnection();               // Create IP connection
                imu   = new BrickIMUV2(CAHRS.UID, ipcon); // Create device object

                try
                {
                    ipcon.Connect(HOST, PORT); // Connect to brickd - daemon
                    // Don't use device before ipcon is connected

                    // Register Orientation callback in AHRS class
                    imu.OrientationCallback += OrientCB;

                    // Set period for Orientation callback to 0.1s (100ms)
                    imu.SetOrientationPeriod(200);

                    //set the mode without mag
                    imu.SetSensorFusionMode(1);

                    imu.LedsOff();
                }
                catch
                {
                }
            }
        }