Beispiel #1
0
        /// <summary>
        /// Auger mounted device connect method - hokuyo lidar sensor and 3D-Imager
        /// Revised 2013-10-16 by wonjae cho
        /// </summary>
        private void AugerConnect()
        {
            this._hokuyo_graph = new SickLidar.Graph();
            this._hokuyo_graph.CreateHokuyoGraph(zg4, "Hokuyo Lidar", "X(mm)", "Y(mm)");

            if (this.AugerReadCheckBox.Checked == false)
            {
                // lidar sensor connect
                if (this.AugerLidarCheckBox.Checked == true)
                {
                    this._hokuyo = new SickLidar.Hokuyo(this.AugerLidarComboBox.SelectedIndex, 19200);

                    // if hokuyo sensor connected then save data to txt file
                    if ((this.AugerSaveCheckBox.Checked == true) && (this._hokuyo.is_connected_sensor == true))
                    {
                        this._hokuyo_file = new SickLidar.File(this.AugerSaveCheckBox.Checked, this.AugerReadCheckBox.Checked);
                    }
                }
                else
                {
                }

                // 3d-imager sensor connect
                if (this.AugerDImagerCheckBox.Checked == true)
                {
                    this.Panasonic3DImagerConnect();

                    // if 3d-imager sensor connected then save data to mpeg format
                    if ((this.AugerSaveCheckBox.Checked == true) && (this.dImager_Driver == 0))
                    {
                        this.dImager_io = new MachineVision.File();
                        this.dImager_io.InitializeDImagerIO(this.AugerSaveCheckBox.Checked, this.AugerReadCheckBox.Checked, Convert.ToInt32(this.TimerIntervalTxtBox.Text));
                    }
                }
                else
                {
                }
            }
            else
            {
                if (this.AugerLidarCheckBox.Checked == true)
                {
                    this._hokuyo      = new SickLidar.Hokuyo();
                    this._hokuyo_file = new SickLidar.File(this.AugerSaveCheckBox.Checked, this.AugerReadCheckBox.Checked);
                }

                if (this.AugerDImagerCheckBox.Checked == true)
                {
                    this.dImager_io = new MachineVision.File();
                    this.dImager_io.InitializeDImagerIO(this.AugerSaveCheckBox.Checked, this.AugerReadCheckBox.Checked, Convert.ToInt32(this.TimerIntervalTxtBox.Text));
                }
            }

            // Auger OpenGL form
            if (this.AugerOpenGlCheckBox.Checked == true)
            {
                this.augerOpenGlForm = new AugerOpenGlForm(this.BodyModelComboBox.SelectedIndex, this.AugerReadCheckBox.Checked);
                this.augerOpenGlForm.Show();
            }
        }
        /// <summary>
        /// Initialize Lidar Sensor
        /// </summary>
        private void LidarConnect()
        {
            this.isIniLidarInfo = false;

            this.graph = new SickLidar.Graph();
            this.graph.CreateGraph(zg1, zg3);

            if (this.LidarReadCheckBox.Checked == false)
            {
                this.sickLidar = new SickLidar.SickLidar(
                    this.LidarHostTxtBox.Text,
                    Convert.ToInt32(this.LidarPortTxtBox.Text),
                    this.LidarSelectComboBox.SelectedIndex,
                    Convert.ToDouble(this.LidarScalingTxtBox.Text),
                    false
                    );

                if (this.LidarSaveCheckBox.Checked == true)
                {
                    this.lidarFile = new SickLidar.File(
                        this.LidarSaveCheckBox.Checked,
                        this.LidarReadCheckBox.Checked
                        );
                }
            }
            else
            {
                this.sickLidar = new SickLidar.SickLidar(
                    this.LidarSelectComboBox.SelectedIndex,
                    Convert.ToDouble(this.LidarScalingTxtBox.Text)
                    );

                this.lidarFile = new SickLidar.File(
                    this.LidarSaveCheckBox.Checked,
                    this.LidarReadCheckBox.Checked
                    );
            }

            // openGl display
            if (this.LidarOpenGlCheckBox.Checked == true)
            {
                this.isOpenGL        = true;
                this.lidarOpenGlForm = new LidarOpenGlForm(this.BodyModelComboBox.SelectedIndex);
                this.lidarOpenGlForm.Show();
            }
        }