|
1 | 1 | # Robot Control Stack |
2 | | -RCS is a unified and multilayered robot control interface over a MuJoCo simulation and real world robot currently implemented for the FR3. |
| 2 | +RCS is a unified and multilayered robot control interface over a MuJoCo simulation and real world robot currently implemented for the FR3/Panda, xArm7, UR5e and SO101. |
3 | 3 | ## Requirements |
4 | 4 | We build and test RCS on the latest Debian and on the latest Ubuntu LTS. |
5 | 5 |
|
@@ -28,32 +28,6 @@ pip config --site set global.no-build-isolation false |
28 | 28 | pip install -ve . |
29 | 29 | ``` |
30 | 30 |
|
31 | | -## Docker (GUI + GPU + HW add-ons) |
32 | | - |
33 | | -**Prereqs:** Docker + docker-compose, X11 on host, NVIDIA driver + NVIDIA Container Toolkit (legacy `runtime: nvidia`). |
34 | | -**Layout:** `docker/Dockerfile`, overrides in `docker/compose/` (`base.yml`, `gui.yml`, `gpu.yml`, `hw.yml`). |
35 | | - |
36 | | -### Build the image |
37 | | -`docker-compose -f docker/compose/base.yml build dev` |
38 | | - |
39 | | -### (GUI) allow X access (host) |
40 | | -`export XAUTHORITY=${XAUTHORITY:-$HOME/.Xauthority}` |
41 | | -`xhost +local:docker` |
42 | | - |
43 | | -### Run container with GUI + GPU + HW and open a shell |
44 | | -`docker-compose -f docker/compose/base.yml -f docker/compose/gui.yml -f docker/compose/gpu.yml -f docker/compose/hw.yml run --rm run bash` |
45 | | -*(Use fewer `-f` files for lighter setups, e.g., GUI+GPU without HW.)* |
46 | | - |
47 | | -### Inside the container |
48 | | -`pip install -ve extensions/rcs_fr3` |
49 | | -`cd examples` |
50 | | -`python fr3_env_cartesian_control.py` |
51 | | - |
52 | | -### Troubleshooting |
53 | | -- **`nvidia-smi` missing in container:** ensure it exists on host at `/usr/bin/nvidia-smi` (GPU override bind-mounts it). |
54 | | -- **GUI can’t open:** re-run the `xhost` command and confirm `$DISPLAY` is set on the host. |
55 | | - |
56 | | - |
57 | 31 | ## Usage |
58 | 32 | The python package is called `rcs`. |
59 | 33 |
|
@@ -118,74 +92,12 @@ for _ in range(100): |
118 | 92 | print(act) |
119 | 93 | obs, reward, terminated, truncated, info = env_rel.step(act) |
120 | 94 | print(obs) |
121 | | - if truncated or terminated: |
122 | | - logger.info("Truncated or terminated!") |
123 | | - exit() |
124 | | -``` |
125 | | - |
126 | | -### Remote Procedure Call (RPC) Client and Server |
127 | | -#### Server |
128 | | -```python |
129 | | -from rcs.envs.creators import SimEnvCreator |
130 | | -from rcs.envs.utils import ( |
131 | | - default_mujoco_cameraset_cfg, |
132 | | - default_sim_gripper_cfg, |
133 | | - default_sim_robot_cfg, |
134 | | -) |
135 | | -from rcs.envs.base import ControlMode, RelativeTo |
136 | | -from rcs.rpc.server import RcsServer |
137 | | - |
138 | | -def run_server(): |
139 | | - env = SimEnvCreator()( |
140 | | - control_mode=ControlMode.JOINTS, |
141 | | - collision_guard=False, |
142 | | - robot_cfg=default_sim_robot_cfg(), |
143 | | - gripper_cfg=default_sim_gripper_cfg(), |
144 | | - cameras=default_mujoco_cameraset_cfg(), |
145 | | - max_relative_movement=0.1, |
146 | | - relative_to=RelativeTo.LAST_STEP, |
147 | | - ) |
148 | | - server = RcsServer(env, port=50051) |
149 | | - server.start() |
150 | | - |
151 | | -if __name__ == "__main__": |
152 | | - run_server() |
153 | | -``` |
154 | | - |
155 | | -#### Client |
156 | | -```python |
157 | | -import time |
158 | | -from python.rcs.rpc.client import RcsClient |
159 | | - |
160 | | -if __name__ == "__main__": |
161 | | - # Create the client (adjust host/port if needed) |
162 | | - client = RcsClient(host="localhost", port=50051) |
163 | | - |
164 | | - try: |
165 | | - print("Resetting environment...") |
166 | | - obs = client.reset() |
167 | | - print(f"Initial observation: {obs}") |
168 | | - |
169 | | - for i in range(5): |
170 | | - print(f"\nStep {i+1}") |
171 | | - # Replace with a valid action for your environment |
172 | | - action = 0 |
173 | | - obs, reward, terminated, truncated, info = client.step(action) |
174 | | - print(f"Obs: {obs}, Reward: {reward}, Terminated: {terminated}, Truncated: {truncated}, Info: {info}") |
175 | | - if terminated or truncated: |
176 | | - print("Episode finished, resetting...") |
177 | | - obs = client.reset() |
178 | | - print(f"Reset observation: {obs}") |
179 | | - time.sleep(0.5) |
180 | | - finally: |
181 | | - print("Closing client.") |
182 | | - client.close() |
183 | 95 | ``` |
184 | 96 |
|
185 | 97 |
|
186 | 98 | ### Examples |
187 | 99 | Checkout the python examples in the [examples](examples) folder: |
188 | | -- [fr3_direct_control.py](examples/fr3.py) shows direct robot control with RCS's python bindings |
| 100 | +- [fr3_direct_control.py](examples/fr3_direct_control.py) shows direct robot control with RCS's python bindings |
189 | 101 | - [fr3_env_joint_control.py](examples/env_joint_control.py) and [fr3_env_cartesian_control.py](examples/env_cartesian_control.py) demonstrates RCS's high level [gymnasium](https://gymnasium.farama.org/) interface both for joint- and end effector space control |
190 | 102 | All of these examples work both in the MuJoCo simulation as well as on your hardware FR3. |
191 | 103 |
|
@@ -213,31 +125,5 @@ python -m rcs_fr3 --help |
213 | 125 | python -m rcs_realsense --help |
214 | 126 | ``` |
215 | 127 |
|
216 | | -## Development |
217 | | -### Formatting and Linting |
218 | | -```shell |
219 | | -# check for c++ formatting errors |
220 | | -make cppcheckformat |
221 | | -# fix them |
222 | | -make cppformat |
223 | | -# Linting with clang tidy |
224 | | -make cpplint |
225 | | -# check for python formatting errors |
226 | | -make pycheckformat |
227 | | -# fix them |
228 | | -make pyformat |
229 | | -# Linting with ruff and mypy |
230 | | -make pylint |
231 | | -# Testing |
232 | | -make pytest |
233 | | -``` |
234 | | -### Stub Files for Python Bindings |
235 | | -We use autogenerated python stub files (`.pyi`) in the [`_core`](python/rcs/_core/) folder to show our linters the expected types of the C++ Python bindings. |
236 | | -If the python bindings in the C++ code have changed you might need to regenerate them by using: |
237 | | -```shell |
238 | | -make stubgen |
239 | | -``` |
240 | | - |
241 | | -### Develop Your Own Hardware Extension |
242 | | -TODO |
243 | | - |
| 128 | +## Developer Documentation |
| 129 | +See our documentation page [robot-control-stack.org](https://robot-control-stack.org) for the development documentation. |
0 commit comments