Environment Utilities
Jittable state, parameter dataclasses, batching helpers, and wrappers.
- class f1tenth_gym_jax.envs.utils.State(rewards, done, step, cartesian_states, last_cartesian_states, frenet_states, last_frenet_states, collisions, num_laps, scans, prev_winding_vector, last_accumulated_angles, accumulated_angles)
Bases:
objectBasic Jittable state for cars
- Parameters:
rewards (Array | ndarray | bool | number)
done (Array | ndarray | bool | number)
step (int)
cartesian_states (Array | ndarray | bool | number)
last_cartesian_states (Array | ndarray | bool | number)
frenet_states (Array | ndarray | bool | number)
last_frenet_states (Array | ndarray | bool | number)
collisions (Array | ndarray | bool | number)
num_laps (Array | ndarray | bool | number)
scans (Array | ndarray | bool | number)
prev_winding_vector (Array | ndarray | bool | number)
last_accumulated_angles (Array | ndarray | bool | number)
accumulated_angles (Array | ndarray | bool | number)
- rewards: Array | ndarray | bool | number
- done: Array | ndarray | bool | number
- step: int
- cartesian_states: Array | ndarray | bool | number
- last_cartesian_states: Array | ndarray | bool | number
- frenet_states: Array | ndarray | bool | number
- last_frenet_states: Array | ndarray | bool | number
- collisions: Array | ndarray | bool | number
- num_laps: Array | ndarray | bool | number
- scans: Array | ndarray | bool | number
- prev_winding_vector: Array | ndarray | bool | number
- last_accumulated_angles: Array | ndarray | bool | number
- accumulated_angles: Array | ndarray | bool | number
- replace(**updates)
Returns a new object replacing the specified fields with new values.
- class f1tenth_gym_jax.envs.utils.LogEnvState(env_state: f1tenth_gym_jax.envs.utils.State, episode_returns: jax.Array | numpy.ndarray | numpy.bool | numpy.number, episode_lengths: jax.Array | numpy.ndarray | numpy.bool | numpy.number, returned_episode_returns: jax.Array | numpy.ndarray | numpy.bool | numpy.number, returned_episode_lengths: jax.Array | numpy.ndarray | numpy.bool | numpy.number)
Bases:
object- Parameters:
env_state (State)
episode_returns (Array | ndarray | bool | number)
episode_lengths (Array | ndarray | bool | number)
returned_episode_returns (Array | ndarray | bool | number)
returned_episode_lengths (Array | ndarray | bool | number)
- episode_returns: Array | ndarray | bool | number
- episode_lengths: Array | ndarray | bool | number
- returned_episode_returns: Array | ndarray | bool | number
- returned_episode_lengths: Array | ndarray | bool | number
- replace(**updates)
Returns a new object replacing the specified fields with new values.
- class f1tenth_gym_jax.envs.utils.Param(mu=1.0489, C_Sf=4.718, C_Sr=5.4562, lf=0.15875, lr=0.17145, h=0.074, m=3.74, I=0.04712, s_min=-0.4189, s_max=0.4189, sv_min=-3.2, sv_max=3.2, v_switch=7.319, a_max=9.51, v_min=-5.0, v_max=20.0, width=0.31, length=0.58, timestep=0.01, timestep_ratio=1, longitudinal_action_type='acceleration', steering_action_type='steeringvelocity', integrator='rk4', model='st', produce_scans=False, collision_on=True, theta_dis=2000, fov=4.7, num_beams=64, eps=0.01, max_range=10.0, observe_others=True, map_name='Spielberg', max_num_laps=1, max_steps=9000, reward_type='progress')
Bases:
objectDefault jittable params for dynamics
- Parameters:
mu (float)
C_Sf (float)
C_Sr (float)
lf (float)
lr (float)
h (float)
m (float)
I (float)
s_min (float)
s_max (float)
sv_min (float)
sv_max (float)
v_switch (float)
a_max (float)
v_min (float)
v_max (float)
width (float)
length (float)
timestep (float)
timestep_ratio (int)
longitudinal_action_type (str)
steering_action_type (str)
integrator (str)
model (str)
produce_scans (bool)
collision_on (bool)
theta_dis (int)
fov (float)
num_beams (int)
eps (float)
max_range (float)
observe_others (bool)
map_name (str)
max_num_laps (int)
max_steps (int)
reward_type (str)
- mu: float = 1.0489
- C_Sf: float = 4.718
- C_Sr: float = 5.4562
- lf: float = 0.15875
- lr: float = 0.17145
- h: float = 0.074
- m: float = 3.74
- I: float = 0.04712
- s_min: float = -0.4189
- s_max: float = 0.4189
- sv_min: float = -3.2
- sv_max: float = 3.2
- v_switch: float = 7.319
- a_max: float = 9.51
- v_min: float = -5.0
- v_max: float = 20.0
- width: float = 0.31
- length: float = 0.58
- timestep: float = 0.01
- timestep_ratio: int = 1
- longitudinal_action_type: str = 'acceleration'
- steering_action_type: str = 'steeringvelocity'
- integrator: str = 'rk4'
- model: str = 'st'
- produce_scans: bool = False
- collision_on: bool = True
- theta_dis: int = 2000
- fov: float = 4.7
- num_beams: int = 64
- eps: float = 0.01
- max_range: float = 10.0
- observe_others: bool = True
- map_name: str = 'Spielberg'
- max_num_laps: int = 1
- max_steps: int = 9000
- reward_type: str = 'progress'
- replace(**updates)
Returns a new object replacing the specified fields with new values.
- f1tenth_gym_jax.envs.utils.batchify(x, agent_list, num_actors)
- Parameters:
x (Mapping[str, Array | ndarray | bool | number])
agent_list (Sequence[str])
num_actors (int)
- Return type:
Array | ndarray | bool | number
- f1tenth_gym_jax.envs.utils.unbatchify(x, agent_list, num_envs, num_agents)
- Parameters:
x (Array)
agent_list (Sequence[str])
num_envs (int)
num_agents (int)
- Return type:
Dict[str, Array | ndarray | bool | number]
- class f1tenth_gym_jax.envs.utils.Wrapper(env)
Bases:
object- Parameters:
env (MultiAgentEnv)
- class f1tenth_gym_jax.envs.utils.LogWrapper(env, replace_info=False)
Bases:
WrapperLog the episode returns and lengths. NOTE for now for envs where agents terminate at the same time.
- Parameters:
env (MultiAgentEnv)
replace_info (bool)
- reset(key)
- Parameters:
key (Array)
- Return type:
Tuple[Dict[str, Array | ndarray | bool | number], LogEnvState]
- step(key, state, action)
- Parameters:
key (Array)
state (LogEnvState)
action (Dict[str, Array | ndarray | bool | number])
- Return type:
Tuple[Dict[str, Array | ndarray | bool | number], LogEnvState, Dict[str, Array | ndarray | bool | number], Dict[str, Array | ndarray | bool | number], dict]