Metadata-Version: 2.4
Name: menlo-sdk
Version: 0.1.0rc8
Summary: Python SDK for Menlo robots. Supports Asimov 1.
Project-URL: Homepage, https://github.com/menloresearch/menlo-sdk
Project-URL: Documentation, https://docs.menlo.ai/asimov/1/program/sdk
Project-URL: Repository, https://github.com/menloresearch/menlo-sdk
Project-URL: Issues, https://github.com/menloresearch/menlo-sdk/issues
Project-URL: Changelog, https://github.com/menloresearch/menlo-sdk/blob/main/CHANGELOG.md
Author: Menlo Research
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: asimov,humanoid,robotics,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: asimov-protocol<2,>=1.2.1rc1
Requires-Dist: livekit<2,>=1.1.4
Requires-Dist: protobuf>=5.29.3
Requires-Dist: questionary<3,>=2.0
Requires-Dist: rich>=13.7
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://menlo.ai"><img src="https://docs.menlo.ai/menlo-logo.svg" alt="Menlo" width="160"></a>
</p>

# menlo-sdk

Python SDK for Menlo robots. Supports Asimov 1.

## Requirements

- Python 3.12 or newer.
- Optional, only for the calls that use them: Pillow for `Frame.to_jpeg()`, NumPy for
  `Frame.to_numpy()`, OpenCV (`opencv-python`) for `Clip.save_mp4()`.

## Installation

```bash
pip install menlo-sdk
```

## Usage

Connect with the robot's address:

```python
from menlo.asimov import ConnectionConfig, NotReadyError, Robot, UdpConfig

config = ConnectionConfig(udp=UdpConfig(host="192.168.22.32"))
```

Read the robot's state. This sends nothing:

```python
with Robot(config).connect() as robot:
    print(robot.get_state().mode.name)  # DAMP, STAND or MOVE
```

Put the robot in STAND: the actuators hold a standing pose, with no balancing. The robot
must hang from its gantry hook with both feet on the floor. `stand()` returns once the robot
is in STAND and armed:

```python
with Robot(config).connect() as robot:
    robot.stand()
```

Put the robot in MOVE: the walking policy balances it in place. `balance()` returns once the
robot reports MOVE:

```python
with Robot(config).connect() as robot:
    robot.balance()
```

Walk: in MOVE the robot follows the velocity you send, here 0.3 m/s forward for 3 s. A walk
needs 2 m of clear floor ahead, and Asimov Manager open at the E-Stop. `set_velocity()`
returns once the 3 s are over and zero velocity is sent. `balance()` keeps the robot in MOVE
at zero velocity, balancing in place:

```python
with Robot(config).connect() as robot:
    robot.set_velocity(vx=0.3, duration=3.0)
    robot.balance()
```

Put the robot in DAMP: every actuator stops holding its position, so a standing robot falls.
Only do this with the robot supported, hanging from its gantry hook or seated on a bench:

```python
with Robot(config).connect() as robot:
    robot.damp()
```

When the robot cannot do a command now, the command raises `NotReadyError` and sends nothing:

```python
with Robot(config).connect() as robot:
    try:
        robot.set_velocity(vx=0.3, duration=3.0)
    except NotReadyError as exc:
        print(exc)  # not ready to move: the robot is in STAND; balance() it first (wrong_mode)
```

## Documentation

- [Python SDK on Asimov 1](https://docs.menlo.ai/asimov/1/program/sdk): installing the SDK and running the examples on Asimov 1.
- [Python SDK guide](https://docs.menlo.ai/sdk): the full documentation.
- [Safety](https://docs.menlo.ai/sdk/safety): what to check before a script moves the robot.
- [Examples](https://github.com/menloresearch/menlo-sdk/tree/main/examples): demos of the SDK's features.
- [Changelog](https://github.com/menloresearch/menlo-sdk/blob/main/CHANGELOG.md): the changes in each release.

## Security

To report a vulnerability, see [SECURITY.md](https://github.com/menloresearch/menlo-sdk/blob/main/SECURITY.md).

## License

Apache License 2.0. See [LICENSE](https://github.com/menloresearch/menlo-sdk/blob/main/LICENSE).
