Ejemplo n.º 1
0
        public void SetupBasePos(ICommsSerial port, PointLatLngAlt basepos, int surveyindur = 0, double surveyinacc = 0, bool disable = false)
        {
            System.Threading.Thread.Sleep(100);
            System.Threading.Thread.Sleep(100);

            if (surveyindur == 0)
            {
                surveyindur = 60;
            }
            if (surveyinacc == 0)
            {
                surveyinacc = 2;
            }

            if (disable)
            {
                var packet = generate(0x6, 0x71, ubx_cfg_tmode3.Disable);
                port.Write(packet, 0, packet.Length);
                return;
            }

            if (basepos == PointLatLngAlt.Zero)
            {
                // survey in config
                var packet = generate(0x6, 0x71, new ubx_cfg_tmode3((uint)surveyindur, surveyinacc));
                port.Write(packet, 0, packet.Length);
            }
            else
            {
                byte[] data   = new ubx_cfg_tmode3(basepos.Lat, basepos.Lng, basepos.Alt);
                var    packet = generate(0x6, 0x71, data);
                port.Write(packet, 0, packet.Length);
            }
        }
Ejemplo n.º 2
0
        public void SetupBasePos(ICommsSerial port, PointLatLngAlt basepos, int surveyindur = 0, double surveyinacc = 0,
                                 bool disable = false, bool movingbase = false)
        {
            if (movingbase)
            {
                disable = true;
            }

            System.Threading.Thread.Sleep(100);
            System.Threading.Thread.Sleep(100);

            if (surveyindur == 0)
            {
                surveyindur = 60;
            }
            if (surveyinacc == 0)
            {
                surveyinacc = 2;
            }

            if (disable)
            {
                // disable

                var packet = generate(0x6, 0x71, ubx_cfg_tmode3.Disable);
                port.Write(packet, 0, packet.Length);
                // save - bbr
                packet = generate(0x06, 0x09, new uint8_t[] { 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0x01 });
                port.Write(packet, 0, packet.Length);
                Thread.Sleep(1000);
                //reboot
                packet = generate(0x06, 0x04, new uint8_t[] { 0x14, 0xff, 0, 0 });
                port.Write(packet, 0, packet.Length);
                Thread.Sleep(3000);
                return;
            }

            if (basepos == PointLatLngAlt.Zero)
            {
                // survey in config
                var packet = generate(0x6, 0x71, new ubx_cfg_tmode3((uint)surveyindur, surveyinacc));
                port.Write(packet, 0, packet.Length);
            }
            else
            {
                byte[] data   = new ubx_cfg_tmode3(basepos.Lat, basepos.Lng, basepos.Alt);
                var    packet = generate(0x6, 0x71, data);
                port.Write(packet, 0, packet.Length);
            }
        }
