def from_xml_node(cls, node): type = node.get('name') num_legs = int(node.get('num-legs')) legs = [] leg_poses = [] home_state = [] for i in xrange(num_legs): current_leg = node[i] leg_frame = leg_library.get_leg(current_leg.get('name')) leg_pose = pose(eval(current_leg.get('position')), eval(current_leg.get('orientation'))) leg_home_state = LegState(eval(current_leg.get('home', None))) legs.append(leg_frame) leg_poses.append(leg_pose) home_state.append(leg_home_state) return cls(type, legs, leg_poses, home_state)
def get_random(cls, num_legs): return cls([LegState.get_random(3) for i in xrange(num_legs)], pose((0, 0, 0), (0, 0, 0)))
def __init__(self, static_chassis): self.chassis = static_chassis self.chassis_pose = pose((0, 0, 0), (0, 0, 0))