Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Documentation For Aloha Solo #29

Merged
merged 9 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions docs/files/act_aloha_solo_real.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# @package _global_

# Use `act_aloha_solo_real.yaml` to train on real-world datasets collected on Aloha or Aloha-2 robots.
# It contains 2 cameras (i.e. cam_right_wrist/cam_left_wrist, cam_high).
# Also, `training.eval_freq` is set to -1. This config is used to evaluate checkpoints at a certain frequency of training steps.
# When it is set to -1, it deactivates evaluation. This is because real-world evaluation is done through our `control_robot.py` script.
# Look at the documentation in header of `control_robot.py` for more information on how to collect data , train and evaluate a policy.
#
# Example of usage for training and inference with `control_robot.py`:
# ```bash
# python lerobot/scripts/train.py \
# policy=act_aloha_solo_real \
# env=aloha_solo_real
# ```
#
# Example of usage for training and inference with [Dora-rs](https://github.com/dora-rs/dora-lerobot):
# ```bash
# python lerobot/scripts/train.py \
# policy=act_aloha_solo_real \
# env=dora_aloha_solo_real
# ```

seed: 1000
dataset_repo_id: lerobot/aloha_solo_lego

override_dataset_stats:
observation.images.cam_right_wrist:
# stats from imagenet, since we use a pretrained vision model
mean: [[[0.485]], [[0.456]], [[0.406]]] # (c,1,1)
std: [[[0.229]], [[0.224]], [[0.225]]] # (c,1,1)
# Uncomment for left wrist and comment the right wrist
# observation.images.cam_left_wrist:
# # stats from imagenet, since we use a pretrained vision model
# mean: [[[0.485]], [[0.456]], [[0.406]]] # (c,1,1)
# std: [[[0.229]], [[0.224]], [[0.225]]] # (c,1,1)
observation.images.cam_high:
# stats from imagenet, since we use a pretrained vision model
mean: [[[0.485]], [[0.456]], [[0.406]]] # (c,1,1)
std: [[[0.229]], [[0.224]], [[0.225]]] # (c,1,1)


training:
offline_steps: 80000
online_steps: 0
eval_freq: -1
save_freq: 10000
log_freq: 100
save_checkpoint: true

batch_size: 8
lr: 1e-5
lr_backbone: 1e-5
weight_decay: 1e-4
grad_clip_norm: 10
online_steps_between_rollouts: 1

delta_timestamps:
action: "[i / ${fps} for i in range(${policy.chunk_size})]"

eval:
n_episodes: 50
batch_size: 50

# See `configuration_act.py` for more details.
policy:
name: act

# Input / output structure.
n_obs_steps: 1
chunk_size: 100
n_action_steps: 100

input_shapes:
# TODO(rcadene, alexander-soare): add variables for height and width from the dataset/env?
observation.images.cam_right_wrist: [3, 480, 640]
# observation.images.cam_left_wrist: [3, 480, 640] # Uncomment if using left wrist and comment the right.
observation.images.cam_high: [3, 480, 640]
observation.state: ["${env.state_dim}"]
output_shapes:
action: ["${env.action_dim}"]

# Normalization / Unnormalization
input_normalization_modes:
observation.images.cam_right_wrist: mean_std
# observation.images.cam_left_wrist: mean_std # Uncomment if using left wrist and comment the right.
observation.images.cam_high: mean_std
observation.state: mean_std
output_normalization_modes:
action: mean_std

# Architecture.
# Vision backbone.
vision_backbone: resnet18
pretrained_backbone_weights: ResNet18_Weights.IMAGENET1K_V1
replace_final_stride_with_dilation: false
# Transformer layers.
pre_norm: false
dim_model: 512
n_heads: 8
dim_feedforward: 3200
feedforward_activation: relu
n_encoder_layers: 4
# Note: Although the original ACT implementation has 7 for `n_decoder_layers`, there is a bug in the code
# that means only the first layer is used. Here we match the original implementation by setting this to 1.
# See this issue https://github.com/tonyzhaozh/act/issues/25#issue-2258740521.
n_decoder_layers: 1
# VAE.
use_vae: true
latent_dim: 32
n_vae_encoder_layers: 4

# Inference.
temporal_ensemble_momentum: null

# Training and loss computation.
dropout: 0.1
kl_weight: 10.0
78 changes: 78 additions & 0 deletions docs/files/aloha_solo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# [Aloha: A Low-Cost Hardware for Bimanual Teleoperation](https://www.trossenrobotics.com/aloha-stationary)
# https://aloha-2.github.io

# Requires installing extras packages
# With pip: `pip install -e ".[dynamixel intelrealsense]"`
# With poetry: `poetry install --sync --extras "dynamixel intelrealsense"`

# See [tutorial](https://github.com/huggingface/lerobot/blob/main/examples/9_use_aloha.md)


_target_: lerobot.common.robot_devices.robots.manipulator.ManipulatorRobot
robot_type: aloha
# Specific to Aloha, LeRobot comes with default calibration files. Assuming the motors have been
# properly assembled, no manual calibration step is expected. If you need to run manual calibration,
# simply update this path to ".cache/calibration/aloha"
calibration_dir: .cache/calibration/aloha_default

# /!\ FOR SAFETY, READ THIS /!\
# `max_relative_target` limits the magnitude of the relative positional target vector for safety purposes.
# Set this to a positive scalar to have the same value for all motors, or a list that is the same length as
# the number of motors in your follower arms.
# For Aloha, for every goal position request, motor rotations are capped at 5 degrees by default.
# When you feel more confident with teleoperation or running the policy, you can extend
# this safety limit and even removing it by setting it to `null`.
# Also, everything is expected to work safely out-of-the-box, but we highly advise to
# first try to teleoperate the grippers only (by commenting out the rest of the motors in this yaml),
# then to gradually add more motors (by uncommenting), until you can teleoperate both arms fully
max_relative_target: null

