Go2Py_SIM/README.md

65 lines
3.2 KiB
Markdown
Raw Normal View History

2023-10-28 00:15:40 +08:00
# Go2Py
2024-04-17 04:08:52 +08:00
2024-05-21 04:57:17 +08:00
Go2Py is a Pythonic interface and driver for low-level and high-level control of Unitree Go2 quadruped robots. The motivation of this project is to remove the burden of developing interface, safety systems, and basic components required for starting locomotion research using the Go2 quadruped robot. It provides a modular pipeline for real-time communication with the robot in both simulated and real-world environments with a unified interface.
2024-04-17 04:08:52 +08:00
<p align="center">
<img src="docs/assets/openfig.png" alt="image" width="60%" height="auto"/>
</p>
2024-04-17 03:00:32 +08:00
This project is comprised of the following components:
2024-05-21 04:57:17 +08:00
- **C++ Bridge:** A dockerized ROS2 bridge built upon the [unitree_ros2](https://github.com/unitreerobotics/unitree_ros2) that implements a remote-controlled emergency stop and publishes the robot states as standard ROS2 topics usable by upstream systems such as NAV2.
2024-04-17 03:00:32 +08:00
- **Robot Interface:** A simple Python class that represents the robot and communicates with the C++ bridge through either DDS (ROS independent) or ROS2 interfaces.
- **Robot Management FSM:** A finite state machine for controlling the behavior of the robot up to the point of handover to the user low-level controller (sitting down, standing up) with safety monitors (motor temperatures, emergency stops).
- **Robot Model:** A simple to use [Pinocchio](https://github.com/stack-of-tasks/pinocchio) wrapper for computing the kinematics and dynamics parameters of the robot.
2024-04-17 04:08:52 +08:00
- **Simulation Interface:** Simulation environments based on Mujoco and Nvidia Orbit (To be added) with a Python interface identical to the real robot.
2024-04-17 04:08:52 +08:00
## How Does Using it Look Like?
2024-04-17 03:00:32 +08:00
Communication with the robot will be as simple as importing a Python class:
```python
from Go2Py.robot.interface.dds import GO2Real
from Go2Py.robot.model import Go2Model
robot = GO2Real(mode='lowlevel')
model = Go2Model()
while running:
joint_state = robot.getJointStates()
imu = robot.getIMU()
remote = robot.getRemoteState()
model.update(state['q'], state['dq'],T,vel) # T and vel from the EKF
info = model.getInfo()
#User control computations ...
2024-04-17 03:00:32 +08:00
robot.setCommands(q_des, dq_des, kp, kd, tau_ff)
```
2024-05-21 04:57:17 +08:00
An identical workflow can be followed for simulation:
2024-04-17 03:00:32 +08:00
```python
from Go2Py.sim.mujoco import Go2Sim
from Go2Py.robot.model import Go2Model
robot = Go2Sim()
model = Go2Model()
robot.standDownReset()
while running:
joint_state = robot.getJointStates()
imu = robot.getIMU()
remote = robot.getRemoteState()
model.update(state['q'], state['dq'],T,vel) # T and vel from the EKF
info = model.getInfo()
2024-04-17 03:00:32 +08:00
#User control computations ...
2024-04-17 03:00:32 +08:00
robot.setCommands(q_des, dq_des, kp, kd, tau_ff)
robot.step()
```
2024-04-17 03:00:32 +08:00
## Installation
2024-05-21 04:57:17 +08:00
Follow through the steps here to [setup](docs/setup.md) the robot and Go2Py.
2024-04-17 03:00:32 +08:00
## Further Examples
2024-05-21 04:57:17 +08:00
A set of examples and tutorials are provided to get you up and running quickly:
2024-05-05 12:22:31 +08:00
- [Communicating with the robot](examples/00-robot-interface.ipynb)
- [Interracting with ROS2](examples/01-ros2-tools.ipynb)
- [Simulating with MuJoCo](examples/02-MuJoCo-sim.ipynb)
- [Robot dynamics and kinematics](examples/03-robot-dynamic-model.ipynb)
- [Finite state machine in low-level control](examples/04-FSM.ipynb)
- [Walk These Ways RL Controller](examples/05-walk-these-ways-RL-controller.ipynb)