Esempio n. 1
0
    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.")
Esempio n. 2
0
        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.")
Esempio n. 3
0
 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)
Esempio n. 4
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
Esempio n. 5
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
Esempio n. 6
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.")
Esempio n. 7
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.")
Esempio n. 8
0
        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)
Esempio n. 9
0
    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.")
Esempio n. 10
0
 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
Esempio n. 11
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
Esempio n. 12
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
Esempio n. 13
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
Esempio n. 14
0
 def restart_server(self):
     try:
         FSSystem.run_command("/etc/init.d/fabscanpi-server restart",
                              blocking=True)
     except StandardError, e:
         self._logger.error(e)
Esempio n. 15
0
 def restart_server(self):
     try:
         FSSystem.run_command("/etc/init.d/fabscanpi-server restart", blocking=True)
     except StandardError, e:
         self._logger.error(e)
Esempio n. 16
0
 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)