diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 3518b38..a6ba2a9 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -2,7 +2,7 @@ This guide outlines how to set up the development environment for this project, prioritizing **reproducible builds**, **environment parity**, and **cross-hardware compatibility**. -## Reproducibility &uv +## Reproducibility & uv This project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and virtual environments. The `uv.lock` file is the absolute source of truth for package versions and must always be committed. @@ -48,6 +48,7 @@ The devcontainer provides an identical experience to local development but with ## Local Development (Alternative) If you prefer not to use Docker: + 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/). 2. Run `uv sync --frozen` (CPU) or `uv sync --frozen --extra cuda` (GPU). @@ -58,6 +59,7 @@ Verify your setup by running the JAX initialization test: ```bash uv run pytest tests/test_jax_init.py ``` + In the devcontainer, this will succeed on both CPU and GPU. A `GpuDevice` is expected if a GPU is detected and the `cuda` extra was installed. ## Logging & Monitoring diff --git a/docs/HPC.md b/docs/HPC.md index 3e0e8d1..c4ebf6a 100644 --- a/docs/HPC.md +++ b/docs/HPC.md @@ -33,6 +33,7 @@ qsub -l gpus=1 scripts/hpc/install.sh Our scripts are cluster-agnostic and do **not** have hardcoded GPU requirements. Instead, you must request GPUs at runtime using the `-l gpus=1` flag when submitting to a production GPU cluster. ### Debugging (Donphan) + The `donphan` cluster does not support GPUs. Simply run the scripts without extra resource flags: ```bash module swap cluster/donphan @@ -40,6 +41,7 @@ qsub scripts/hpc/train.pbs ``` ### Production (Joltik, Accelgor, Litleo) + These clusters provide GPU acceleration and **require** a GPU request at runtime: ```bash module swap cluster/joltik # or accelgor/litleo @@ -64,11 +66,13 @@ After installation, run these commands to ensure your environment is set up corr ```bash ls -d venvs 2>/dev/null && echo "FAIL" || echo ">>> PASS: Project root is clean." ``` + 2. **Verify Library Versions (NumPy Fix)**: ```bash python -c "import numpy; print(f'NumPy: {numpy.__version__}')" # Expected: 2.x.x (Venv version), not 1.2x (System version) ``` + 3. **Verify GPU Access**: ```bash python -c "import torch, jax; print(f'GPU: {torch.cuda.is_available()}'); print(f'JAX: {jax.devices()}')" diff --git a/docs/api/analysis.md b/docs/api/analysis.md index e852295..9c88895 100644 --- a/docs/api/analysis.md +++ b/docs/api/analysis.md @@ -5,6 +5,7 @@ This guide outlines the tools available for analyzing experimental data and gene ## Shared Configuration All plotting scripts share a central configuration in `scripts/plots/plot_config.py`. This file defines: + - **Color Palette:** A color-blind friendly, high-contrast palette for different architectures. - **Typography:** Consistent font sizes and styles tailored for A0 posters. - **Markers:** Shared visual indicators, such as the ★ used for best performers. @@ -40,6 +41,7 @@ uv run python scripts/plots/analyze_comparisons.py path/to/results.csv \ ### Outputs The script generates four key plots, each saved as both `.png` and `.svg`: + 1. **Forward Velocity:** Grouped bar chart (cm/s). 2. **Accumulated Reward:** Mean cumulative reward. 3. **Success Rate:** Target acquisition percentage. @@ -65,6 +67,7 @@ uv run python scripts/plots/analyze_convergence.py --output_dir runs/convergence ### Outputs Generates three plots (PNG & SVG): + 1. `convergence_comparison`: Grouped horizontal bar chart. 2. `progress_reward_curves`: Line plots of reward over time. 3. `progress_velocity_curves`: Line plots of velocity over time. @@ -74,7 +77,9 @@ Generates three plots (PNG & SVG): ## Poster Integration (Figma) ### SVG & Scaling + We recommend using the **SVG** outputs for poster design in Figma: + 1. **No Resolution Loss:** SVGs are vector-based and will remain sharp at any size. 2. **Native Text:** Text in the SVG imports as native text layers in Figma. 3. **Exact Font Matching:** To ensure a `28pt` font in the plot matches a `28pt` font in your poster, set the `--fig_width` and `--fig_height` to match the physical dimensions of the plot box in your Figma layout. diff --git a/docs/api/environment.md b/docs/api/environment.md index 470732d..e54a698 100644 --- a/docs/api/environment.md +++ b/docs/api/environment.md @@ -1,12 +1,15 @@ # Brittle star environment ## Creation + The environment package contains a factory class `BrittleStarEnvFactory` that creates instances of the environment/morphologies/... It uses the configuration classes defined in `env_config.py` to create the instances. ## Configuration + The data classes in `env_config` have default values as stated in the tutorials. + * MorphologyConfig: configuration for the morphology of the brittle star. Contains number of arms, number of segments per arm, and control mode. * ArenaConfig: configuration for the arena. Sets the size of the arena, whether to @@ -15,10 +18,13 @@ set the ground floor to sand, attach a target and sizes of the walls. such as camera locations, simulation time and the task. ## Backend and Task enums + The Backend enum specifies either an MJC or MJX backend. + * MJC: runs on CPU * MJX: uses jax on the gpu The Task enum specifies which task to use. 2 items are present: + * DIRECTED_LOCOMOTION: move to a target location * LIGHT_ESCAPE: situation where the robot must move to a darker location diff --git a/docs/design/communication.md b/docs/design/communication.md index 4a9cc82..73b1220 100644 --- a/docs/design/communication.md +++ b/docs/design/communication.md @@ -1,6 +1,7 @@ # Communication scheme (Message Passing) Remember our research question: + > "What is the impact of different levels of controller modularity on learning speed, coordination, and fault tolerance > (e.g. amputations) in brittle-star-like robots trained with Reinforcement Learning?" diff --git a/docs/design/reward_function.md b/docs/design/reward_function.md index 9cf178f..afbf18b 100644 --- a/docs/design/reward_function.md +++ b/docs/design/reward_function.md @@ -8,8 +8,7 @@ inputs must be distributed fairly to guarantee an objective comparison between d - The reward function is centered around minimizing the distance to the goal or maximizing the movement towards the goal within a finite number of timesteps $T$. - To motivate efficient movement, the amount of timesteps taken to reach the goal will be used as penalty. -- An extra penalty based on movement relative to the current step and -the previous is used to penalize a movement away from the target. +- An extra penalty based on movement relative to the current step and the previous is used to penalize a movement away from the target. ## From reward to PPO