leader_arms:
right:
_target_: lerobot.common.robot_devices.motors.dynamixel.DynamixelMotorsBus
port: /dev/ttyDXL_leader_right
motors: # window_x
# name: (index, model)
waist: [1, xm430-w350]
shoulder: [2, xm430-w350]
shoulder_shadow: [3, xm430-w350]
elbow: [4, xm430-w350]
elbow_shadow: [5, xm430-w350]
forearm_roll: [6, xm430-w350]
wrist_angle: [7, xm430-w350]
wrist_rotate: [8, xl430-w250]
gripper: [9, xc430-w150]

follower_arms:
right:
_target_: lerobot.common.robot_devices.motors.dynamixel.DynamixelMotorsBus
port: /dev/ttyDXL_follower_right
motors:
# name: [index, model]
waist: [1, xm540-w270]
shoulder: [2, xm540-w270]
shoulder_shadow: [3, xm540-w270]
elbow: [4, xm540-w270]
elbow_shadow: [5, xm540-w270]
forearm_roll: [6, xm540-w270]
wrist_angle: [7, xm540-w270]
wrist_rotate: [8, xm430-w350]
gripper: [9, xm430-w350]

# Troubleshooting: If one of your IntelRealSense cameras freeze during
# data recording due to bandwidth limit, you might need to plug the camera
# on another USB hub or PCIe card.
cameras:
cam_high:
_target_: lerobot.common.robot_devices.cameras.intelrealsense.IntelRealSenseCamera
serial_number: 1234567890
fps: 30
width: 640
height: 480

cam_right_wrist:
_target_: lerobot.common.robot_devices.cameras.intelrealsense.IntelRealSenseCamera
serial_number: 1234567890
fps: 30
width: 640
height: 480
10 changes: 10 additions & 0 deletions docs/files/aloha_solo_real.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @package _global_

fps: 30

env:
name: real_world
task: null
state_dim: 9
action_dim: 9
fps: ${fps}
1 change: 1 addition & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Getting Started

./getting_started/mobile.rst
./getting_started/stationary.rst
./getting_started/solo.rst
24 changes: 15 additions & 9 deletions docs/getting_started/mobile/software_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,24 @@ To build the SLATE base control software, run the following commands:
ALOHA Software Installation
===========================

.. admonition:: Important Compatibility Notice

This documentation and software correspond to **Aloha version 2.0**.
shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved
It supports features such as teleoperation, data recording, replay, and visualization.
However, it is **not compatible** with training and evaluation for **ACT** or **ACT++**.

For end-to-end training of **Aloha Stationary** and **Aloha Mobile**, stick to **Aloha 1.0**.
shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved
You can find the Aloha 1.0 documentation here: `Aloha 1.0 Documentation <https://docs.trossenrobotics.com/aloha_docs>`_
shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved

We are actively working on updates to provide full compatibility in the future.


shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved
1. Clone the Interbotix fork of ALOHA into the workspace's source directory:

.. code-block:: bash

$ cd ~/interbotix_ws/src
$ git clone https://github.com/Interbotix/aloha.git
$ git clone https://github.com/Interbotix/aloha.git -b 2.0

2. Run rosdep to install any dependencies:

Expand All @@ -95,13 +107,7 @@ ALOHA Software Installation

.. _`link`: https://github.com/Interbotix/interbotix_ros_toolboxes/blob/c187bcea89b60391244bb19943ebd78f770aa975/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_robot/arm.py#L81

4. Add the following line to your ``~/.bashrc`` file:

.. code-block:: bash

$ echo "export INTERBOTIX_ALOHA_IS_MOBILE=true" >> ~/.bashrc

5. Build the workspace:
4. Build the workspace:

.. code-block:: bash

Expand Down Expand Up @@ -199,7 +205,7 @@ Camera Setup
.. image:: images/rsviewer_serialno.png
:align: center

4. Put the camera serial number in the appropriate config entry at ``~/interbotix_ws/src/aloha/config/rs_cam.yaml``.
4. Put the camera serial number in the appropriate config entry at ``~/interbotix_ws/src/aloha/config/robot/aloha_mobile.yaml``.

5. Repeat for the rest of the cameras.
If the workspace has not been symbolically-linked, a rebuild may be necessary.
Expand Down
9 changes: 9 additions & 0 deletions docs/getting_started/solo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
================================
Solo ALOHA Getting Started
================================

.. toctree::
:maxdepth: 2

./solo/hardware_setup.rst
./solo/software_setup.rst
32 changes: 32 additions & 0 deletions docs/getting_started/solo/hardware_setup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
===========================
Solo ALOHA Hardware Setup
===========================
shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved

.. attention::

This page is under construction as we work to provide images and more comprehensive videos.

If you need any assistance or have questions about this process, please `contact our customer service`_.

.. _`contact our customer service`: https://www.trossenrobotics.com/support

Assembly Guide
==============

Video Overview
--------------

.. youtube:: jh21xCD_H0w
:align: center

Steps
-----

shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved

#. Attach the camera mount and fix the camera securely on the Viper arm.
#. Find a stable, flat surface to place your arms. Once satisfied, secure them using `Gorilla Tape <https://a.co/d/2v591vP>`_ or G-Clamps.
#. Connect the power cables to the arms.
#. Position the tripod so the camera effectively covers the experiment space.
**Warning:** Keep the camera position consistent throughout data collection and evaluation for optimal results.
shantanuparab-tr marked this conversation as resolved.
Show resolved Hide resolved
#. Connect the camera cables and arm cables to the USB hub.
#. Connect the USB hub to your computer.
Loading