def fn(self, edge, object_name, object_pose): oracle = self.oracle preprocess_edge(oracle, edge) object_aabb = oracle.get_aabb(object_name, trans_from_pose(object_pose.value)) object_aabb_min, object_aabb_max = aabb_min(object_aabb), aabb_max( object_aabb) configs = [ q for q in edge.configs() if fast_aabb_overlap(object_aabb_min, object_aabb_max, q.aabbs) ] if len(configs) == 0: return False #distance = oracle.get_radius2('pr2') + oracle.get_radius2(object_name) #z = get_point(oracle.robot)[-1] #configs = [q for q in edge.configs() if length2(np.array([q.value[-3], q.value[-2], z]) - point_from_pose(object_pose.value)) <= distance] #if len(configs) == 0: return False # TODO - oracle.robot.SetActiveDOFValues(q.value) is the bottleneck: check each object at the same time with oracle.body_saver(object_name): oracle.set_pose(object_name, object_pose) with oracle.robot_saver(): CSpace.robot_arm_and_base( oracle.robot.GetActiveManipulator()).set_active() with collision_saver( oracle.env, openravepy_int.CollisionOptions.ActiveDOFs ): # TODO - does this really do what I think? for q in configs: # TODO - do this with other other collision functions q.saver.Restore() if robot_collision(oracle, object_name): return True return False
def fn(self, edge, object_name, object_pose): oracle = self.oracle preprocess_edge(oracle, edge) object_aabb = oracle.get_aabb(object_name, trans_from_pose(object_pose.value)) object_aabb_min, object_aabb_max = aabb_min(object_aabb), aabb_max(object_aabb) configs = [q for q in edge.configs() if fast_aabb_overlap(object_aabb_min, object_aabb_max, q.aabbs)] if len(configs) == 0: return False #distance = oracle.get_radius2('pr2') + oracle.get_radius2(object_name) #z = get_point(oracle.robot)[-1] #configs = [q for q in edge.configs() if length2(np.array([q.value[-3], q.value[-2], z]) - point_from_pose(object_pose.value)) <= distance] #if len(configs) == 0: return False # TODO - oracle.robot.SetActiveDOFValues(q.value) is the bottleneck: check each object at the same time with oracle.body_saver(object_name): oracle.set_pose(object_name, object_pose) with oracle.robot_saver(): CSpace.robot_arm_and_base(oracle.robot.GetActiveManipulator()).set_active() with collision_saver(oracle.env, openravepy_int.CollisionOptions.ActiveDOFs): # TODO - does this really do what I think? for q in configs: # TODO - do this with other other collision functions q.saver.Restore() if robot_collision(oracle, object_name): return True return False
def preprocess_edge(oracle, edge): if not hasattr(edge, 'preprocessed'): edge.preprocessed = True with oracle.robot_saver(): CSpace.robot_arm_and_base(oracle.robot.GetActiveManipulator()).set_active() for q in edge.configs(): if not hasattr(q, 'saver'): oracle.robot.SetActiveDOFValues(q.value) q.saver = oracle.robot_saver() q.manip_trans = get_manip_trans(oracle) q.aabbs = [(aabb_min(aabb), aabb_max(aabb)) for aabb in [oracle.compute_part_aabb(part) for part in USE_ROBOT_PARTS]]
def preprocess_edge(oracle, edge): if not hasattr(edge, 'preprocessed'): edge.preprocessed = True with oracle.robot_saver(): CSpace.robot_arm_and_base( oracle.robot.GetActiveManipulator()).set_active() for q in edge.configs(): if not hasattr(q, 'saver'): oracle.robot.SetActiveDOFValues(q.value) q.saver = oracle.robot_saver() q.manip_trans = get_manip_trans(oracle) q.aabbs = [(aabb_min(aabb), aabb_max(aabb)) for aabb in [ oracle.compute_part_aabb(part) for part in USE_ROBOT_PARTS ]]