def set_state(state, oracle): if state['robot'] is not False: set_robot_config(oracle.robot, state['robot']) for object_name in oracle.objects: if state[object_name] is not False: oracle.set_pose(object_name, state[object_name]) if state['holding'] is not False: holding = state['holding'] oracle.set_pose(holding.object_name, object_pose_from_robot_config(oracle, oracle.get_robot_config(), holding.grasp))
def plan_base_traj(oracle, start_config, end_config, holding=None, obstacle_poses={}): with oracle.state_saver(): oracle.set_all_object_poses(obstacle_poses) oracle.set_robot_config(end_config) base_trans = get_trans(oracle.robot) oracle.set_robot_config(start_config) open_gripper(oracle) if holding is not None: oracle.set_pose(holding.object_name, object_pose_from_robot_config(oracle, start_config, holding.grasp)) grab(oracle, holding.object_name) traj = cspace_traj(oracle, CSpace.robot_base(oracle.robot), base_values_from_trans(base_trans)) if holding is not None: release(oracle, holding.object_name) return traj