This repository contains a small, self-contained PyTorch research codebase to train and evaluate performance boosting controllers for a simple multi-robot reference tracking problem with optional collision and obstacle avoidance.
The main runnable entrypoint is experiments/robots/run.py, which:
- generates a synthetic dataset of rollouts + references,
- instantiates the robot plant (
RobotsSystem) and the controller (PerfBoostController), - trains the controller by backpropagating through closed-loop rollouts,
- saves plots and a trained controller checkpoint to
experiments/robots/saved_results/.
From the repo root:
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txtFrom the repo root:
python experiments/robots/run.pyUseful overrides (examples):
# shorter run
python experiments/robots/run.py --epochs 50 --num-rollouts 10 --horizon 50
# disable collision avoidance
python experiments/robots/run.py --no-col-av
# disable obstacle avoidance
python experiments/robots/run.py --no-obst-av
# force CPU (by disabling CUDA visibility)
CUDA_VISIBLE_DEVICES="" python experiments/robots/run.pyEach run creates a timestamped folder under:
experiments/robots/saved_results/perf_boost_<MM_DD_HH_MM_SS>/
Typical outputs include:
log: training log filetrained_controller.pt: trained controller weights (REN state_dict + metadata)CL_*_ref.pdf: closed-loop trajectories before trainingCL_*_trained.pdf: closed-loop trajectories after training- additional diagnostic PDFs (e.g., reference evolution, signals over time)
config.py: selects the PyTorch device (cuda:0if available, else CPU).setup.py: minimal packaging metadata (not required to run;requirements.txtis the main dependency entrypoint).README.md: this file.
run.py: main experiment script (dataset → plant/controller/loss → training → evaluation/plots/saving).arg_parser.py: CLI flags forrun.py(epochs, horizon, losses, etc.).saved_results/: generated artifacts (ignored by git).
costum_dataset.py: dataset base class (disk caching + train/test split utilities).robots/robots_dataset.py: synthetic dataset for the robots experiment (initial states + per-rollout references).robots/robots_sys.py: robot plant dynamics + closed-loop rollout helper used for training.
PB_controller.py:PerfBoostControllerthat wraps a contractive REN + a small MLP.contractive_ren.py:ContractiveRENimplementation (stability/contraction-constrained recurrent model).MLP.py: simple feed-forward network used insidePerfBoostController.__init__.py: controller exports.
lq_loss.py: finite-horizon LQ loss base used by experiments.robots_loss.py: robots-specific loss terms (tracking, control effort, collision, obstacles).__init__.py: loss exports.
assistive_functions.py: small utilities (tensor conversion, logging wrapper).plot_functions.py: plotting helpers for trajectories and diagnostics.
- Python version: this repo targets Python 3.10+.
- Reproducibility:
--random-seedcontrols dataset generation and PyTorch seed. - Performance: training backprops through closed-loop rollouts; GPU helps but CPU runs are supported.
The base case