Ciclop开源3D扫描仪软件---Horus源码分析之src\horus\engine\calibration\moving_calibration.py

来源:互联网 发布:安徽边锋网络掼蛋下载 编辑:程序博客网 时间:2024/05/08 23:31

/****************************************************************************/
 *
 *                  (c)    光明工作室  2017-2037  COPYRIGHT
 *
 *   光明工作室团队成员大部分来自全国著名985、211工程院校。具有丰富的工程实践经验,
 *本工作室热忱欢迎大家的光临。工作室长期承接嵌入式开发、PCB设计、算法仿真等软硬件设计。
 *
 *
 *1)基于C8051、AVR、MSP430单片机开发。
 *2)基于STM32F103、STM32F407等ARM处理器开发。(IIC、SPI、485、WIFI等相关设计)
 *3)基于C6678、DM388等DSP处理器开发。(视频、网络、通信协议相关设计)
 *4)基于QT、C#软件开发。
 *5)基于OPENCV、OPENGL图像处理算法开发。(基于LINUX、WINDOWS、MATLAB等)
 *6)无人机飞控、地面站程序开发。(大疆、PIX、 qgroundcontrol、missionplanner、MAVLINK)
 *7) ROS机器人操作系统下相关开发。
 *8)LINUX、UCOSII、VXWORKS操作系统开发。
 *
 *
 *                                                 联系方式:
 *                                                 QQ:2468851091 call:18163325140
 *                                                 Email:2468851091@qq.com
 *

/ ****************************************************************************/ 



# -*- coding: utf-8 -*-# This file is part of the Horus Project__author__ = 'Jes煤s Arroyo Torrens <jesus.arroyo@bq.com>'__copyright__ = 'Copyright (C) 2014-2016 Mundo Reader S.L.'__license__ = 'GNU General Public License v2 http://www.gnu.org/licenses/gpl2.html'import timefrom horus.engine.calibration.calibration import Calibrationclass MovingCalibration(Calibration):    """Moving calibration:            - Move motor sequence            - Call _capture at each position            - Call _calibrate at the end    """    def __init__(self):        Calibration.__init__(self)        self.step = 3    def _initialize(self):        raise NotImplementedError    def _capture(self, angle):        raise NotImplementedError    def _calibrate(self):        raise NotImplementedError    def _start(self):        if self.driver.is_connected:            angle = 0.0            self._initialize()            # Setup scanner            self.driver.board.lasers_off()            self.driver.board.motor_enable()            self.driver.board.motor_reset_origin()            self.driver.board.motor_speed(200)            self.driver.board.motor_acceleration(200)            # Move to starting position            self.driver.board.motor_move(-90)            if self._progress_callback is not None:                self._progress_callback(0)            while self._is_calibrating and abs(angle) < 180:                if self._progress_callback is not None:                    self._progress_callback(100 * abs(angle) / 180.)                self._capture(angle)                angle += self.step                self.driver.board.motor_move(self.step)                time.sleep(0.5)            # Move to origin            self.driver.board.motor_move(90 - angle)            self.driver.board.lasers_off()            self.driver.board.motor_disable()            # Compute calibration            response = self._calibrate()            if self._after_callback is not None:                self._after_callback(response)


阅读全文
0 0