antioch-py 2.0.7__py3-none-any.whl → 2.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of antioch-py might be problematic. Click here for more details.
- antioch/session/__init__.py +15 -13
- antioch/session/ark.py +22 -26
- antioch/session/objects/__init__.py +40 -0
- antioch/session/{views → objects}/animation.py +25 -52
- antioch/session/{views → objects}/articulation.py +30 -95
- antioch/session/{views → objects}/basis_curve.py +48 -54
- antioch/session/{views → objects}/camera.py +12 -39
- antioch/session/objects/collision.py +46 -0
- antioch/session/{views → objects}/geometry.py +6 -22
- antioch/session/{views → objects}/ground_plane.py +5 -20
- antioch/session/{views → objects}/imu.py +10 -30
- antioch/session/{views → objects}/joint.py +5 -20
- antioch/session/{views → objects}/light.py +14 -66
- antioch/session/{views → objects}/pir_sensor.py +20 -62
- antioch/session/objects/radar.py +62 -0
- antioch/session/{views → objects}/rigid_body.py +25 -110
- antioch/session/{views → objects}/xform.py +24 -24
- antioch/session/scene.py +116 -134
- antioch/session/session.py +34 -43
- antioch/session/task.py +2 -16
- {antioch_py-2.0.7.dist-info → antioch_py-2.2.1.dist-info}/METADATA +1 -1
- antioch_py-2.2.1.dist-info/RECORD +85 -0
- common/ark/ark.py +2 -0
- common/ark/hardware.py +1 -5
- common/ark/kinematics.py +1 -1
- common/constants.py +16 -2
- common/core/agent.py +28 -0
- common/core/auth.py +1 -3
- common/message/__init__.py +2 -0
- common/message/velocity.py +11 -0
- common/session/__init__.py +1 -24
- common/session/config.py +390 -0
- common/session/sim.py +36 -147
- antioch/session/views/__init__.py +0 -42
- antioch/session/views/collision.py +0 -75
- antioch/session/views/material.py +0 -54
- antioch/session/views/radar.py +0 -131
- antioch_py-2.0.7.dist-info/RECORD +0 -101
- common/session/views/__init__.py +0 -263
- common/session/views/animation.py +0 -73
- common/session/views/articulation.py +0 -184
- common/session/views/basis_curve.py +0 -102
- common/session/views/camera.py +0 -147
- common/session/views/collision.py +0 -59
- common/session/views/geometry.py +0 -102
- common/session/views/ground_plane.py +0 -41
- common/session/views/imu.py +0 -66
- common/session/views/joint.py +0 -81
- common/session/views/light.py +0 -96
- common/session/views/material.py +0 -25
- common/session/views/pir_sensor.py +0 -119
- common/session/views/radar.py +0 -107
- common/session/views/rigid_body.py +0 -236
- common/session/views/viewport.py +0 -21
- common/session/views/xform.py +0 -39
- {antioch_py-2.0.7.dist-info → antioch_py-2.2.1.dist-info}/WHEEL +0 -0
- {antioch_py-2.0.7.dist-info → antioch_py-2.2.1.dist-info}/entry_points.txt +0 -0
- {antioch_py-2.0.7.dist-info → antioch_py-2.2.1.dist-info}/top_level.txt +0 -0
|
@@ -2,18 +2,6 @@ from typing import Literal
|
|
|
2
2
|
|
|
3
3
|
from antioch.session.session import Session, SessionContainer
|
|
4
4
|
from common.message import Vector3
|
|
5
|
-
from common.session.views.basis_curve import (
|
|
6
|
-
AddBasisCurveLine,
|
|
7
|
-
AddBasisCurveSemiCircle,
|
|
8
|
-
GetBasisCurve,
|
|
9
|
-
GetBasisCurveExtents,
|
|
10
|
-
GetBasisCurveExtentsResponse,
|
|
11
|
-
GetBasisCurvePoints,
|
|
12
|
-
GetBasisCurvePointsResponse,
|
|
13
|
-
GetBasisCurveResponse,
|
|
14
|
-
RemoveBasisCurve,
|
|
15
|
-
SetBasisCurveVisibility,
|
|
16
|
-
)
|
|
17
5
|
|
|
18
6
|
|
|
19
7
|
class BasisCurve(SessionContainer):
|
|
@@ -45,13 +33,8 @@ class BasisCurve(SessionContainer):
|
|
|
45
33
|
"""
|
|
46
34
|
|
|
47
35
|
super().__init__()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
self._path = self._session.query_sim_rpc(
|
|
51
|
-
endpoint="get_basis_curve",
|
|
52
|
-
payload=GetBasisCurve(path=path),
|
|
53
|
-
response_type=GetBasisCurveResponse,
|
|
54
|
-
).path
|
|
36
|
+
self._session.query_sim_rpc(endpoint="basis_curve/get", payload={"path": path})
|
|
37
|
+
self._path = path
|
|
55
38
|
|
|
56
39
|
@property
|
|
57
40
|
def path(self) -> str:
|
|
@@ -71,6 +54,9 @@ class BasisCurve(SessionContainer):
|
|
|
71
54
|
radius: float = 1.0,
|
|
72
55
|
min_angle_deg: float = 0.0,
|
|
73
56
|
max_angle_deg: float = 180.0,
|
|
57
|
+
guide: bool = False,
|
|
58
|
+
color: Vector3 | None = None,
|
|
59
|
+
width: float = 0.005,
|
|
74
60
|
) -> "BasisCurve":
|
|
75
61
|
"""
|
|
76
62
|
Add a semi-circle basis curve to the scene.
|
|
@@ -80,18 +66,24 @@ class BasisCurve(SessionContainer):
|
|
|
80
66
|
:param radius: Radius of the basis curve.
|
|
81
67
|
:param min_angle_deg: Minimum angle of the basis curve in degrees.
|
|
82
68
|
:param max_angle_deg: Maximum angle of the basis curve in degrees.
|
|
69
|
+
:param guide: If True, mark as guide purpose (invisible to cameras). If False, default purpose.
|
|
70
|
+
:param color: Optional RGB color [0-1].
|
|
71
|
+
:param width: Width of the curve.
|
|
83
72
|
:return: The basis curve instance.
|
|
84
73
|
"""
|
|
85
74
|
|
|
86
75
|
Session.get_current().query_sim_rpc(
|
|
87
|
-
endpoint="
|
|
88
|
-
payload=
|
|
89
|
-
path
|
|
90
|
-
center
|
|
91
|
-
radius
|
|
92
|
-
min_angle_deg
|
|
93
|
-
max_angle_deg
|
|
94
|
-
|
|
76
|
+
endpoint="basis_curve/add_semi_circle",
|
|
77
|
+
payload={
|
|
78
|
+
"path": path,
|
|
79
|
+
"center": center,
|
|
80
|
+
"radius": radius,
|
|
81
|
+
"min_angle_deg": min_angle_deg,
|
|
82
|
+
"max_angle_deg": max_angle_deg,
|
|
83
|
+
"guide": guide,
|
|
84
|
+
"color": color,
|
|
85
|
+
"width": width,
|
|
86
|
+
},
|
|
95
87
|
)
|
|
96
88
|
return cls(path)
|
|
97
89
|
|
|
@@ -103,6 +95,9 @@ class BasisCurve(SessionContainer):
|
|
|
103
95
|
end: Vector3 | None = None,
|
|
104
96
|
angle_deg: float | None = None,
|
|
105
97
|
length: float | None = None,
|
|
98
|
+
guide: bool = False,
|
|
99
|
+
color: Vector3 | None = None,
|
|
100
|
+
width: float = 0.005,
|
|
106
101
|
) -> "BasisCurve":
|
|
107
102
|
"""
|
|
108
103
|
Add a line basis curve to the scene.
|
|
@@ -116,19 +111,25 @@ class BasisCurve(SessionContainer):
|
|
|
116
111
|
:param end: End point of the line (Cartesian mode).
|
|
117
112
|
:param angle_deg: Angle in degrees from +X axis in XY plane (polar mode).
|
|
118
113
|
:param length: Length of the line (polar mode).
|
|
114
|
+
:param guide: If True, mark as guide purpose (invisible to cameras). If False, default purpose.
|
|
115
|
+
:param color: Optional RGB color [0-1].
|
|
116
|
+
:param width: Width of the curve.
|
|
119
117
|
:return: The basis curve instance.
|
|
120
118
|
:raises ValueError: If both modes are specified or neither mode is complete.
|
|
121
119
|
"""
|
|
122
120
|
|
|
123
121
|
Session.get_current().query_sim_rpc(
|
|
124
|
-
endpoint="
|
|
125
|
-
payload=
|
|
126
|
-
path
|
|
127
|
-
start
|
|
128
|
-
end
|
|
129
|
-
angle_deg
|
|
130
|
-
length
|
|
131
|
-
|
|
122
|
+
endpoint="basis_curve/add_line",
|
|
123
|
+
payload={
|
|
124
|
+
"path": path,
|
|
125
|
+
"start": start,
|
|
126
|
+
"end": end,
|
|
127
|
+
"angle_deg": angle_deg,
|
|
128
|
+
"length": length,
|
|
129
|
+
"guide": guide,
|
|
130
|
+
"color": color,
|
|
131
|
+
"width": width,
|
|
132
|
+
},
|
|
132
133
|
)
|
|
133
134
|
return cls(path)
|
|
134
135
|
|
|
@@ -139,12 +140,10 @@ class BasisCurve(SessionContainer):
|
|
|
139
140
|
:return: Extents as tuple of start and end points.
|
|
140
141
|
"""
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
return extents.start, extents.end
|
|
143
|
+
result = self._session.query_sim_rpc(endpoint="basis_curve/get_extents", payload={"path": self._path})
|
|
144
|
+
if result is None:
|
|
145
|
+
raise RuntimeError("Failed to get extents")
|
|
146
|
+
return Vector3(**result[0]), Vector3(**result[1])
|
|
148
147
|
|
|
149
148
|
def get_points(
|
|
150
149
|
self, samples_per_segment: int = 10, sort_by: Literal["X", "Y", "Z"] | None = None, ascending: bool = True
|
|
@@ -157,11 +156,12 @@ class BasisCurve(SessionContainer):
|
|
|
157
156
|
:param ascending: Whether to sort the points in ascending order.
|
|
158
157
|
:return: The points of the basis curve.
|
|
159
158
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
)
|
|
159
|
+
|
|
160
|
+
response = self._session.query_sim_rpc(
|
|
161
|
+
endpoint="basis_curve/get_points",
|
|
162
|
+
payload={"path": self._path, "samples_per_segment": samples_per_segment, "sort_by": sort_by, "ascending": ascending},
|
|
163
|
+
)
|
|
164
|
+
return [Vector3(**pt) for pt in response] if response else []
|
|
165
165
|
|
|
166
166
|
def set_visibility(self, visible: bool) -> None:
|
|
167
167
|
"""
|
|
@@ -170,17 +170,11 @@ class BasisCurve(SessionContainer):
|
|
|
170
170
|
:param visible: True to make visible, False to hide.
|
|
171
171
|
"""
|
|
172
172
|
|
|
173
|
-
self._session.query_sim_rpc(
|
|
174
|
-
endpoint="set_basis_curve_visibility",
|
|
175
|
-
payload=SetBasisCurveVisibility(path=self._path, visible=visible),
|
|
176
|
-
)
|
|
173
|
+
self._session.query_sim_rpc(endpoint="basis_curve/set_visibility", payload={"path": self._path, "visible": visible})
|
|
177
174
|
|
|
178
175
|
def remove(self) -> None:
|
|
179
176
|
"""
|
|
180
177
|
Remove the basis curve from the scene.
|
|
181
178
|
"""
|
|
182
179
|
|
|
183
|
-
self._session.query_sim_rpc(
|
|
184
|
-
endpoint="remove_basis_curve",
|
|
185
|
-
payload=RemoveBasisCurve(path=self._path),
|
|
186
|
-
)
|
|
180
|
+
self._session.query_sim_rpc(endpoint="basis_curve/remove", payload={"path": self._path})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
2
|
from common.message import CameraInfo, Image, Pose
|
|
3
|
-
from common.session.
|
|
3
|
+
from common.session.config import CameraConfig
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Camera(SessionContainer):
|
|
7
7
|
"""
|
|
8
|
-
Camera
|
|
8
|
+
Camera object for time-synchronized image capture.
|
|
9
9
|
|
|
10
10
|
Example:
|
|
11
11
|
scene = Scene()
|
|
@@ -13,35 +13,21 @@ class Camera(SessionContainer):
|
|
|
13
13
|
frame = camera.get_frame()
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
-
def __init__(
|
|
17
|
-
self,
|
|
18
|
-
path: str,
|
|
19
|
-
config: CameraConfig | None = None,
|
|
20
|
-
):
|
|
16
|
+
def __init__(self, path: str, config: CameraConfig | None = None):
|
|
21
17
|
"""
|
|
22
|
-
Initialize camera
|
|
18
|
+
Initialize camera object.
|
|
23
19
|
|
|
24
20
|
:param path: USD path for the camera.
|
|
25
21
|
:param config: Optional camera config for intrinsics.
|
|
26
22
|
"""
|
|
27
23
|
|
|
28
24
|
super().__init__()
|
|
29
|
-
|
|
30
25
|
self._config = config
|
|
31
|
-
self.
|
|
32
|
-
|
|
33
|
-
payload=GetCamera(path=path),
|
|
34
|
-
response_type=GetCameraResponse,
|
|
35
|
-
).path
|
|
26
|
+
self._session.query_sim_rpc(endpoint="camera/get", payload={"path": path})
|
|
27
|
+
self._path = path
|
|
36
28
|
|
|
37
29
|
@classmethod
|
|
38
|
-
def add(
|
|
39
|
-
cls,
|
|
40
|
-
path: str,
|
|
41
|
-
config: CameraConfig,
|
|
42
|
-
world_pose: Pose | None,
|
|
43
|
-
local_pose: Pose | None,
|
|
44
|
-
) -> "Camera":
|
|
30
|
+
def add(cls, path: str, config: CameraConfig, world_pose: Pose | None, local_pose: Pose | None) -> "Camera":
|
|
45
31
|
"""
|
|
46
32
|
Add camera to the scene.
|
|
47
33
|
|
|
@@ -53,13 +39,8 @@ class Camera(SessionContainer):
|
|
|
53
39
|
"""
|
|
54
40
|
|
|
55
41
|
Session.get_current().query_sim_rpc(
|
|
56
|
-
endpoint="
|
|
57
|
-
payload=
|
|
58
|
-
path=path,
|
|
59
|
-
config=config,
|
|
60
|
-
world_pose=world_pose,
|
|
61
|
-
local_pose=local_pose,
|
|
62
|
-
),
|
|
42
|
+
endpoint="camera/add",
|
|
43
|
+
payload={"path": path, "config": config, "world_pose": world_pose, "local_pose": local_pose},
|
|
63
44
|
)
|
|
64
45
|
return cls(path, config)
|
|
65
46
|
|
|
@@ -70,13 +51,8 @@ class Camera(SessionContainer):
|
|
|
70
51
|
:return: Image (RGB or depth based on camera mode), or None if image data is not ready.
|
|
71
52
|
"""
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
payload=GetCameraFrame(path=self._path),
|
|
76
|
-
response_type=Image,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
return image
|
|
54
|
+
image_dict = self._session.query_sim_rpc(endpoint="camera/get_frame", payload={"path": self._path})
|
|
55
|
+
return Image(**image_dict) if image_dict else None
|
|
80
56
|
|
|
81
57
|
def get_camera_info(self, frame_id: str = "camera_optical_frame") -> CameraInfo | None:
|
|
82
58
|
"""
|
|
@@ -86,7 +62,4 @@ class Camera(SessionContainer):
|
|
|
86
62
|
:return: CameraInfo with full intrinsics and distortion parameters, or None if no config.
|
|
87
63
|
"""
|
|
88
64
|
|
|
89
|
-
if self._config
|
|
90
|
-
return None
|
|
91
|
-
|
|
92
|
-
return self._config.to_camera_info(frame_id=frame_id)
|
|
65
|
+
return self._config.to_camera_info(frame_id=frame_id) if self._config else None
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from antioch.session.session import Session
|
|
2
|
+
from common.session.config import MeshApproximation
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def set_collision(path: str, mesh_approximation: MeshApproximation | None = None) -> None:
|
|
6
|
+
"""
|
|
7
|
+
Apply collision API to a prim, optionally with mesh approximation.
|
|
8
|
+
|
|
9
|
+
:param path: USD path to the prim.
|
|
10
|
+
:param mesh_approximation: Optional mesh approximation method for collision geometry.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
Session.get_current().query_sim_rpc(endpoint="set_collision", payload={"path": path, "mesh_approximation": mesh_approximation})
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def remove_collision(path: str) -> None:
|
|
17
|
+
"""
|
|
18
|
+
Remove collision API from a prim.
|
|
19
|
+
|
|
20
|
+
:param path: USD path to the prim.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
Session.get_current().query_sim_rpc(endpoint="remove_collision", payload={"path": path})
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def has_collision(path: str) -> bool:
|
|
27
|
+
"""
|
|
28
|
+
Check if a prim has collision API applied.
|
|
29
|
+
|
|
30
|
+
:param path: USD path to the prim.
|
|
31
|
+
:return: True if collision API is applied.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
return Session.get_current().query_sim_rpc(endpoint="has_collision", payload={"path": path}, response_type=bool)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_mesh_approximation(path: str) -> MeshApproximation | None:
|
|
38
|
+
"""
|
|
39
|
+
Get mesh collision approximation from a prim.
|
|
40
|
+
|
|
41
|
+
:param path: USD path to the prim.
|
|
42
|
+
:return: Mesh approximation method, or None if not set.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
result = Session.get_current().query_sim_rpc(endpoint="get_mesh_approximation", payload={"path": path})
|
|
46
|
+
return MeshApproximation(result) if result else None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
2
|
from common.message import Pose
|
|
3
|
-
from common.session.
|
|
3
|
+
from common.session.config import GeometryConfig
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Geometry(SessionContainer):
|
|
@@ -36,22 +36,11 @@ class Geometry(SessionContainer):
|
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
super().__init__()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
self._path = self._session.query_sim_rpc(
|
|
42
|
-
endpoint="get_geometry",
|
|
43
|
-
payload=GetGeometry(path=path),
|
|
44
|
-
response_type=GetGeometryResponse,
|
|
45
|
-
).path
|
|
39
|
+
self._session.query_sim_rpc(endpoint="geometry/get", payload={"path": path})
|
|
40
|
+
self._path = path
|
|
46
41
|
|
|
47
42
|
@classmethod
|
|
48
|
-
def add(
|
|
49
|
-
cls,
|
|
50
|
-
path: str,
|
|
51
|
-
config: GeometryConfig,
|
|
52
|
-
world_pose: Pose | None,
|
|
53
|
-
local_pose: Pose | None,
|
|
54
|
-
) -> "Geometry":
|
|
43
|
+
def add(cls, path: str, config: GeometryConfig, world_pose: Pose | None, local_pose: Pose | None) -> "Geometry":
|
|
55
44
|
"""
|
|
56
45
|
Add geometry to the scene.
|
|
57
46
|
|
|
@@ -63,12 +52,7 @@ class Geometry(SessionContainer):
|
|
|
63
52
|
"""
|
|
64
53
|
|
|
65
54
|
Session.get_current().query_sim_rpc(
|
|
66
|
-
endpoint="
|
|
67
|
-
payload=
|
|
68
|
-
path=path,
|
|
69
|
-
config=config,
|
|
70
|
-
world_pose=world_pose,
|
|
71
|
-
local_pose=local_pose,
|
|
72
|
-
),
|
|
55
|
+
endpoint="geometry/add",
|
|
56
|
+
payload={"path": path, "config": config, "world_pose": world_pose, "local_pose": local_pose},
|
|
73
57
|
)
|
|
74
58
|
return cls(path)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.session.
|
|
2
|
+
from common.session.config import GroundPlaneConfig
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class GroundPlane(SessionContainer):
|
|
@@ -31,20 +31,11 @@ class GroundPlane(SessionContainer):
|
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
super().__init__()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
self._path = self._session.query_sim_rpc(
|
|
37
|
-
endpoint="get_ground_plane",
|
|
38
|
-
payload=GetGroundPlane(path=path),
|
|
39
|
-
response_type=GetGroundPlaneResponse,
|
|
40
|
-
).path
|
|
34
|
+
self._session.query_sim_rpc(endpoint="ground_plane/get", payload={"path": path})
|
|
35
|
+
self._path = path
|
|
41
36
|
|
|
42
37
|
@classmethod
|
|
43
|
-
def add(
|
|
44
|
-
cls,
|
|
45
|
-
path: str,
|
|
46
|
-
config: GroundPlaneConfig,
|
|
47
|
-
) -> "GroundPlane":
|
|
38
|
+
def add(cls, path: str, config: GroundPlaneConfig) -> "GroundPlane":
|
|
48
39
|
"""
|
|
49
40
|
Add a ground plane to the scene.
|
|
50
41
|
|
|
@@ -53,11 +44,5 @@ class GroundPlane(SessionContainer):
|
|
|
53
44
|
:return: The ground plane instance.
|
|
54
45
|
"""
|
|
55
46
|
|
|
56
|
-
Session.get_current().query_sim_rpc(
|
|
57
|
-
endpoint="add_ground_plane",
|
|
58
|
-
payload=AddGroundPlane(
|
|
59
|
-
path=path,
|
|
60
|
-
config=config,
|
|
61
|
-
),
|
|
62
|
-
)
|
|
47
|
+
Session.get_current().query_sim_rpc(endpoint="ground_plane/add", payload={"path": path, "config": config})
|
|
63
48
|
return cls(path)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
2
|
from common.message import ImuSample, Pose
|
|
3
|
-
from common.session.
|
|
3
|
+
from common.session.config import ImuConfig
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Imu(SessionContainer):
|
|
7
7
|
"""
|
|
8
|
-
IMU
|
|
8
|
+
IMU object for time-synchronized sensor data.
|
|
9
9
|
|
|
10
10
|
Example:
|
|
11
11
|
scene = Scene()
|
|
@@ -15,27 +15,17 @@ class Imu(SessionContainer):
|
|
|
15
15
|
|
|
16
16
|
def __init__(self, path: str):
|
|
17
17
|
"""
|
|
18
|
-
Initialize IMU
|
|
18
|
+
Initialize IMU object.
|
|
19
19
|
|
|
20
20
|
:param path: USD path for the IMU.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
super().__init__()
|
|
24
|
-
|
|
25
|
-
self._path =
|
|
26
|
-
endpoint="get_imu",
|
|
27
|
-
payload=GetImu(path=path),
|
|
28
|
-
response_type=GetImuResponse,
|
|
29
|
-
).path
|
|
24
|
+
self._session.query_sim_rpc(endpoint="imu/get", payload={"path": path})
|
|
25
|
+
self._path = path
|
|
30
26
|
|
|
31
27
|
@classmethod
|
|
32
|
-
def add(
|
|
33
|
-
cls,
|
|
34
|
-
path: str,
|
|
35
|
-
config: ImuConfig,
|
|
36
|
-
world_pose: Pose | None,
|
|
37
|
-
local_pose: Pose | None,
|
|
38
|
-
) -> "Imu":
|
|
28
|
+
def add(cls, path: str, config: ImuConfig, world_pose: Pose | None, local_pose: Pose | None) -> "Imu":
|
|
39
29
|
"""
|
|
40
30
|
Add IMU to the scene.
|
|
41
31
|
|
|
@@ -47,13 +37,8 @@ class Imu(SessionContainer):
|
|
|
47
37
|
"""
|
|
48
38
|
|
|
49
39
|
Session.get_current().query_sim_rpc(
|
|
50
|
-
endpoint="
|
|
51
|
-
payload=
|
|
52
|
-
path=path,
|
|
53
|
-
config=config,
|
|
54
|
-
world_pose=world_pose,
|
|
55
|
-
local_pose=local_pose,
|
|
56
|
-
),
|
|
40
|
+
endpoint="imu/add",
|
|
41
|
+
payload={"path": path, "config": config, "world_pose": world_pose, "local_pose": local_pose},
|
|
57
42
|
)
|
|
58
43
|
return cls(path)
|
|
59
44
|
|
|
@@ -64,10 +49,5 @@ class Imu(SessionContainer):
|
|
|
64
49
|
:return: IMU sensor measurements, or None if sensor data is not ready.
|
|
65
50
|
"""
|
|
66
51
|
|
|
67
|
-
sample = self._session.query_sim_rpc(
|
|
68
|
-
|
|
69
|
-
payload=GetImuSample(path=self._path),
|
|
70
|
-
response_type=ImuSample,
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return sample
|
|
52
|
+
sample = self._session.query_sim_rpc(endpoint="imu/get_sample", payload={"path": self._path})
|
|
53
|
+
return ImuSample(**sample) if sample else None
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.session.
|
|
2
|
+
from common.session.config import JointConfig
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Joint(SessionContainer):
|
|
@@ -32,20 +32,11 @@ class Joint(SessionContainer):
|
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
super().__init__()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
self._path = self._session.query_sim_rpc(
|
|
38
|
-
endpoint="get_joint",
|
|
39
|
-
payload=GetJoint(path=path),
|
|
40
|
-
response_type=GetJointResponse,
|
|
41
|
-
).path
|
|
35
|
+
self._session.query_sim_rpc(endpoint="joint/get", payload={"path": path})
|
|
36
|
+
self._path = path
|
|
42
37
|
|
|
43
38
|
@classmethod
|
|
44
|
-
def add(
|
|
45
|
-
cls,
|
|
46
|
-
path: str,
|
|
47
|
-
config: JointConfig,
|
|
48
|
-
) -> "Joint":
|
|
39
|
+
def add(cls, path: str, config: JointConfig) -> "Joint":
|
|
49
40
|
"""
|
|
50
41
|
Add a joint to the scene.
|
|
51
42
|
|
|
@@ -54,11 +45,5 @@ class Joint(SessionContainer):
|
|
|
54
45
|
:return: The joint instance.
|
|
55
46
|
"""
|
|
56
47
|
|
|
57
|
-
Session.get_current().query_sim_rpc(
|
|
58
|
-
endpoint="add_joint",
|
|
59
|
-
payload=AddJoint(
|
|
60
|
-
path=path,
|
|
61
|
-
config=config,
|
|
62
|
-
),
|
|
63
|
-
)
|
|
48
|
+
Session.get_current().query_sim_rpc(endpoint="joint/add", payload={"path": path, "config": config})
|
|
64
49
|
return cls(path)
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
2
|
from common.message import Pose, Vector3
|
|
3
|
-
from common.session.
|
|
4
|
-
from common.session.views.light import (
|
|
5
|
-
AddLight,
|
|
6
|
-
DisableLight,
|
|
7
|
-
EnableLight,
|
|
8
|
-
GetLight,
|
|
9
|
-
GetLightResponse,
|
|
10
|
-
LightConfig,
|
|
11
|
-
SetLightColor,
|
|
12
|
-
SetLightIntensity,
|
|
13
|
-
)
|
|
3
|
+
from common.session.config import LightConfig
|
|
14
4
|
|
|
15
5
|
|
|
16
6
|
class Light(SessionContainer):
|
|
@@ -43,22 +33,11 @@ class Light(SessionContainer):
|
|
|
43
33
|
"""
|
|
44
34
|
|
|
45
35
|
super().__init__()
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
self._path = self._session.query_sim_rpc(
|
|
49
|
-
endpoint="get_light",
|
|
50
|
-
payload=GetLight(path=path),
|
|
51
|
-
response_type=GetLightResponse,
|
|
52
|
-
).path
|
|
36
|
+
self._session.query_sim_rpc(endpoint="light/get", payload={"path": path})
|
|
37
|
+
self._path = path
|
|
53
38
|
|
|
54
39
|
@classmethod
|
|
55
|
-
def add(
|
|
56
|
-
cls,
|
|
57
|
-
path: str,
|
|
58
|
-
config: LightConfig,
|
|
59
|
-
world_pose: Pose | None,
|
|
60
|
-
local_pose: Pose | None,
|
|
61
|
-
) -> "Light":
|
|
40
|
+
def add(cls, path: str, config: LightConfig, world_pose: Pose | None, local_pose: Pose | None) -> "Light":
|
|
62
41
|
"""
|
|
63
42
|
Add a light to the scene.
|
|
64
43
|
|
|
@@ -70,13 +49,8 @@ class Light(SessionContainer):
|
|
|
70
49
|
"""
|
|
71
50
|
|
|
72
51
|
Session.get_current().query_sim_rpc(
|
|
73
|
-
endpoint="
|
|
74
|
-
payload=
|
|
75
|
-
path=path,
|
|
76
|
-
config=config,
|
|
77
|
-
world_pose=world_pose,
|
|
78
|
-
local_pose=local_pose,
|
|
79
|
-
),
|
|
52
|
+
endpoint="light/add",
|
|
53
|
+
payload={"path": path, "config": config, "world_pose": world_pose, "local_pose": local_pose},
|
|
80
54
|
)
|
|
81
55
|
return cls(path)
|
|
82
56
|
|
|
@@ -87,11 +61,7 @@ class Light(SessionContainer):
|
|
|
87
61
|
:return: World pose.
|
|
88
62
|
"""
|
|
89
63
|
|
|
90
|
-
return self._session.query_sim_rpc(
|
|
91
|
-
endpoint="get_light_world_pose",
|
|
92
|
-
payload=GetWorldPose(path=self._path),
|
|
93
|
-
response_type=Pose,
|
|
94
|
-
)
|
|
64
|
+
return self._session.query_sim_rpc(endpoint="light/get_world_pose", payload={"path": self._path}, response_type=Pose)
|
|
95
65
|
|
|
96
66
|
def get_local_pose(self) -> Pose:
|
|
97
67
|
"""
|
|
@@ -100,11 +70,7 @@ class Light(SessionContainer):
|
|
|
100
70
|
:return: Local pose.
|
|
101
71
|
"""
|
|
102
72
|
|
|
103
|
-
return self._session.query_sim_rpc(
|
|
104
|
-
endpoint="get_light_local_pose",
|
|
105
|
-
payload=GetLocalPose(path=self._path),
|
|
106
|
-
response_type=Pose,
|
|
107
|
-
)
|
|
73
|
+
return self._session.query_sim_rpc(endpoint="light/get_local_pose", payload={"path": self._path}, response_type=Pose)
|
|
108
74
|
|
|
109
75
|
def set_world_pose(self, pose: Pose | dict) -> None:
|
|
110
76
|
"""
|
|
@@ -113,10 +79,7 @@ class Light(SessionContainer):
|
|
|
113
79
|
:param pose: World pose as Pose (or dict with position/orientation lists).
|
|
114
80
|
"""
|
|
115
81
|
|
|
116
|
-
self._session.query_sim_rpc(
|
|
117
|
-
endpoint="set_light_world_pose",
|
|
118
|
-
payload=SetWorldPose(path=self._path, pose=Pose.from_any(pose)),
|
|
119
|
-
)
|
|
82
|
+
self._session.query_sim_rpc(endpoint="light/set_world_pose", payload={"path": self._path, "pose": pose})
|
|
120
83
|
|
|
121
84
|
def set_local_pose(self, pose: Pose | dict) -> None:
|
|
122
85
|
"""
|
|
@@ -125,10 +88,7 @@ class Light(SessionContainer):
|
|
|
125
88
|
:param pose: Local pose as Pose (or dict with position/orientation lists).
|
|
126
89
|
"""
|
|
127
90
|
|
|
128
|
-
self._session.query_sim_rpc(
|
|
129
|
-
endpoint="set_light_local_pose",
|
|
130
|
-
payload=SetLocalPose(path=self._path, pose=Pose.from_any(pose)),
|
|
131
|
-
)
|
|
91
|
+
self._session.query_sim_rpc(endpoint="light/set_local_pose", payload={"path": self._path, "pose": pose})
|
|
132
92
|
|
|
133
93
|
def set_intensity(self, intensity: float) -> None:
|
|
134
94
|
"""
|
|
@@ -137,10 +97,7 @@ class Light(SessionContainer):
|
|
|
137
97
|
:param intensity: Light intensity value.
|
|
138
98
|
"""
|
|
139
99
|
|
|
140
|
-
self._session.query_sim_rpc(
|
|
141
|
-
endpoint="set_light_intensity",
|
|
142
|
-
payload=SetLightIntensity(path=self._path, intensity=intensity),
|
|
143
|
-
)
|
|
100
|
+
self._session.query_sim_rpc(endpoint="light/set_intensity", payload={"path": self._path, "intensity": intensity})
|
|
144
101
|
|
|
145
102
|
def set_color(self, color: Vector3 | list[float] | tuple[float, float, float]) -> None:
|
|
146
103
|
"""
|
|
@@ -149,27 +106,18 @@ class Light(SessionContainer):
|
|
|
149
106
|
:param color: RGB color as Vector3 (or list/tuple of 3 floats) with values 0-1.
|
|
150
107
|
"""
|
|
151
108
|
|
|
152
|
-
self._session.query_sim_rpc(
|
|
153
|
-
endpoint="set_light_color",
|
|
154
|
-
payload=SetLightColor(path=self._path, color=Vector3.from_any(color)),
|
|
155
|
-
)
|
|
109
|
+
self._session.query_sim_rpc(endpoint="light/set_color", payload={"path": self._path, "color": color})
|
|
156
110
|
|
|
157
111
|
def enable(self) -> None:
|
|
158
112
|
"""
|
|
159
113
|
Enable the light (make it illuminate the scene).
|
|
160
114
|
"""
|
|
161
115
|
|
|
162
|
-
self._session.query_sim_rpc(
|
|
163
|
-
endpoint="enable_light",
|
|
164
|
-
payload=EnableLight(path=self._path),
|
|
165
|
-
)
|
|
116
|
+
self._session.query_sim_rpc(endpoint="light/enable", payload={"path": self._path})
|
|
166
117
|
|
|
167
118
|
def disable(self) -> None:
|
|
168
119
|
"""
|
|
169
120
|
Disable the light (turn it off).
|
|
170
121
|
"""
|
|
171
122
|
|
|
172
|
-
self._session.query_sim_rpc(
|
|
173
|
-
endpoint="disable_light",
|
|
174
|
-
payload=DisableLight(path=self._path),
|
|
175
|
-
)
|
|
123
|
+
self._session.query_sim_rpc(endpoint="light/disable", payload={"path": self._path})
|