b537677277
Robot into its own Class instead of lose Global Variables that cause circular imports StateClass usage instead of the old RobotState.py New Input Class for Controller and randome intputs
JackBot ML training and evaluation
Quick-start
- Create a Python virtualenv and activate it:
python -m venv .venv
source .venv/bin/activate
- Install dependencies (GPU users should install
torchappropriate for their CUDA):
pip install -r requirements.txt
- Quick training (short, for smoke test):
python ml/run_train.py --timesteps 50000 --model ml/checkpoints/ppo_joint_command
Use multi-robot training with --num-robots and --robot-spacing:
python ml/run_train.py --timesteps 50000 --model ml/checkpoints/ppo_joint_command --num-robots 3 --robot-spacing 0.75
Choose the start pose at reset with --start-pose:
python ml/run_train.py --timesteps 50000 --model ml/checkpoints/ppo_joint_command --start-pose init_deg
If you want to watch the agent train in the PyBullet window, add --gui:
python ml/run_train.py --timesteps 50000 --model ml/checkpoints/ppo_joint_command --gui
- Evaluate the trained model in GUI mode:
python ml/run_eval.py --model ml/checkpoints/ppo_joint_command.zip --episodes 3 --gui
For evaluation with multiple robots and start pose:
python ml/run_eval.py --model ml/checkpoints/ppo_joint_command.zip --episodes 3 --gui --num-robots 2 --robot-spacing 0.6 --start-pose init_deg
Notes
ml/env.pyexposes aJackBotEnvgym environment that uses yourJackBotUrdf.urdf.- The observation is
[joint_angles..., vx, vy, vz, omega]and the action is per-joint delta in [-1,1]. - Start with small timesteps and in
use_gui=Falseto speed up iteration. Increase timesteps and tune the reward for better walking quality. - Keep the trained models off hardware until they behave well in simulation.