from typing import List import probRobScene import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from probRobScene.core.object_types import show_3d from probRobScene.core.plotUtil3d import draw_cube from probRobScene.core.regions import AABB from probRobScene.core.scenarios import Scene scenario = probRobScene.scenario_from_file("scenarios/pointDepTest.prs") max_generations = 30 rejections_per_scene = [] sample_scenes: List[Scene] = [] for i in range(max_generations): print(f"Generation {i}") ex_world, used_its = scenario.generate(verbosity=2) rejections_per_scene.append(used_its) sample_scenes.append(ex_world) # fig = plt.figure() ax = fig.add_subplot(111, projection='3d') w_min_corner, w_max_corner = AABB(scenario.workspace) w_dims = w_max_corner - w_min_corner total_min, total_max = np.min(w_min_corner), np.max(w_max_corner) ax.set_xlim(total_min, total_max)
def scenario_test(self, f_path: str): scenario = scenario_from_file(f_path) ex_world, used_its = scenario.generate(verbosity=2) for o in ex_world.objects: self.assertFalse(needs_sampling(o))
import probRobScene import numpy as np scenario = probRobScene.scenario_from_file("scenarios/tableCubeNaive.prs") max_generations = 3 rejections_per_scene = [] for i in range(max_generations): print(f"Generation {i}") ex_world, used_its = scenario.generate(verbosity=2) rejections_per_scene.append(used_its) ex_world.show_3d() # avg_rejections = np.average(rejections_per_scene) print(avg_rejections)
import probRobScene from pyrep import PyRep from pyrep.objects import Camera import numpy as np import sys from probRobScene.wrappers.coppelia.prbCoppeliaWrapper import cop_from_prs if len(sys.argv) != 2: print("python3 coppeliaView.py <path-to-scenario-file>") sys.exit(0) scenario_file = sys.argv[1] scenario = probRobScene.scenario_from_file(scenario_file) pr = PyRep() pr.launch("scenes/emptyVortex.ttt", headless=False, responsive_ui=True) ex_world, used_its = scenario.generate() c_objs = cop_from_prs(pr, ex_world) pr.start() pr.step() pr.stop() input("Simulation Finished. To Quit, Press Enter") pr.shutdown()