diff --git a/docs/src/usage/customized_usage.rst b/docs/src/usage/customized_usage.rst index cd6bec02..4b4e2432 100644 --- a/docs/src/usage/customized_usage.rst +++ b/docs/src/usage/customized_usage.rst @@ -7,10 +7,6 @@ For a basic usage example, see :ref:`basic_usage`. The environment also provides options for customization. -Custom Map ------------- -Work in progress on how to add a custom map. - Random Track Generator ----------------------- @@ -35,6 +31,10 @@ For example, to generate 3 random maps and store them in the directory `custom_m python examples/random_trackgen.py --seed 42 --n-maps 3 --outdir custom_maps -.. image:: ../../../../src/assets/random_trackgen.png +.. image:: /assets/random_trackgen.png :width: 800 - :align: center \ No newline at end of file + :align: center + +Custom Map +------------ +Work in progress on how to add a custom map. \ No newline at end of file diff --git a/docs/src/usage/dynamics.rst b/docs/src/usage/dynamics.rst index ca9894e0..311f1e2b 100644 --- a/docs/src/usage/dynamics.rst +++ b/docs/src/usage/dynamics.rst @@ -1,6 +1,50 @@ -_dynamics: +.. _dynamics: -Dynamics +Vehicle Dynamics ===================== -Work in progress. \ No newline at end of file +The vehicle dynamics are modeled using a single-track model, as in [AlKM17]_. + +We support two vehicle dynamics models: +- Kinematic Single-Track Model (`ks`): Simpler model that considers only the kinematics of the vehicle, i.e., the position, orientation, and velocity, ignoring the forces that act on the vehicle. +- Single-Track Model (`st`): More complex model that considers the forces that act on the vehicle, such as the tire forces. + +Despite the fact that the single-track model is a simplified model, it is able to capture the +tire slip effects on the slip angle, which is important for accurate simulation at the physical +limits of the vehicle. + + +Dynamics Configuration +---------------------- +The environment comes with a *default* dynamics model, which can be changed using the environment configuration. + +The dynamics model can be configured at the environment creation: + +.. code:: python + + import gymnasium as gym + + env = gym.make( + "f110_gym:f110-v0", + config={ + "model": "ks" + }) + obs, infos = env.reset() + +or after the environment creation: + +.. code:: python + + import gymnasium as gym + + env = gym.make("f110_gym:f110-v0") + env.configure({ + "model": "ks", + }) + obs, infos = env.reset() + + + +.. rubric:: References + +.. [AlKM17] Althoff, M.; Koschi, M.; Manzinger, S..: CommonRoad: Composable benchmarks for motion planning on roads. In: 2017 IEEE Intelligent Vehicles Symposium (IV). IEEE, 2017. \ No newline at end of file diff --git a/docs/src/usage/rendering.rst b/docs/src/usage/rendering.rst index 942f19ed..f8c2f1af 100644 --- a/docs/src/usage/rendering.rst +++ b/docs/src/usage/rendering.rst @@ -3,4 +3,66 @@ Rendering ===================== -Work in progress. \ No newline at end of file +The environment rendering is done with `pygame`. + +As by default in gymnasium environments, +there are multiple rendering modes available: + +- `human`: for real-time rendering with `pygame`; + +- `rgb_array`: for collecting the current frame as a numpy array; + +- `rgb_array_list`: for collecting multiple frames into a list. This is useful to generate smooth videos when using frame-skipping. + +Additionally, for fast rendering and debugging, we add: + +- `human-fast`: faster-than-real-time rendering. Up to 10x faster based on the host machine. + +Rendering Configuration +------------------------ + +The user can customize the rendering mode with the `rendering_mode` parameter in the environment configuration. + +.. code:: python + + import gymnasium as gym + + env = gym.make( + "f110_gym:f110-v0", + render_mode="human-fast", + ) + obs, infos = env.reset() + done = False + + while not done: + action = env.action_space.sample() + obs, reward, done, infos = env.step(action) + env.render() + + +.. note:: + When rendering in `human` mode, + the user can interact to change the agent to focus on by pressing the left/right/middle mouse button, + as described by the instructions diplayed in the top of the window. + +Parameter Configuration +----------------------- + +The user can customize the rendering parameters in the `f1tenth_gym.rendering/rendering.yaml` file: + +- `window_size`: width and height of the window in pixels + +- `focus_on`: agent id to focus on (e.g., `agent_0`) or `null` for map view + +- `zoom_in_factor`: zoom in factor. 1.0 is no zoom, >1.0 is zoom in, <1.0 is zoom out + +- `show_wheels`: it toggles the visualization of the vehicle wheels + +- `car_tickness`: thickness of the car border + +- `show_info`: it toggles the visualization of the instruction text + +- `vehicle_palette`: cyclic list of colors for the vehicles (e.g., first agent takes the first color, second agent takes the second color, etc. and then it starts again from the first color) + + +