This project provides a pipeline for collecting and processing data for vision-based tasks using the Unitree Go2 robot and D1 arm. Follow the steps below to set up your environment and collect your dataset.
- Create a conda environment, this is where you install all the remaining dependancies
conda create --name d1 python=3.9- Download and install the Unitree Go2 SDK 2 from the official Unitree Robotics website.
- Follow the official installation instructions for your platform.
- Install the D1 SDK as required for controlling the D1 arm.
- You may have received an executable, but a proper installation is recommended for full control.
- Refer to the D1 SDK documentation for installation steps.
- Run
control_with_joystick.pyto controll the arm using a joystick interface.
- Run
collect_with_joystick.pyto collect data using a joystick interface. - This will generate a dataset (e.g., a JSON file) with recorded actions.
python collect_with_joystick.py- Use
interpolate.pyto interpolate the collected data for smoother trajectories or denser sampling. - This saves the data as JSON with interpolated joint angles.
python interpolate.py --input data_from_joystick.json --output interpolated.jsonImportant
This can be skipped if using ACT policy as it directly uses the joint angles
- Use
apply_forward_kinematics.pyto process the interpolated data and compute the forward kinematics. - This step will save the actions part of the dataset as delta xyz.
- Applying forward kinematics
python apply_forward_kinematics.py --input interpolated.json --output interpolated_fk.json- To get the action part of dataset as joint angles run:
python joint_angle_data.py --input interpolated.json --output interpolated_ja.json- Use
collect_with_image.pyto collect the image part of the dataset. - This will save images corresponding to the actions in your dataset.
python collect_with_image.py --json unitree_sdk2/d1_data/gen_interpolated.json --save-root unitree_sdk2/d1_data/default- After completing the above steps, you will have:
- A JSON file with actions.
- Images (from step 5)
- Use these together as your vision-based dataset for further training or analysis.
- Install requirements for ACT (Action Chunking Transformer) as described in ACT
- To convert to ACT Dataset format (Images + joint angles JSON):
python3 act/convert_to_act_hdf5.py --images_root "imgs" --actions_json "actions.json" --out_dir "data" --camera_name top --pad_action_to 14 - Train ACT policy:
python3 act/imitate_episodes.py --task_name lift --ckpt_dir "act/model_0_0" --policy_class ACT --kl_weight 10 --chunk_size 1
0 --hidden_dim 512 --batch_size 8 --dim_feedforward 3200 --num_epochs 50 --lr 1e-5 --seed 0- Test ACT policy:
python3 act/test_on_real.pyNote:
- Ensure all SDKs and dependencies are properly installed and configured before running the scripts.
- Refer to the individual script files for additional arguments or configuration options.
- For latest version of this repo check here.