public bool HasIndexedFiles()
        {
            foreach (VelodyneDataLine dataLine in this.DataLines)
            {
                String pcapFile = this.project.Folder + "\\" + this.SubFolder + "\\" + dataLine.PcapLocation;
                if ((!(File.Exists(VelodyneConverter.GetDefaultIndexFile(pcapFile)))) || (!(File.Exists(VelodyneConverter.GetDefaultIndexFile(pcapFile)))))
                {
                    return(false);
                }
            }

            return(true);
        }
        private void VelodyneStreamWnd_Load(object sender, EventArgs e)
        {
            MainForm         form      = (MainForm)this.MdiParent;
            VelodyneDataLine dataLine  = ((VelodyneDataLine)DataStream.DataLines[0]);
            String           pcapFile  = form.Project.Folder + "\\" + DataStream.SubFolder + "\\" + dataLine.PcapLocation;
            String           indexFile = VelodyneConverter.GetDefaultIndexFile(pcapFile);
            String           pointFile = VelodyneConverter.GetDefaultPointFile(pcapFile);

            ProgressBarWnd wnd = new ProgressBarWnd();

            wnd.Text           = "Load data stream: " + ((VelodyneDataStream)DataStream).ShortName;
            wnd.Worker.DoWork += delegate(object senderWorker, DoWorkEventArgs eWorker)
            {
                VelodyneReader.ClearProgressReport();
                VelodyneReader.ProgressReport += delegate(object senderReader, ProgressReportEventArgs argsReport)
                {
                    form.ReportProgress(argsReport.Precentage);
                    logger.WriteInfo(argsReport.CurrentDataTime.ToString("yyy-MM-dd hh:mm:ss") + " " + argsReport.ReadBytes / 1000000 + " MB " + argsReport.Precentage.ToString("0.00") + "%" + Environment.NewLine);
                    wnd.WriteLine(argsReport.CurrentDataTime.ToString("yyy-MM-dd hh:mm:ss") + " " + argsReport.ReadBytes / 1000000 + " MB " + argsReport.Precentage.ToString("0.00") + "%" + Environment.NewLine);

                    ((BackgroundWorker)senderWorker).ReportProgress(Convert.ToInt32(argsReport.Precentage));
                };

                veloReader = VelodyneReader.Open(((VelodyneDataStream)DataStream).SensorType, ReturnMode.StrongestReturnOnly, indexFile, pointFile);
            };

            wnd.Worker.RunWorkerCompleted += delegate(object senderWorker, RunWorkerCompletedEventArgs eWorker)
            {
                wnd.Close();
                form.ReportProgress(100);

                // set scroll bar
                idxStart = veloReader.Indeces.First();
                IndexData idxLast = veloReader.Indeces.Last();
                trackBar.Minimum = 0;
                trackBar.Maximum = Convert.ToInt32((idxLast.InternalTimeStamp.Ticks - idxStart.InternalTimeStamp.Ticks) / TimeSpan.TicksPerSecond);

                this.Text = "Streams: ";
                foreach (VelodyneDataStream ds in this.VeodyneDataStreams)
                {
                    this.Text += ds.ShortName + " ";
                }

                // set reader to the first index
                veloReader.Seek(idxStart);
                viewer.Render();
            };

            wnd.ShowDialog();
        }
Пример #3
0
        static void Main(string[] args)
        {
            //String pcapFile = @"F:\CAR\2017_08_28_2\Velodynes\VHDL\2017-08-28-16-01-45_Velodyne-HDL-32-Data.pcap";
            //String pcapFile = @"E:\CAR\2017_10_13\Velodynes\VWHITE\2017-10-13-12-11-18_Velodyne-VLP-16-Data.pcap";
            //String pcapFile = @"E:\CAR\2017_10_13\Velodynes\VRED\2017-10-13-12-03-19_Velodyne-VLP-16-Data.pcap";
            String pcapFile  = @"E:\CAR\2017_10_13\Velodynes\VGREEN\2017-10-13-12-04-11_Velodyne-VLP-16-Data.pcap";
            String indexFile = VelodyneConverter.GetDefaultIndexFile(pcapFile);
            String pointFile = VelodyneConverter.GetDefaultPointFile(pcapFile);

            /*String indexFile = @"E:\CAR\2017_08_28_2\Velodynes\VRED\2017-08-28-15-59-48_Velodyne-VLP-16-Data.pcap.idx";
             * String pointFile = @"E:\CAR\2017_08_28_2\Velodynes\VRED\2017-08-28-15-59-48_Velodyne-VLP-16-Data.pcap.bin";
             * VelodyneReader veloReader = new VelodyneReader(VelodyneReader.SensorType.VLP16, indexFile, pointFile);*/

            /*VelodyneConverter converter = VelodyneConverter.Create(pcapFile);
             * converter.ProgressReport += Converter_ProgressReport;
             * converter.Convert();
             * Console.WriteLine("Conversion is done!");
             * return;*/

            Console.WriteLine("Done.");
            List <VelodynePoint> pts = new List <VelodynePoint>();

            using (VelodyneReader veloReader = VelodyneReader.Open(VelodyneSensorType.VLP16, ReturnMode.LastReturnOnly, indexFile, pointFile))
            {
                //veloReader.AnalysOffset();

                IndexData idx = veloReader.FindIndexByTime(new DateTime(2017, 10, 13, 16, 45, 04, 0), VelodyneReader.SearchType.FLOOR);
                veloReader.SeekByTime(new DateTime(2017, 10, 13, 16, 52, 04, 0));
                Console.WriteLine(idx.PacketTimeStamp.ToString("yyyy-MM-dd HH:mm:ss") + " NMEA: " + idx.InternalTimeStamp.ToString("yyyy-MM-dd HH:mm:ss") + " Pos: " + idx.Position + " NMEA: " + idx.Nmea.NmeaString);

                for (int k = 0; k < 1000; k++)
                {
                    VelodynePacket packet = veloReader.ReadNext();

                    if (packet is VelodynePointPacket)
                    {
                        VelodynePointPacket pointPacket = packet as VelodynePointPacket;
                    }
                }

                Console.WriteLine("done.");
                Console.ReadKey();
                Simple3dViewerWnd viewer = new Simple3dViewerWnd(veloReader);
                viewer.ShowDialog();
            }



            Console.ReadKey();
        }