def main(): r = _create_r() q = np.array([0.19084715098142624, 0.41685351729393005, 0.23655708134174347, 0.9332677282828477, -0.18945885280431052, 0.20543615363339196, -0.2256383770996524]) tup = r.intersecting_segments(q) print(tup[2]) fposs,fdirs = r.force_direction_from_intersecting_segments(tup[0], tup[1], tup[3]) print(fposs) print(fdirs) env_normals = r.scene_face_normals_from_index_pairs(tup[3]) wrong_direction = False for fdir,en in zip(fdirs, env_normals): if np.dot(fdir, en) < 0.0: print("San check 1: force direction w.r.t. face normal failed.") wrong_direction = True break if not wrong_direction: print("San check 1: force direction w.r.t. face normal passed.") def imager(q): QS = [] for q in phyutil.collision_resolve(r, q): QS.append(q) r.state = q r.render_mvrgbd() rgb = np.copy(r.mvrgb.reshape((r.pbufferWidth, r.pbufferHeight, 3))) yield rgb # First view print('state {}'.format(q)) QS.append(q) print("Total: {} steps".format(len(QS))) np.savez('saforce_process.npz', QS=QS) rlreanimator.reanimate(imager(q), fps=20)
def main(): pyosr.init() dpy = pyosr.create_display() glctx = pyosr.create_gl_context(dpy) args = rlargs.parse() assert args.samplein, "--samplein <input dir>" puzzle = curiosity.RigidPuzzle(args, 0) def filer(): index = 0 while True: fn = '{}/{}.npz'.format(args.samplein, index) print(fn) if not os.path.exists(fn): break d = np.load(fn) for q in d['Qs']: yield q index += 1 return def imager(): for q in filer(): puzzle.qstate = q rgb, _ = puzzle.vstate yield rgb[0] # First view rlreanimator.reanimate(imager(), fps=20)
def main(): pyosr.init() args = rlargs.parse() print(args) player = create_player(args) reanimate(player)
def play(self): reanimate(self)
def play(self): reanimate(self, fps=30)
def play(self): if self.sancheck: self.sanity_check() else: reanimate(self, fps=30)