Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: pre-commit

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

# Prevent parallel runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Create a virtual environment
run: uv venv

- name: Install the project
run: uv pip install ".[dev]"

# Cache pip for Python hook installs
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

# Run pre-commit in check-only mode (fail on any diffs)
- name: Run pre-commit (check-only)
uses: pre-commit/action@v3.0.1
with:
args: run --all-files --show-diff-on-failure
6 changes: 0 additions & 6 deletions .isort.cfg

This file was deleted.

45 changes: 12 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,13 @@ repos:
rev: v4.6.0
hooks:
- id: check-added-large-files


- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=.flake8"]

- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-xml
- id: check-yaml

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.981
Expand All @@ -38,22 +26,13 @@ repos:
- --no-strict-optional
- --disable-error-code=override
- --disable-error-code=attr-defined


# Beautysh formats Bash scripts
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
- id: beautysh

# Mdformat formats Markdown files
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat

# Codespell checks the code for common misspellings
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
- id: codespell
description: Checks for common misspellings in text files.
entry: codespell --skip="*ipynb"
language: python
types: [text]
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

<img src="./docs/stretch_mujoco.png" title="Stretch In Kitchen" width="100%">
<img src="./docs/images/stretch_mujoco.png" title="Stretch In Kitchen" width="100%">

This library provides a simulation stack for Stretch, built on [MuJoCo](https://github.com/google-deepmind/mujoco). There is position control for the arm, head, and gripper joints, velocity control for mobile base, calibrated camera RGB + depth imagery, 2D spinning lidar scans, and more. There is a visualizer that supports [user interaction](https://youtu.be/2P-Dt-Jfd6U), or a more efficient headless mode. There is a [ROS2 package](https://github.com/hello-robot/stretch_ros2/tree/humble/stretch_simulation), built on this library, that works with Nav2, Web Teleop, and more. There is 100s of permutations of Robocasa-provided kitchen environments that Stretch can spawn into. The MuJoCo API can be used for features like deformables, procedural model generation, SDF collisions, cloth simulation, and more.

Expand Down Expand Up @@ -45,8 +45,8 @@ uv run launch_sim.py
To exit, press `Ctrl+C` in the terminal.

<p>
<img src="./docs/camera_streams.png" title="Camera Streams" height="250px">
<img src="./docs/stretch3_in_mujoco.png" title="Camera Streams" height="250px">
<img src="./docs/images/camera_streams.png" title="Camera Streams" height="250px">
<img src="./docs/images/stretch3_in_mujoco.png" title="Camera Streams" height="250px">
</p>

> On MacOS, if `mjpython` fails to locate `libpython3.10.dylib` and `libz.1.dylib`, run these commands:
Expand Down Expand Up @@ -96,8 +96,8 @@ uv run examples/robocasa_environment.py

Ignore any warnings.

<img src="./docs/robocasa_scene_1.png" title="Camera Streams" width="300px">
<img src="./docs/robocasa_scene_camera_data.png" title="Camera Streams" width="300px">
<img src="./docs/images/robocasa_scene_1.png" title="Camera Streams" width="300px">
<img src="./docs/images/robocasa_scene_camera_data.png" title="Camera Streams" width="300px">

## Writing Code

Expand Down Expand Up @@ -213,6 +213,16 @@ Check out the following documentation resources:

All the enhancements/missing features/Bugfixes are tracked by [Issues](https://github.com/hello-robot/stretch_mujoco/issues) filed. Please feel free to file an issue if you would like to report bugs or request a feature addition.

## Contributing

This repository uses [pre-commit hooks](https://pre-commit.com/).

Install pre-commit in the dev optional dependencies: `uv pip install ".[dev]`

Install the hooks locally: cd to the top-level of this repository and run `pre-commit install`.

Run pre-commit manually: `pre-commit run --all-files`

## Acknowledgment

The assets in this repository contain significant contributions and efforts from [Kevin Zakka](https://github.com/kevinzakka) and [Google Deepmind](https://github.com/google-deepmind), along with others in Hello Robot Inc. who helped us in modeling Stretch in Mujoco. Thank you for your contributions.
The assets in this repository contain significant contributions and efforts from [Kevin Zakka](https://github.com/kevinzakka) and [Google Deepmind](https://github.com/google-deepmind), along with others in Hello Robot Inc. who helped us in modeling Stretch in Mujoco. Thank you for your contributions.
2 changes: 1 addition & 1 deletion stretch_mujoco/mujoco_server_camera_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _pull_camera_data(self):
def _create_camera_renderer(self, for_camera: StretchCameras):
settings = for_camera.initial_camera_settings

# Update mujoco's offscreen gl buffer size to accomodate bigger resolutions:
# Update mujoco's offscreen gl buffer size to accommodate bigger resolutions:
offscreen_buffer_width = self.mujoco_server.mjmodel.vis.global_.offwidth
offscreen_buffer_height = self.mujoco_server.mjmodel.vis.global_.offheight

Expand Down
2 changes: 1 addition & 1 deletion stretch_mujoco/mujoco_server_passive.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _run_ui_simulation(self, show_viewer_ui: bool):
) # 1/Hz.Put the UI thread to sleep so that the physics thread can do work, to mitigate `viewer.lock()` locking physics thread.

click.secho(
f"Using the Mujoco Passive Viewer. Note: UI thread and camera rendering is capped to {1/UI_FPS_CAP_RATE}Hz to increase performance. You can set this rate using the `camera_rate` arugment.",
f"Using the Mujoco Passive Viewer. Note: UI thread and camera rendering is capped to {1/UI_FPS_CAP_RATE}Hz to increase performance. You can set this rate using the `camera_rate` argument.",
fg="green",
)

Expand Down
Loading