def run(self): self._logger.info("Meshlab Process Started...") data = { "message": "MESHING_STARTED", "level": "info" } self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, data) basedir = os.path.dirname(os.path.dirname(__file__)) mlx_script_path = basedir+"/mlx/"+self.filter input = self.config.folders.scans+str(self.scan_id)+"/scan_"+str(self.scan_id)+".ply" output = self.config.folders.scans+str(self.scan_id)+"/mesh_"+str(self.scan_id)+"_"+str(self.filter).split(".")[0]+"."+self.format self._logger.info(output) FSSystem.run_command("xvfb-run meshlabserver -i "+input+" -o "+output+" -s "+str(mlx_script_path)+" -om vc vn") message = { "message" : "MESHING_DONE", "scan_id" : self.scan_id, "level": "success" } self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE,message) self._logger.info("Meshlab Process finished.")
def run(self): self._logger.info("Meshlab Process Started...") data = {"message": "MESHING_STARTED", "level": "info"} self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, data) basedir = os.path.dirname(os.path.dirname(__file__)) mlx_script_path = basedir + "/mlx/" + self.filter input = self.config.folders.scans + str(self.scan_id) + "/scan_" + str( self.scan_id) + ".ply" output = self.config.folders.scans + str( self.scan_id) + "/mesh_" + str(self.scan_id) + "_" + str( self.filter).split(".")[0] + "." + self.format self._logger.info(output) FSSystem.run_command("xvfb-run meshlabserver -i " + input + " -o " + output + " -s " + str(mlx_script_path) + " -om vc vn") message = { "message": "MESHING_DONE", "scan_id": self.scan_id, "level": "success" } self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, message) self._logger.info("Meshlab Process finished.")
def update_server(self): try: FSSystem.run_command("apt-get update") FSSystem.run_command( "nohup sh -c 'apt-get -y --only-upgrade install fabscanpi-server && reboot' > /dev/null &" ) except StandardError, e: self._logger.error(e)
def start(self): tools = FSSystem() tools.delete_folder(self.config.folders.scans + 'calibration') self._hardwarecontroller.turntable.enable_motors() self._hardwarecontroller.led.on(self.calibration_brightness[0], self.calibration_brightness[1], self.calibration_brightness[2]) #self.settings.camera.contrast = 30 #self.settings.camera.saturation = 20 #self.settings.camera.brightness = 50 self.reset_calibration_values() self.settings.threshold = 25 self._starttime = self.get_time_stamp() message = {"message": "START_CALIBRATION", "level": "info"} self._eventmanager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, message) try: self._hardwarecontroller.start_camera_stream(mode="calibration") self._do_calibration(self._capture_camera_calibration, self._calculate_camera_calibration) self._do_calibration(self._capture_scanner_calibration, self._calculate_scanner_calibration) self._hardwarecontroller.led.off() self._hardwarecontroller.turntable.disable_motors() if self._stop: self._logger.debug("Calibration canceled...") # send information to client that calibration is finished message = {"message": "STOPPED_CALIBRATION", "level": "info"} self._eventmanager.broadcast_client_message( FSEvents.ON_INFO_MESSAGE, message) self._hardwarecontroller.stop_camera_stream() self._stop = False else: event = FSEvent() event.command = 'CALIBRATION_COMPLETE' self._eventmanager.publish(FSEvents.COMMAND, event) # send information to client that calibration is finished message = {"message": "FINISHED_CALIBRATION", "level": "info"} self.config.save() self._eventmanager.broadcast_client_message( FSEvents.ON_INFO_MESSAGE, message) self._hardwarecontroller.stop_camera_stream() self.reset_calibration_values() return except StandardError as e: self._logger.error(e)
def avr_flash(self, fname): FSSystem.run_command("wc -l " + str(fname)) status = FSSystem.run_command( "avrdude -U flash:w:" + str(fname) + ":i -p atmega328 -b 115200 -carduino -patmega328p -P" + str(self._port)) if status != 0: self._logger.error("Failed to flash firmware") return status == 0
def avr_flash(self, fname): FSSystem.run_command("wc -l " + str(fname)) status = FSSystem.run_command("sudo avrdude -D -V -U flash:w:" + str(fname) + ":i -b " + str(self.flash_baudrate) + " -carduino -pm328p -P" + str(self._port)) if status != 0: self._logger.error("Failed to flash firmware") return status == 0
def run(self): #try: self._logger.info("Meshlab Process Started...") basedir = os.path.dirname(os.path.dirname(__file__)) mlx_script_path = basedir+"/mlx/"+self.filter input = self.config.folders.scans+str(self.scan_id)+"/scan_"+str(self.scan_id)+".ply" output = self.config.folders.scans+str(self.scan_id)+"/mesh_"+str(self.scan_id)+"_"+str(self.filter).split(".")[0]+"."+self.format self._logger.info(output) FSSystem.run_command("xvfb-run meshlabserver -i "+input+" -o "+output+" -s "+str(mlx_script_path)+" -om vc vn") self.message_event() self._logger.info("Meshlab Process finished.")
def run(self): #try: self._logger.info("Meshlab Process Started...") basedir = os.path.dirname(os.path.dirname(__file__)) mlx_script_path = basedir + "/mlx/" + self.filter input = self.config.folders.scans + str(self.scan_id) + "/scan_" + str( self.scan_id) + ".ply" output = self.config.folders.scans + str( self.scan_id) + "/mesh_" + str(self.scan_id) + "_" + str( self.filter).split(".")[0] + "." + self.format self._logger.info(output) FSSystem.run_command("xvfb-run meshlabserver -i " + input + " -o " + output + " -s " + str(mlx_script_path) + " -om vc vn") self.message_event() self._logger.info("Meshlab Process finished.")
def run(self): try: self._logger.info("Meshlab Process Started...") basedir = os.path.dirname(os.path.dirname(__file__)) script_name = "default_meshing.mlx" mlx = basedir+"/mlx/"+script_name input = self.config.folders.scans+str(self.prefix)+"/scan_"+str(self.prefix)+".ply" output = self.config.folders.scans+str(self.prefix)+"/mesh_"+str(self.prefix)+"_"+script_name.split(".")[0]+".ply" FSSystem.run_command("xvfb-run meshlabserver -i "+input+" -o "+output+" -s "+str(mlx)+" -om vc vn") self.message_event() self._logger.info("Meshlab Process finished.") except: self._logger.error("Meshing Task crashed.") message = FSUtil.new_message() message['type'] = FSEvents.ON_INFO_MESSAGE message['data']['message'] = "MESHING_FAILED" message['data']['level'] = "error" self.eventManager.publish(FSEvents.ON_SOCKET_BROADCAST,message)
def run(self): self._logger.info("Process started...") data = {"message": "MESHING_STARTED", "level": "info"} self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, data) basedir = os.path.dirname(os.path.dirname(__file__)) mlx_script_path = basedir + "/mlx/" + self.filter input = self.config.folders.scans + str(self.scan_id) + "/scan_" + str( self.scan_id) + ".ply" output = self.config.folders.scans + str( self.scan_id) + "/mesh_" + str(self.scan_id) + "_" + str( self.filter).split(".")[0] + "." + self.format self._logger.info(output) pointcloud_size = self.get_poitcloud_value_by_line( pointcloud_file=input, lookup="element vertex") self.prepare_down_sampling(str(mlx_script_path), pointcloud_size) return_code = FSSystem.run_command("xvfb-run meshlabserver -i " + input + " -o " + output + " -s " + str(mlx_script_path) + " -om vc vn") self._logger.debug("Process return code: " + str(return_code)) if return_code is 0: message = { "message": "MESHING_DONE", "scan_id": self.scan_id, "level": "success" } else: message = { "message": "MESHING_FAILED", "scan_id": self.scan_id, "level": "error" } self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE, message) self._logger.info("Process finished.")
def update_server(self): try: FSSystem.run_command("apt-get update") FSSystem.run_command("nohup sh -c 'apt-get -y --only-upgrade install fabscanpi-server && reboot' > /dev/null &") except StandardError, e: self._logger.error(e)
def avr_device_is_available(self): status = FSSystem.run_command("sudo avrdude -p m328p -b " + str(self.flash_baudrate) + " -carduino -P" + str(self._port)) return status == 0
def avr_flash(self,fname): FSSystem.run_command("wc -l "+str(fname)) status = FSSystem.run_command("avrdude -D -V -U flash:w:"+str(fname)+":i -b "+str(self.flash_baudrate)+" -carduino -pm328p -P"+str(self._port)) if status != 0: self._logger.error("Failed to flash firmware") return status == 0
def avr_device_is_available(self): status = FSSystem.run_command("avrdude -p m328p -b "+str(self.flash_baudrate)+" -carduino -P"+str(self._port)) return status == 0
def avr_flash(self,fname): FSSystem.run_command("wc -l "+str(fname)) status = FSSystem.run_command("avrdude -U flash:w:"+str(fname)+":i -p atmega328 -b 115200 -carduino -patmega328p -P"+str(self._port)) if status != 0: self._logger.error("Failed to flash firmware") return status == 0
def restart_server(self): try: FSSystem.run_command("/etc/init.d/fabscanpi-server restart", blocking=True) except StandardError, e: self._logger.error(e)