Skip to content

Commit 88594d3

Browse files
authored
refactor!: unify env/scenes API across robots and restructure assets #283
Merge pull request #283 from RobotControlStack/feat/unified-env-config-and-assets-refactor
2 parents e788210 + 81a171e commit 88594d3

720 files changed

Lines changed: 147511 additions & 3329110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codex

Whitespace-only changes.

.github/workflows/ci.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Python
33
on:
44
workflow_call:
55
pull_request:
6-
paths:
7-
- "python/**"
8-
- "src/pybind/**"
9-
- ".github/workflows/py.yaml"
10-
- "extensions/**"
116
push:
127
branches:
138
- master

.github/workflows/cpp.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: Cpp
22
on:
33
workflow_call:
44
pull_request:
5-
paths:
6-
- "src/**"
7-
- "include/**"
8-
- ".github/workflows/cpp.yaml"
95
push:
106
branches:
117
- master
@@ -66,4 +62,3 @@ jobs:
6662
run: pip install --group dev --group build_deps
6763
- name: GCC build
6864
run: make gcccompile PYTHON_EXECUTABLE=${{ steps.setup-python.outputs.python-path }}
69-

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ FetchContent_Declare(
5858
)
5959

6060
FetchContent_MakeAvailable(pybind11 Eigen3 egl_headers)
61-
include(compile_scenes)
6261
# egl headers
6362
include_directories(${egl_headers_SOURCE_DIR}/api)
6463

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
PYSRC = python
22
CPPSRC = src
33
COMPILE_MODE = Release
4+
LINT_EXCLUDE_RUFF = --exclude examples/teleop/SimPublisher
5+
LINT_EXCLUDE_MYPY = 'build|examples/teleop/SimPublisher'
46

57
# CPP
68
cppcheckformat:
@@ -31,6 +33,8 @@ stubgen:
3133
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[typing\.Literal\[\([0-9]\+\)\], typing\.Literal\[1\]\]/tuple\[typing\.Literal[\1]\]/g'
3234
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[\([M|N]\), typing\.Literal\[1\]\]/tuple\[\1\]/g'
3335
sed -i 's/ q_home: numpy\.ndarray\[tuple\[M\], numpy\.dtype\[numpy\.float64\]\] | None/ q_home: numpy.ndarray | None/' python/rcs/_core/common.pyi
36+
python -c "from pathlib import Path; p=Path('python/rcs/_core/common.pyi'); t=p.read_text(); t=t.replace('numpy.ndarray[tuple[typing.Literal[2], N], numpy.dtype[numpy.float64]]', 'numpy.ndarray[tuple[typing.Literal[2], typing.Any], numpy.dtype[numpy.float64]]'); p.write_text(t)"
37+
python -c "from pathlib import Path; p=Path('python/rcs/_core/sim.pyi'); t=p.read_text(); t=t.replace('numpy.ndarray[tuple[typing.Literal[2], N], numpy.dtype[numpy.float64]]', 'numpy.ndarray[tuple[typing.Literal[2], typing.Any], numpy.dtype[numpy.float64]]'); t=t.replace(', max_buffer_frames: int = 100', ''); p.write_text(t)"
3438
python scripts/generate_common_typing.py
3539
ruff check --fix python/rcs/_core python/rcs/common_typing.py
3640
isort python/rcs/_core python/rcs/common_typing.py
@@ -48,10 +52,10 @@ pyformat:
4852
pylint: ruff mypy
4953

5054
ruff:
51-
ruff check ${PYSRC} extensions examples
55+
ruff check ${PYSRC} extensions examples ${LINT_EXCLUDE_RUFF}
5256

5357
mypy:
54-
mypy ${PYSRC} extensions examples --install-types --non-interactive --no-namespace-packages --exclude 'build'
58+
mypy ${PYSRC} extensions examples --install-types --non-interactive --no-namespace-packages --exclude ${LINT_EXCLUDE_MYPY}
5559

5660
pytest:
5761
pytest -vv

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,33 @@ from rcs.envs.base import (
5555
RobotWrapper,
5656
SimEnv,
5757
)
58+
from rcs.envs.scenes import EmptyWorldFR3
5859
from rcs.envs.sim import GripperWrapperSim, RobotSimWrapper
59-
from rcs.envs.utils import (
60-
default_mujoco_cameraset_cfg,
61-
default_sim_gripper_cfg,
62-
default_sim_robot_cfg,
63-
)
6460

6561
import rcs
6662
from rcs import sim
6763

6864
if __name__ == "__main__":
6965
# default configs
70-
robot_cfg = default_sim_robot_cfg(scene="fr3_empty_world")
71-
gripper_cfg = default_sim_gripper_cfg()
72-
cameras = default_mujoco_cameraset_cfg()
73-
sim_cfg = SimConfig()
74-
sim_cfg.realtime = True
75-
sim_cfg.async_control = True
76-
sim_cfg.frequency = 1 # in Hz (1 sec delay)
77-
78-
simulation = sim.Sim(robot_cfg.mjcf_scene_path, sim_cfg)
66+
scene = EmptyWorldFR3()
67+
cfg = scene.prefixed_cfg(scene.config())
68+
fr3 = scene.lead_robot_name(cfg)
69+
70+
robot_cfg = cfg.robot_cfgs[fr3]
71+
gripper_cfg = cfg.gripper_cfgs[fr3] # type: ignore
72+
camera_cfgs = cfg.camera_cfgs
73+
sim_cfg = SimConfig(
74+
realtime=True,
75+
async_control=True,
76+
frequency=1, # in Hz (1 sec delay)
77+
)
78+
mjmodel = scene.create_model(cfg)
79+
kinematic_model_path, attachment_site = scene.kinematics_cfg(cfg)[fr3]
80+
81+
simulation = sim.Sim(mjmodel, sim_cfg)
7982
ik = rcs.common.Pin(
80-
robot_cfg.kinematic_model_path,
81-
robot_cfg.attachment_site,
82-
urdf=False,
83+
kinematic_model_path,
84+
attachment_site,
8385
)
8486

8587
# base env
@@ -89,13 +91,13 @@ if __name__ == "__main__":
8991

9092
# gripper
9193
gripper = sim.SimGripper(simulation, gripper_cfg)
92-
env = GripperWrapper(env, gripper, binary=True)
94+
env = GripperWrapper(env, gripper)
9395

9496
env = RobotSimWrapper(env)
9597
env = GripperWrapperSim(env)
9698

9799
# camera
98-
camera_set = SimCameraSet(simulation, cameras, physical_units=True, render_on_demand=True)
100+
camera_set = SimCameraSet(simulation, camera_cfgs, physical_units=True, render_on_demand=True) # type: ignore
99101
env = CameraSetWrapper(env, camera_set, include_depth=True) # type: ignore
100102

101103
# relative actions bounded by 10cm translation and 10 degree rotation
@@ -192,3 +194,6 @@ If you find RCS useful for your academic work please consider citing it:
192194

193195
For more scientific information and supplementary videos, visit the **[paper website](https://robotcontrolstack.github.io/)**.
194196

197+
## License
198+
199+
The RCS source code is licensed under AGPL-3.0. A small subset of redistributed third-party robot and sensor assets under `assets/` keeps its original upstream license; the applicable notices are collected in [THIRD_PARTY_ASSET_LICENSES.md](THIRD_PARTY_ASSET_LICENSES.md).

0 commit comments

Comments
 (0)