imitate_episodes.pyTrain and Evaluate ACTpolicy.pyAn adaptor for ACT policydetrModel definitions of ACT, modified from DETRsim_env.pyMujoco + DM_Control environments with joint space controlee_sim_env.pyMujoco + DM_Control environments with EE space controlscripted_policy.pyScripted policies for sim environmentsconstants.pyConstants shared across filesutils.pyUtils such as data loading and helper functionsvisualize_episodes.pySave videos from a .hdf5 dataset
conda create -n aloha python=3.8.10
conda activate aloha
pip install torchvision
pip install torch
pip install pyquaternion
pip install pyyaml
pip install rospkg
pip install pexpect
pip install mujoco==2.3.7
pip install dm_control==1.0.14
pip install opencv-python
pip install matplotlib
pip install einops
pip install packaging
pip install h5py
pip install ipython
cd act/detr && pip install -e .
To set up a new terminal, run:
conda activate aloha
cd <path to act repo>
| Task Name | Description |
|---|---|
sim_transfer_cube_scripted |
Transfer cube with scripted policy |
sim_slot_insertion_scripted |
Peg insertion task |
sim_cupboard_scripted |
Cupboard opening/closing |
sim_stack_scripted |
Stacking cubes |
We use sim_transfer_cube_scripted task in the examples below. Another option is sim_insertion_scripted.
To generated 50 episodes of scripted data, run:
python3 record_sim_episodes.py \
--task_name sim_transfer_cube_scripted \
--dataset_dir <data save dir> \
--num_episodes 50
To can add the flag --onscreen_render to see real-time rendering.
To visualize the episode after it is collected, run
python3 visualize_episodes.py --dataset_dir <data save dir> --episode_idx 0
To train ACT:
# Transfer Cube task
python3 imitate_episodes.py \
--task_name sim_transfer_cube_scripted \
--ckpt_dir <ckpt dir> \
--policy_class ACT --kl_weight 10 --chunk_size 100 --hidden_dim 512 --batch_size 8 --dim_feedforward 3200 \
--num_epochs 2000 --lr 1e-5 \
--seed 0
--pose_mode
To evaluate the policy, run the same command but add --eval. This loads the best validation checkpoint.
The success rate should be around 90% for transfer cube, and around 50% for insertion.
To enable temporal ensembling, add flag --temporal_agg.
Videos will be saved to <ckpt_dir> for each rollout.
You can also add --onscreen_render to see real-time rendering during evaluation.
Here when doing peg insertion, the --pose_mode could be set to similar and edge, random is the default mode
To see trajectory:
python3 trajectory_analysis_with_plots.py
To visualize the Z:
python3 z_analysis.py