def after_calibration(self, response):
        ret, result = response

        if ret:
            response_platform_extrinsics = result[0]
            response_laser_triangulation = result[1]

            profile.settings['distance_left'] = response_laser_triangulation[
                0][0]
            profile.settings['normal_left'] = response_laser_triangulation[0][
                1]
            profile.settings['distance_right'] = response_laser_triangulation[
                1][0]
            profile.settings['normal_right'] = response_laser_triangulation[1][
                1]

            profile.settings['rotation_matrix'] = response_platform_extrinsics[
                0]
            profile.settings[
                'translation_vector'] = response_platform_extrinsics[1]

            profile.settings[
                'laser_triangulation_hash'] = calibration_data.md5_hash()
            profile.settings[
                'platform_extrinsics_hash'] = calibration_data.md5_hash()

            combo_calibration.accept()
        else:
            if isinstance(result, ComboCalibrationError):
                self.result_label.SetLabel(
                    _("Check the pattern and the lasers and try again"))
                dlg = wx.MessageDialog(
                    self,
                    _("Scanner calibration has failed. "
                      "Please check the pattern and the lasers and try again. "
                      "Also you can set up the calibration's settings "
                      "in the \"Adjustment workbench\" until the pattern "
                      "and the lasers are detected correctly"),
                    _("Calibration failed"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
            self.skip_button.Enable()
            self.on_finish_calibration()

        self.gauge.SetValue(100)

        if ret:
            self.skip_button.Disable()
            self.next_button.Enable()
            self.result_label.SetLabel(
                _("Success. Please press \"Next\" to continue"))
            dlg = wx.MessageDialog(self, _("Scanner calibrated correctly"),
                                   _("Success"), wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
        else:
            self.skip_button.Enable()
            self.next_button.Disable()

        self.on_finish_calibration()
示例#2
0
    def on_play_tool_clicked(self, event):
        if ciclop_scan._inactive:
            self._enable_tool_scan(self.play_tool, False)
            self._enable_tool_scan(self.pause_tool, True)
            ciclop_scan.resume()
        else:
            if not calibration_data.check_calibration():
                dlg = wx.MessageDialog(self,
                                       _("Calibration parameters are not correct.\n"
                                         "Please perform calibration process:\n"
                                         "  1. Scanner autocheck\n"
                                         "  2. Laser triangulation\n"
                                         "  3. Platform extrinsics"),
                                       _("Wrong calibration parameters"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

            if profile.settings['laser_triangulation_hash'] != calibration_data.md5_hash():
                dlg = wx.MessageDialog(self,
                                       _("Laser triangulation calibration has been performed \n"
                                         "with different camera intrinsics values.\n"
                                         "Please perform Laser triangulation calibration again:\n"
                                         "  1. Scanner autocheck\n"
                                         "  2. Laser triangulation"),
                                       _("Wrong calibration parameters"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

            if profile.settings['platform_extrinsics_hash'] != calibration_data.md5_hash():
                dlg = wx.MessageDialog(self,
                                       _("Platform extrinsics calibration has been performed \n"
                                         "with different camera intrinsics values.\n"
                                         "Please perform Platform extrinsics calibration again:\n"
                                         "  1. Scanner autocheck\n"
                                         "  2. Platform extrinsics"),
                                       _("Wrong calibration parameters"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

            result = True
            if self.scene_view._object is not None:
                dlg = wx.MessageDialog(self,
                                       _("Your current model will be deleted.\n"
                                         "Are you sure you want to delete it?"),
                                       _("Clear point cloud"), wx.YES_NO | wx.ICON_QUESTION)
                result = dlg.ShowModal() == wx.ID_YES
                dlg.Destroy()
            if result:
                ciclop_scan.set_callbacks(self.before_scan,
                                          None, lambda r: wx.CallAfter(self.after_scan, r))
                ciclop_scan.start()
示例#3
0
 def on_accept(self):
     platform_extrinsics.accept()
     R, t = self.result
     profile.settings['rotation_matrix'] = R
     profile.settings['translation_vector'] = t
     profile.settings[
         'platform_extrinsics_hash'] = calibration_data.md5_hash()
     if self.exit_callback is not None:
         self.exit_callback()
     self.plot_panel.clear()
 def on_accept(self):
     laser_triangulation.accept()
     dL, nL, dR, nR = self.result
     profile.settings['distance_left'] = dL
     profile.settings['normal_left'] = nL
     profile.settings['distance_right'] = dR
     profile.settings['normal_right'] = nR
     profile.settings[
         'laser_triangulation_hash'] = calibration_data.md5_hash()
     if self.exit_callback is not None:
         self.exit_callback()
     self.plot_panel.clear()