|
254 | 254 | "cell_type": "markdown", |
255 | 255 | "metadata": {}, |
256 | 256 | "source": [ |
257 | | - "The following is quite some text, but it allows you to gain a background understanding of the framework we use.\n", |
| 257 | + "The following helps you to gain a background understanding of the framework we use.\n", |
258 | 258 | "\n", |
259 | 259 | "### 2.1 Background\n", |
260 | 260 | "\n", |
|
432 | 432 | "> **Note**: The actions need to be a 2D array of shape `(n_envs, n_actions)`. Except for parallel simulations on GPU for learning based methods, we set `n_envs=1`." |
433 | 433 | ] |
434 | 434 | }, |
435 | | - { |
436 | | - "cell_type": "markdown", |
437 | | - "metadata": {}, |
438 | | - "source": [ |
439 | | - "##### Simulation\n", |
440 | | - "\n", |
441 | | - "An efficient, highly-parallizable (GPU) simulation of the discretized dynamics models is implemented in our simulator [`crazyflow`](https://github.com/utiasDSL/crazyflow).\n", |
442 | | - "\n", |
443 | | - "- The simulation is implemented in [JAX](https://docs.jax.dev/en/latest/quickstart.html), which is basically numpy for the GPU, and enables us to massively parallize the simulation.\n", |
444 | | - "- The simulation provides physics, integrators (Euler or RK4), lower level controllers, and visualisation routines. If you are interested, you can check out the [this main function](https://github.com/utiasDSL/crazyflow/blob/d87bc1eaf100e7d8927731c630e52a7163108ecf/crazyflow/sim/sim.py) of the simulation.\n", |
445 | | - "- The default simulation step-size is $2\\text{ms}$. The simulation provides Explicit Euler or RK4 for integration. We recommend to stick with the values that have been set for this exercise.\n", |
446 | | - "- For visualisation, we use [MuJoCo](https://mujoco.org/), or more specific [MJX](https://mujoco.readthedocs.io/en/stable/mjx.html). While MuJoCo also comes with its own physics engine, we only use it for vizualization in crazyflow.\n", |
447 | | - "\n", |
448 | | - "> **Note**: Crazyflow is of course already installed in the container. You can find the code in `/home/vscode/venv/lib/python3.11/site-packages/crazyflow`, but **do not make any changes**. For the exercises, we use [`crazyflow v0.0.2`](https://github.com/utiasDSL/crazyflow/tree/v0.0.2).\n", |
449 | | - "\n", |
450 | | - "\n", |
451 | | - "\n", |
452 | | - "##### Gymnasium environment\n", |
453 | | - "\n", |
454 | | - "The simulation is wrapped with different [Gymnasium environments](https://github.com/utiasDSL/crazyflow/blob/d87bc1eaf100e7d8927731c630e52a7163108ecf/crazyflow/gymnasium_envs/crazyflow.py) that define different tasks. You will use the environments to interact with the drone simulation using your controllers, as explained in the previous section. We provide [multiple environments](https://github.com/utiasDSL/crazyflow/blob/d87bc1eaf100e7d8927731c630e52a7163108ecf/crazyflow/gymnasium_envs/crazyflow.py), each for a different purpose. The environments differ in their goals (reward formulations), observation spaces, and other details. For instance, we have `CrazyflowEnvReachGoal` and `CrazyflowEnvFigureEightTrajectory`. We will use the different environments throughout the exercises.\n", |
455 | | - "- **Observation space**: The observation spaces differ for the different gymnasium environments. However, each observation includes at least the state of the drone, which are `position`, `orientation` (in quaternion), and its derivatives. Some environments include additional observations, e.g. the `CrazyflowEnvReachGoal` additionally includes the `difference_to_goal`.\n", |
456 | | - "- **Action space** (corresponds to control input $u$): We use the [Attitude controll interface](https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/functional-areas/sensor-to-control/controllers/) of the drone, as specified in the dynamics model above. This interface takes **four control inputs**: `[collective thrust, roll, pitch, yaw]`. Thus, the action space is a [continuous box](https://gymnasium.farama.org/api/spaces/fundamental/#gymnasium.spaces.Box) represented as <b>float32</b>. The range for the thrust is <b>0.11264675 to 0.5933658</b>, while the orientations range from <b>-π/2 to π/2</b>. Actions needs to be a 2D array of shape `(n_envs, n_actions)`. For all exercises except the last one, we always have `n_envs=1` and `n_actions=4`.\n", |
457 | | - "\n", |
458 | | - "\n", |
459 | | - "> **Note**: There are different ways to represent orientations in 3D space. The observations of the environment returns [quaternions](https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation), while the symbolic model works with Euler Angles. You do not have to worry too much about that, as you will use [this scipy package](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html) to easily convert orientation representations.\n", |
460 | | - "\n", |
461 | | - "> **Note**: The actions need to be a 2D array of shape `(n_envs, n_actions)`. Except for parallel simulations on GPU for learning based methods, we set `n_envs=1`." |
462 | | - ] |
463 | | - }, |
464 | 435 | { |
465 | 436 | "cell_type": "markdown", |
466 | 437 | "metadata": {}, |
|
0 commit comments