(self, player, arena)
Add observables of the arena.

    Args:
      player: A `Walker` instance to which observables will be added.
      arena: A `Pitch` instance.
Add observables of the arena.
Add observables of the arena .
def _add_player_arena_observables(self, player, arena):
    """Add observables of the arena.

    Args:
      player: A `Walker` instance to which observables will be added.
      arena: A `Pitch` instance.
    """
    # Enable egocentric view of position detectors (goal, field).
    # Corners named according to walker *facing towards opponent goal*.
    clockwise_names = [
        'team_goal_back_right',
        'team_goal_mid',
        'team_goal_front_left',
        'field_front_left',
        'opponent_goal_back_left',
        'opponent_goal_mid',
        'opponent_goal_front_right',
        'field_back_right',
    ]
    clockwise_features = [
        lambda _: arena.home_goal.lower[:2],
        lambda _: arena.home_goal.mid,
        lambda _: arena.home_goal.upper[:2],
        lambda _: arena.field.upper,
        lambda _: arena.away_goal.upper[:2],
        lambda _: arena.away_goal.mid,
        lambda _: arena.away_goal.lower[:2],
        lambda _: arena.field.lower,
    ]
    xpos_xyz_callable = lambda p: p.bind(player.walker.root_body).xpos
    xpos_xy_callable = lambda p: p.bind(player.walker.root_body).xpos[:2]
    # A list of egocentric reference origin for each one of clockwise_features.
    clockwise_origins = [
        xpos_xy_callable,
        xpos_xyz_callable,
        xpos_xy_callable,
        xpos_xy_callable,
        xpos_xy_callable,
        xpos_xyz_callable,
        xpos_xy_callable,
        xpos_xy_callable,
    ]
    if player.team != team_lib.Team.HOME:
      half = len(clockwise_features) // 2
      clockwise_features = clockwise_features[half:] + clockwise_features[:half]
      clockwise_origins = clockwise_origins[half:] + clockwise_origins[:half]

    for name, feature, origin in zip(clockwise_names, clockwise_features,
                                     clockwise_origins):
      player.walker.observables.add_egocentric_vector(
          name, base_observable.Generic(feature), origin_callable=origin)
def _add_player_arena_observables ( self , player , arena ) : # Enable egocentric view of position detectors (goal, field). # Corners named according to walker *facing towards opponent goal*. clockwise_names = [ 'team_goal_back_right' , 'team_goal_mid' , 'team_goal_front_left' , 'field_front_left' , 'opponent_goal_back_left' , 'opponent_goal_mid' , 'opponent_goal_front_right' , 'field_back_right' , ] clockwise_features = [ lambda _ : arena . home_goal . lower [ : 2 ] , lambda _ : arena . home_goal . mid , lambda _ : arena . home_goal . upper [ : 2 ] , lambda _ : arena . field . upper , lambda _ : arena . away_goal . upper [ : 2 ] , lambda _ : arena . away_goal . mid , lambda _ : arena . away_goal . lower [ : 2 ] , lambda _ : arena . field . lower , ] xpos_xyz_callable = lambda p : p . bind ( player . walker . root_body ) . xpos xpos_xy_callable = lambda p : p . bind ( player . walker . root_body ) . xpos [ : 2 ] # A list of egocentric reference origin for each one of clockwise_features. clockwise_origins = [ xpos_xy_callable , xpos_xyz_callable , xpos_xy_callable , xpos_xy_callable , xpos_xy_callable , xpos_xyz_callable , xpos_xy_callable , xpos_xy_callable , ] if player . team != team_lib . Team . HOME : half = len ( clockwise_features ) // 2 clockwise_features = clockwise_features [ half : ] + clockwise_features [ : half ] clockwise_origins = clockwise_origins [ half : ] + clockwise_origins [ : half ] for name , feature , origin in zip ( clockwise_names , clockwise_features , clockwise_origins ) : player . walker . observables . add_egocentric_vector ( name , base_observable . Generic ( feature ) , origin_callable = origin )