(self, walker, spawn_range, physics, random_state)
Uniformly initialize walker in spawn_range.
Uniformly initialize walker in spawn_range.
Uniformly initialize walker in spawn_range .
def _initialize_walker(self, walker, spawn_range, physics, random_state):
    """Uniformly initialize walker in spawn_range."""
    walker.reinitialize_pose(physics, random_state)
    x, y = random_state.uniform(-spawn_range, spawn_range)
    (_, _, z), quat = walker.get_pose(physics)
    walker.set_pose(physics, [x, y, z], quat)
    rotation = random_state.uniform(-np.pi, np.pi)
    quat = [np.cos(rotation / 2), 0, 0, np.sin(rotation / 2)]
    walker.shift_pose(physics, quaternion=quat)
    # Note: this method is not always called immediately after `physics.reset()`
    #       so we need to explicitly zero out the velocity.
    walker.set_velocity(physics, velocity=0., angular_velocity=0.)
def _initialize_walker ( self , walker , spawn_range , physics , random_state ) : walker . reinitialize_pose ( physics , random_state ) x , y = random_state . uniform ( - spawn_range , spawn_range ) ( _ , _ , z ) , quat = walker . get_pose ( physics ) walker . set_pose ( physics , [ x , y , z ] , quat ) rotation = random_state . uniform ( - np . pi , np . pi ) quat = [ np . cos ( rotation / 2 ) , 0 , 0 , np . sin ( rotation / 2 ) ] walker . shift_pose ( physics , quaternion = quat ) # Note: this method is not always called immediately after `physics.reset()` #       so we need to explicitly zero out the velocity. walker . set_velocity ( physics , velocity = 0. , angular_velocity = 0. )