def run(self):
        while not self.kill_received:
             # get a task
            try:
                job = self.work_queue.get_nowait()
            except Queue.Empty:
                break
                
            start_time = time.time();    
            
            print("Creating a Scene");
            bvpl_octree_batch.init_process("boxmCreateSceneProcess");
            bvpl_octree_batch.set_input_string(0, job.input_scene_path);
            bvpl_octree_batch.run_process();
            (scene_id, scene_type) = bvpl_octree_batch.commit_output(0);
            scene= dbvalue(scene_id, scene_type);
            
            #Use the save scene in bvxm because boxm rounds to bytes and doesn't work for negative values
#
#            print("Save Scene");
#            bvpl_octree_batch.init_process("boxmSaveOccupancyRawProcess");
#            bvpl_octree_batch.set_input_from_db(0,scene);
#            bvpl_octree_batch.set_input_string(1, job.output_scene_path);
#            bvpl_octree_batch.set_input_unsigned(2,0);
#            bvpl_octree_batch.set_input_unsigned(3,1);
#            bvpl_octree_batch.run_process();
            
            resolution = 0;
            enforce_level = 1;

            print("Convert to regular grid");
            bvpl_octree_batch.init_process("boxmSceneToBvxmGridProcess");
            bvpl_octree_batch.set_input_from_db(0,scene);
            bvpl_octree_batch.set_input_string(1, job.output_scene_path + ".vox");
            bvpl_octree_batch.set_input_unsigned(2, resolution);
            bvpl_octree_batch.set_input_bool(3, enforce_level);
            bvpl_octree_batch.run_process();
            (grid_id, grid_type) = bvpl_octree_batch.commit_output(0);
            grid = dbvalue(grid_id, grid_type);

            print("Save Grid");
            bvpl_octree_batch.init_process("bvxmSaveGridRawProcess");
            bvpl_octree_batch.set_input_from_db(0,grid);
            bvpl_octree_batch.set_input_string(1,job.output_scene_path);
            bvpl_octree_batch.run_process();
            
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
示例#2
0
  kernel = dbvalue(kernel_id,kernel_type);

  print("Running Operator");
  bvpl_octree_batch.init_process("bvplSceneKernelOperatorProcess");
  bvpl_octree_batch.set_input_from_db(0,scene);
  bvpl_octree_batch.set_input_from_db(1,kernel);
  bvpl_octree_batch.set_input_string(2,"bsta_gauss_f1");
  bvpl_octree_batch.set_input_string(3,"positive_gauss_convolution");
  bvpl_octree_batch.set_input_string(4, output_dir);
  bvpl_octree_batch.run_process();
  (out_scene_id,out_scene_type)= bvpl_octree_batch.commit_output(0);
  result_scene = dbvalue(out_scene_id,out_scene_type);

  resolution = 0;
  enforce_level = 1;

  print("Convert to regular grid");
  bvpl_octree_batch.init_process("boxmSceneToBvxmGridProcess");
  bvpl_octree_batch.set_input_from_db(0,result_scene);
  bvpl_octree_batch.set_input_string(1, output_dir + "/response.vox");
  bvpl_octree_batch.set_input_unsigned(2, resolution);
  bvpl_octree_batch.set_input_bool(3, enforce_level);
  bvpl_octree_batch.run_process();
  (grid_id, grid_type) = bvpl_octree_batch.commit_output(0);
  grid = dbvalue(grid_id, grid_type);

  print("Save Grid");
  bvpl_octree_batch.init_process("bvxmSaveGridRawProcess");
  bvpl_octree_batch.set_input_from_db(0,grid);
  bvpl_octree_batch.set_input_string(1,output_dir + "/response.raw");
  bvpl_octree_batch.run_process();