Skip to content

Commit d57b974

Browse files
committed
Restore split Playground pybind registrations
1 parent 0692b17 commit d57b974

16 files changed

Lines changed: 500 additions & 54 deletions

envpool/mujoco/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,20 @@ pybind_extension(
503503
srcs = [
504504
"playground/mujoco_plugin_init.cc",
505505
"playground/playground_envpool.cc",
506+
"playground/py_envpool_register.h",
507+
"playground/register_aloha.cc",
508+
"playground/register_apollo.cc",
509+
"playground/register_barkour.cc",
510+
"playground/register_berkeley_humanoid.cc",
511+
"playground/register_g1.cc",
512+
"playground/register_go1.cc",
513+
"playground/register_h1.cc",
514+
"playground/register_hand.cc",
515+
"playground/register_op3.cc",
516+
"playground/register_panda.cc",
517+
"playground/register_panda_robotiq.cc",
518+
"playground/register_spot.cc",
519+
"playground/register_t1.cc",
506520
],
507521
deps = [
508522
":playground_env",

envpool/mujoco/playground/playground_envpool.cc

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,20 @@
1313
// limitations under the License.
1414

1515
#include "envpool/core/py_envpool.h"
16-
#include "envpool/mujoco/playground/aloha.h"
17-
#include "envpool/mujoco/playground/apollo.h"
18-
#include "envpool/mujoco/playground/barkour.h"
19-
#include "envpool/mujoco/playground/berkeley_humanoid.h"
20-
#include "envpool/mujoco/playground/g1.h"
21-
#include "envpool/mujoco/playground/go1.h"
22-
#include "envpool/mujoco/playground/h1.h"
23-
#include "envpool/mujoco/playground/hand.h"
24-
#include "envpool/mujoco/playground/op3.h"
25-
#include "envpool/mujoco/playground/panda.h"
26-
#include "envpool/mujoco/playground/panda_robotiq.h"
27-
#include "envpool/mujoco/playground/spot.h"
28-
#include "envpool/mujoco/playground/t1.h"
29-
30-
#define REGISTER_PLAYGROUND_ENV(MODULE, NAME) \
31-
using NAME##EnvSpec = PyEnvSpec<mujoco_playground::NAME##EnvSpec>; \
32-
using NAME##EnvPool = PyEnvPool<mujoco_playground::NAME##EnvPool>; \
33-
REGISTER(MODULE, NAME##EnvSpec, NAME##EnvPool)
16+
#include "envpool/mujoco/playground/py_envpool_register.h"
3417

3518
PYBIND11_MODULE(playground_envpool, m) {
36-
REGISTER_PLAYGROUND_ENV(m, PlaygroundAloha)
37-
REGISTER_PLAYGROUND_ENV(m, PlaygroundAlohaPixel)
38-
REGISTER_PLAYGROUND_ENV(m, PlaygroundApollo)
39-
REGISTER_PLAYGROUND_ENV(m, PlaygroundApolloPixel)
40-
REGISTER_PLAYGROUND_ENV(m, PlaygroundBarkour)
41-
REGISTER_PLAYGROUND_ENV(m, PlaygroundBarkourPixel)
42-
REGISTER_PLAYGROUND_ENV(m, PlaygroundBerkeleyHumanoid)
43-
REGISTER_PLAYGROUND_ENV(m, PlaygroundBerkeleyHumanoidPixel)
44-
REGISTER_PLAYGROUND_ENV(m, PlaygroundG1)
45-
REGISTER_PLAYGROUND_ENV(m, PlaygroundG1Pixel)
46-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1)
47-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1Pixel)
48-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1Getup)
49-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1GetupPixel)
50-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1Handstand)
51-
REGISTER_PLAYGROUND_ENV(m, PlaygroundGo1HandstandPixel)
52-
REGISTER_PLAYGROUND_ENV(m, PlaygroundH1)
53-
REGISTER_PLAYGROUND_ENV(m, PlaygroundH1Pixel)
54-
REGISTER_PLAYGROUND_ENV(m, PlaygroundHand)
55-
REGISTER_PLAYGROUND_ENV(m, PlaygroundHandPixel)
56-
REGISTER_PLAYGROUND_ENV(m, PlaygroundOp3)
57-
REGISTER_PLAYGROUND_ENV(m, PlaygroundOp3Pixel)
58-
REGISTER_PLAYGROUND_ENV(m, PlaygroundPanda)
59-
REGISTER_PLAYGROUND_ENV(m, PlaygroundPandaPixel)
60-
REGISTER_PLAYGROUND_ENV(m, PlaygroundPandaRobotiq)
61-
REGISTER_PLAYGROUND_ENV(m, PlaygroundPandaRobotiqPixel)
62-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotJoystick)
63-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotJoystickPixel)
64-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotGetup)
65-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotGetupPixel)
66-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotGait)
67-
REGISTER_PLAYGROUND_ENV(m, PlaygroundSpotGaitPixel)
68-
REGISTER_PLAYGROUND_ENV(m, PlaygroundT1)
69-
REGISTER_PLAYGROUND_ENV(m, PlaygroundT1Pixel)
19+
RegisterPlaygroundAloha(m);
20+
RegisterPlaygroundApollo(m);
21+
RegisterPlaygroundBarkour(m);
22+
RegisterPlaygroundBerkeleyHumanoid(m);
23+
RegisterPlaygroundG1(m);
24+
RegisterPlaygroundGo1(m);
25+
RegisterPlaygroundH1(m);
26+
RegisterPlaygroundHand(m);
27+
RegisterPlaygroundOp3(m);
28+
RegisterPlaygroundPanda(m);
29+
RegisterPlaygroundPandaRobotiq(m);
30+
RegisterPlaygroundSpot(m);
31+
RegisterPlaygroundT1(m);
7032
}
71-
72-
#undef REGISTER_PLAYGROUND_ENV
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef ENVPOOL_MUJOCO_PLAYGROUND_PY_ENVPOOL_REGISTER_H_
16+
#define ENVPOOL_MUJOCO_PLAYGROUND_PY_ENVPOOL_REGISTER_H_
17+
18+
#include <pybind11/pybind11.h>
19+
20+
void RegisterPlaygroundAloha(pybind11::module_& m);
21+
void RegisterPlaygroundApollo(pybind11::module_& m);
22+
void RegisterPlaygroundBarkour(pybind11::module_& m);
23+
void RegisterPlaygroundBerkeleyHumanoid(pybind11::module_& m);
24+
void RegisterPlaygroundG1(pybind11::module_& m);
25+
void RegisterPlaygroundGo1(pybind11::module_& m);
26+
void RegisterPlaygroundH1(pybind11::module_& m);
27+
void RegisterPlaygroundHand(pybind11::module_& m);
28+
void RegisterPlaygroundOp3(pybind11::module_& m);
29+
void RegisterPlaygroundPanda(pybind11::module_& m);
30+
void RegisterPlaygroundPandaRobotiq(pybind11::module_& m);
31+
void RegisterPlaygroundSpot(pybind11::module_& m);
32+
void RegisterPlaygroundT1(pybind11::module_& m);
33+
34+
#endif // ENVPOOL_MUJOCO_PLAYGROUND_PY_ENVPOOL_REGISTER_H_
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/aloha.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundAlohaEnvSpec =
20+
PyEnvSpec<mujoco_playground::PlaygroundAlohaEnvSpec>;
21+
using PlaygroundAlohaEnvPool =
22+
PyEnvPool<mujoco_playground::PlaygroundAlohaEnvPool>;
23+
using PlaygroundAlohaPixelEnvSpec =
24+
PyEnvSpec<mujoco_playground::PlaygroundAlohaPixelEnvSpec>;
25+
using PlaygroundAlohaPixelEnvPool =
26+
PyEnvPool<mujoco_playground::PlaygroundAlohaPixelEnvPool>;
27+
28+
void RegisterPlaygroundAloha(pybind11::module_& m) {
29+
REGISTER(m, PlaygroundAlohaEnvSpec, PlaygroundAlohaEnvPool)
30+
REGISTER(m, PlaygroundAlohaPixelEnvSpec, PlaygroundAlohaPixelEnvPool)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/apollo.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundApolloEnvSpec =
20+
PyEnvSpec<mujoco_playground::PlaygroundApolloEnvSpec>;
21+
using PlaygroundApolloEnvPool =
22+
PyEnvPool<mujoco_playground::PlaygroundApolloEnvPool>;
23+
using PlaygroundApolloPixelEnvSpec =
24+
PyEnvSpec<mujoco_playground::PlaygroundApolloPixelEnvSpec>;
25+
using PlaygroundApolloPixelEnvPool =
26+
PyEnvPool<mujoco_playground::PlaygroundApolloPixelEnvPool>;
27+
28+
void RegisterPlaygroundApollo(pybind11::module_& m) {
29+
REGISTER(m, PlaygroundApolloEnvSpec, PlaygroundApolloEnvPool)
30+
REGISTER(m, PlaygroundApolloPixelEnvSpec, PlaygroundApolloPixelEnvPool)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/barkour.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundBarkourEnvSpec =
20+
PyEnvSpec<mujoco_playground::PlaygroundBarkourEnvSpec>;
21+
using PlaygroundBarkourEnvPool =
22+
PyEnvPool<mujoco_playground::PlaygroundBarkourEnvPool>;
23+
using PlaygroundBarkourPixelEnvSpec =
24+
PyEnvSpec<mujoco_playground::PlaygroundBarkourPixelEnvSpec>;
25+
using PlaygroundBarkourPixelEnvPool =
26+
PyEnvPool<mujoco_playground::PlaygroundBarkourPixelEnvPool>;
27+
28+
void RegisterPlaygroundBarkour(pybind11::module_& m) {
29+
REGISTER(m, PlaygroundBarkourEnvSpec, PlaygroundBarkourEnvPool)
30+
REGISTER(m, PlaygroundBarkourPixelEnvSpec, PlaygroundBarkourPixelEnvPool)
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/berkeley_humanoid.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundBerkeleyHumanoidEnvSpec =
20+
PyEnvSpec<mujoco_playground::PlaygroundBerkeleyHumanoidEnvSpec>;
21+
using PlaygroundBerkeleyHumanoidEnvPool =
22+
PyEnvPool<mujoco_playground::PlaygroundBerkeleyHumanoidEnvPool>;
23+
using PlaygroundBerkeleyHumanoidPixelEnvSpec =
24+
PyEnvSpec<mujoco_playground::PlaygroundBerkeleyHumanoidPixelEnvSpec>;
25+
using PlaygroundBerkeleyHumanoidPixelEnvPool =
26+
PyEnvPool<mujoco_playground::PlaygroundBerkeleyHumanoidPixelEnvPool>;
27+
28+
void RegisterPlaygroundBerkeleyHumanoid(pybind11::module_& m) {
29+
REGISTER(m, PlaygroundBerkeleyHumanoidEnvSpec,
30+
PlaygroundBerkeleyHumanoidEnvPool)
31+
REGISTER(m, PlaygroundBerkeleyHumanoidPixelEnvSpec,
32+
PlaygroundBerkeleyHumanoidPixelEnvPool)
33+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/g1.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundG1EnvSpec = PyEnvSpec<mujoco_playground::PlaygroundG1EnvSpec>;
20+
using PlaygroundG1EnvPool = PyEnvPool<mujoco_playground::PlaygroundG1EnvPool>;
21+
using PlaygroundG1PixelEnvSpec =
22+
PyEnvSpec<mujoco_playground::PlaygroundG1PixelEnvSpec>;
23+
using PlaygroundG1PixelEnvPool =
24+
PyEnvPool<mujoco_playground::PlaygroundG1PixelEnvPool>;
25+
26+
void RegisterPlaygroundG1(pybind11::module_& m) {
27+
REGISTER(m, PlaygroundG1EnvSpec, PlaygroundG1EnvPool)
28+
REGISTER(m, PlaygroundG1PixelEnvSpec, PlaygroundG1PixelEnvPool)
29+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/go1.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundGo1EnvSpec = PyEnvSpec<mujoco_playground::PlaygroundGo1EnvSpec>;
20+
using PlaygroundGo1EnvPool = PyEnvPool<mujoco_playground::PlaygroundGo1EnvPool>;
21+
using PlaygroundGo1PixelEnvSpec =
22+
PyEnvSpec<mujoco_playground::PlaygroundGo1PixelEnvSpec>;
23+
using PlaygroundGo1PixelEnvPool =
24+
PyEnvPool<mujoco_playground::PlaygroundGo1PixelEnvPool>;
25+
using PlaygroundGo1GetupEnvSpec =
26+
PyEnvSpec<mujoco_playground::PlaygroundGo1GetupEnvSpec>;
27+
using PlaygroundGo1GetupEnvPool =
28+
PyEnvPool<mujoco_playground::PlaygroundGo1GetupEnvPool>;
29+
using PlaygroundGo1GetupPixelEnvSpec =
30+
PyEnvSpec<mujoco_playground::PlaygroundGo1GetupPixelEnvSpec>;
31+
using PlaygroundGo1GetupPixelEnvPool =
32+
PyEnvPool<mujoco_playground::PlaygroundGo1GetupPixelEnvPool>;
33+
using PlaygroundGo1HandstandEnvSpec =
34+
PyEnvSpec<mujoco_playground::PlaygroundGo1HandstandEnvSpec>;
35+
using PlaygroundGo1HandstandEnvPool =
36+
PyEnvPool<mujoco_playground::PlaygroundGo1HandstandEnvPool>;
37+
using PlaygroundGo1HandstandPixelEnvSpec =
38+
PyEnvSpec<mujoco_playground::PlaygroundGo1HandstandPixelEnvSpec>;
39+
using PlaygroundGo1HandstandPixelEnvPool =
40+
PyEnvPool<mujoco_playground::PlaygroundGo1HandstandPixelEnvPool>;
41+
42+
void RegisterPlaygroundGo1(pybind11::module_& m) {
43+
REGISTER(m, PlaygroundGo1EnvSpec, PlaygroundGo1EnvPool)
44+
REGISTER(m, PlaygroundGo1PixelEnvSpec, PlaygroundGo1PixelEnvPool)
45+
REGISTER(m, PlaygroundGo1GetupEnvSpec, PlaygroundGo1GetupEnvPool)
46+
REGISTER(m, PlaygroundGo1GetupPixelEnvSpec, PlaygroundGo1GetupPixelEnvPool)
47+
REGISTER(m, PlaygroundGo1HandstandEnvSpec, PlaygroundGo1HandstandEnvPool)
48+
REGISTER(m, PlaygroundGo1HandstandPixelEnvSpec,
49+
PlaygroundGo1HandstandPixelEnvPool)
50+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2026 Garena Online Private Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "envpool/core/py_envpool.h"
16+
#include "envpool/mujoco/playground/h1.h"
17+
#include "envpool/mujoco/playground/py_envpool_register.h"
18+
19+
using PlaygroundH1EnvSpec = PyEnvSpec<mujoco_playground::PlaygroundH1EnvSpec>;
20+
using PlaygroundH1EnvPool = PyEnvPool<mujoco_playground::PlaygroundH1EnvPool>;
21+
using PlaygroundH1PixelEnvSpec =
22+
PyEnvSpec<mujoco_playground::PlaygroundH1PixelEnvSpec>;
23+
using PlaygroundH1PixelEnvPool =
24+
PyEnvPool<mujoco_playground::PlaygroundH1PixelEnvPool>;
25+
26+
void RegisterPlaygroundH1(pybind11::module_& m) {
27+
REGISTER(m, PlaygroundH1EnvSpec, PlaygroundH1EnvPool)
28+
REGISTER(m, PlaygroundH1PixelEnvSpec, PlaygroundH1PixelEnvPool)
29+
}

0 commit comments

Comments
 (0)