Ejemplo n.º 3
0
        public void SetupM8P(ICommsSerial port, PointLatLngAlt basepos, int surveyindur = 0, double surveyinacc = 0, bool m8p_130plus = false)
        {
            port.BaseStream.Flush();

            port.BaudRate = 9600;

            System.Threading.Thread.Sleep(100);

            // port config - 115200 - uart1
            var packet = generate(0x6, 0x00, new byte[] { 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2,
                                                          0x01, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });

            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            // port config - usb
            packet = generate(0x6, 0x00, new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                                      0x00, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            port.BaseStream.Flush();

            port.BaudRate = 115200;

            // port config - 115200 - uart1
            packet = generate(0x6, 0x00, new byte[] { 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2,
                                                      0x01, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            // port config - usb
            packet = generate(0x6, 0x00, new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                                      0x00, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            // set rate to 1hz
            packet = generate(0x6, 0x8, new byte[] { 0xE8, 0x03, 0x01, 0x00, 0x01, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(200);

            // set navmode to stationary
            packet = generate(0x6, 0x24, new byte[] { 0xFF, 0xFF, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x05, 0x00
                                                      , 0xFA, 0x00, 0xFA, 0x00, 0x64, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                                                      , 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(200);

            // turn off all nmea
            for (int a = 0; a <= 0xf; a++)
            {
                if (a == 0xb || a == 0xc || a == 0xe)
                {
                    continue;
                }
                turnon_off(port, 0xf0, (byte)a, 0);
            }

            // mon-ver
            poll_msg(port, 0xa, 0x4);

            // surveyin msg - for feedback
            turnon_off(port, 0x01, 0x3b, 1);

            // pvt msg - for feedback
            turnon_off(port, 0x01, 0x07, 1);

            // 1005 - 5s
            turnon_off(port, 0xf5, 0x05, 5);

            byte rate1 = 1;
            byte rate2 = 0;

            if (m8p_130plus)
            {
                rate1 = 0;
                rate2 = 1;
            }

            // 1074 - 1s
            turnon_off(port, 0xf5, 0x4a, rate2);
            // 1077 - 1s
            turnon_off(port, 0xf5, 0x4d, rate1);

            // 1084 - 1s
            turnon_off(port, 0xf5, 0x54, rate2);
            // 1087 - 1s
            turnon_off(port, 0xf5, 0x57, rate1);

            // 1124 - 1s
            turnon_off(port, 0xf5, 0x7c, rate2);
            // 1127 - 1s
            turnon_off(port, 0xf5, 0x7f, rate1);

            // 1230 - 5s
            turnon_off(port, 0xf5, 0xE6, 5);

            // rxm-raw/rawx - 1s
            turnon_off(port, 0x02, 0x15, 1);
            turnon_off(port, 0x02, 0x10, 1);

            // rxm-sfrb/sfrb - 2s
            turnon_off(port, 0x02, 0x13, 2);
            turnon_off(port, 0x02, 0x11, 2);


            System.Threading.Thread.Sleep(100);
            System.Threading.Thread.Sleep(100);

            if (basepos == PointLatLngAlt.Zero)
            {
                // survey in config - 60s and < 2m
                packet = generate(0x6, 0x71, new ubx_cfg_tmode3((uint)surveyindur, surveyinacc));
                port.Write(packet, 0, packet.Length);
            }
            else
            {
                byte[] data = new ubx_cfg_tmode3(basepos.Lat, basepos.Lng, basepos.Alt);
                packet = generate(0x6, 0x71, data);
                port.Write(packet, 0, packet.Length);
            }

            System.Threading.Thread.Sleep(100);
        }
Ejemplo n.º 4
0
        public void SetupM8P(ICommsSerial port, PointLatLngAlt basepos, int surveyindur = 0, double surveyinacc = 0)
        {
            port.BaseStream.Flush();

            // port config - 115200 - uart1
            var packet = generate(0x6, 0x00, new byte[] { 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2,
                0x01, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            // port config - usb
            packet = generate(0x6, 0x00, new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(300);

            // set rate to 1hz
            packet = generate(0x6, 0x8, new byte[] { 0xE8, 0x03, 0x01, 0x00, 0x01, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(200);

            // set navmode to stationary
            packet = generate(0x6, 0x24, new byte[] { 0xFF ,0xFF ,0x02 ,0x03 ,0x00 ,0x00 ,0x00 ,0x00 ,0x10 ,0x27 ,0x00 ,0x00 ,0x05 ,0x00
                ,0xFA ,0x00 ,0xFA ,0x00 ,0x64 ,0x00 ,0x2C ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x10 ,0x27 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00
                ,0x00 ,0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(200);

            // turn off all nmea
            for (int a = 0; a <= 0xf; a++)
            {
                if (a == 0xb || a == 0xc || a == 0xe)
                    continue;
                turnon_off(port, 0xf0, (byte)a, 0);
            }

            // mon-ver
            poll_msg(port, 0xa, 0x4);

            // surveyin msg - for feedback
            turnon_off(port, 0x01, 0x3b, 1);

            // pvt msg - for feedback
            turnon_off(port, 0x01, 0x07, 1);

            // 1005 - 5s
            turnon_off(port, 0xf5, 0x05, 5);

            // 1077 - 1s
            turnon_off(port, 0xf5, 0x4d, 1);

            // 1087 - 1s
            turnon_off(port, 0xf5, 0x57, 1);

            // rxm-raw/rawx - 1s
            turnon_off(port, 0x02, 0x15, 1);
            turnon_off(port, 0x02, 0x10, 1);

            // rxm-sfrb/sfrb - 5s
            turnon_off(port, 0x02, 0x13, 5);
            turnon_off(port, 0x02, 0x11, 5);


            System.Threading.Thread.Sleep(100);
            System.Threading.Thread.Sleep(100);

            if (basepos == PointLatLngAlt.Zero)
            {
                // survey in config - 60s and < 2m
                packet = generate(0x6, 0x71, new ubx_cfg_tmode3((uint)surveyindur, surveyinacc));
                port.Write(packet, 0, packet.Length);
            }
            else
            {
                byte[] data = new ubx_cfg_tmode3(basepos.Lat, basepos.Lng, basepos.Alt);
                packet = generate(0x6, 0x71, data);
                port.Write(packet, 0, packet.Length);
            }

            System.Threading.Thread.Sleep(100);
        }
Ejemplo n.º 5
0
        public void SetupM8P(ICommsSerial port, PointLatLngAlt basepos, int surveyindur = 0, double surveyinacc = 0)
        {
            // port config - 115200 - uart1
            var packet = generate(0x6, 0x00, new byte[] { 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x00, 0xC2,
                                                          0x01, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });

            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(100);

            // port config - usb
            packet = generate(0x6, 0x00, new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                                      0x00, 0x00, 0x23, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(100);

            // set rate to 1hz
            packet = generate(0x6, 0x8, new byte[] { 0xE8, 0x03, 0x01, 0x00, 0x01, 0x00 });
            port.Write(packet, 0, packet.Length);
            System.Threading.Thread.Sleep(100);

            // turn off all nmea
            for (int a = 0; a <= 0xf; a++)
            {
                turnon_off(port, 0xf0, (byte)a, 0);
            }

            // surveyin msg - for feedback
            turnon_off(port, 0x01, 0x3b, 1);

            // pvt msg - for feedback
            turnon_off(port, 0x01, 0x07, 1);

            // 1005 - 5s
            turnon_off(port, 0xf5, 0x05, 5);

            // 1077 - 1s
            turnon_off(port, 0xf5, 0x4d, 1);

            // 1087 - 1s
            turnon_off(port, 0xf5, 0x57, 1);

            // rxm-raw/rawx - 1s
            turnon_off(port, 0x02, 0x15, 1);
            turnon_off(port, 0x02, 0x10, 1);

            // rxm-sfrb/sfrb - 5s
            turnon_off(port, 0x02, 0x13, 5);
            turnon_off(port, 0x02, 0x11, 5);


            System.Threading.Thread.Sleep(100);
            System.Threading.Thread.Sleep(100);

            if (basepos == PointLatLngAlt.Zero)
            {
                // survey in config - 60s and < 2m
                packet = generate(0x6, 0x71, new ubx_cfg_tmode3(60, 2));
                port.Write(packet, 0, packet.Length);
            }
            else
            {
                byte[] data = new ubx_cfg_tmode3(basepos.Lat, basepos.Lng, basepos.Alt);
                packet = generate(0x6, 0x71, data);
                port.Write(packet, 0, packet.Length);
            }

            System.Threading.Thread.Sleep(100);
        }