antioch-py 2.0.6__py3-none-any.whl → 2.1.0__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 +18 -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/{views → objects}/radar.py +18 -29
- antioch/session/{views → objects}/rigid_body.py +25 -110
- antioch/session/{views → objects}/xform.py +24 -24
- antioch/session/scene.py +152 -162
- antioch/session/session.py +34 -43
- antioch/session/task.py +2 -16
- {antioch_py-2.0.6.dist-info → antioch_py-2.1.0.dist-info}/METADATA +1 -1
- {antioch_py-2.0.6.dist-info → antioch_py-2.1.0.dist-info}/RECORD +34 -48
- common/ark/hardware.py +13 -37
- common/ark/kinematics.py +1 -1
- common/core/agent.py +28 -0
- common/message/__init__.py +2 -0
- common/message/pir.py +7 -5
- 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 -40
- antioch/session/views/collision.py +0 -75
- 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/pir_sensor.py +0 -115
- common/session/views/radar.py +0 -82
- 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.6.dist-info → antioch_py-2.1.0.dist-info}/WHEEL +0 -0
- {antioch_py-2.0.6.dist-info → antioch_py-2.1.0.dist-info}/entry_points.txt +0 -0
- {antioch_py-2.0.6.dist-info → antioch_py-2.1.0.dist-info}/top_level.txt +0 -0
|
@@ -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})
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
from antioch.session.session import Session, SessionContainer
|
|
2
2
|
from common.message import PirStatus, Pose
|
|
3
|
-
from common.session.
|
|
4
|
-
AddPirSensor,
|
|
5
|
-
GetPirDetectionStatus,
|
|
6
|
-
GetPirSensor,
|
|
7
|
-
GetPirSensorResponse,
|
|
8
|
-
PirSensorConfig,
|
|
9
|
-
SetPirDebugMode,
|
|
10
|
-
SetPirMaterial,
|
|
11
|
-
)
|
|
3
|
+
from common.session.config import PirSensorConfig
|
|
12
4
|
|
|
13
5
|
|
|
14
6
|
class PirSensor(SessionContainer):
|
|
15
7
|
"""
|
|
16
|
-
PIR (Passive Infrared) sensor
|
|
8
|
+
PIR (Passive Infrared) sensor object for motion detection.
|
|
17
9
|
|
|
18
10
|
PIR sensors detect infrared radiation changes caused by moving warm objects.
|
|
19
|
-
The sensor uses a
|
|
11
|
+
The sensor uses a 3-sensor design (center, left, right) with dual elements per sensor.
|
|
20
12
|
|
|
21
13
|
Example:
|
|
22
14
|
scene = Scene()
|
|
@@ -27,35 +19,21 @@ class PirSensor(SessionContainer):
|
|
|
27
19
|
print(f"Detected: {status.is_detected}")
|
|
28
20
|
"""
|
|
29
21
|
|
|
30
|
-
def __init__(
|
|
31
|
-
self,
|
|
32
|
-
path: str,
|
|
33
|
-
config: PirSensorConfig | None = None,
|
|
34
|
-
):
|
|
22
|
+
def __init__(self, path: str, config: PirSensorConfig | None = None):
|
|
35
23
|
"""
|
|
36
|
-
Initialize PIR sensor
|
|
24
|
+
Initialize PIR sensor object.
|
|
37
25
|
|
|
38
26
|
:param path: USD path for the PIR sensor.
|
|
39
27
|
:param config: Optional PIR sensor config.
|
|
40
28
|
"""
|
|
41
29
|
|
|
42
30
|
super().__init__()
|
|
43
|
-
|
|
44
31
|
self._config = config
|
|
45
|
-
self.
|
|
46
|
-
|
|
47
|
-
payload=GetPirSensor(path=path),
|
|
48
|
-
response_type=GetPirSensorResponse,
|
|
49
|
-
).path
|
|
32
|
+
self._session.query_sim_rpc(endpoint="pir_sensor/get", payload={"path": path})
|
|
33
|
+
self._path = path
|
|
50
34
|
|
|
51
35
|
@classmethod
|
|
52
|
-
def add(
|
|
53
|
-
cls,
|
|
54
|
-
path: str,
|
|
55
|
-
config: PirSensorConfig,
|
|
56
|
-
world_pose: Pose | None,
|
|
57
|
-
local_pose: Pose | None,
|
|
58
|
-
) -> "PirSensor":
|
|
36
|
+
def add(cls, path: str, config: PirSensorConfig, world_pose: Pose | None, local_pose: Pose | None) -> "PirSensor":
|
|
59
37
|
"""
|
|
60
38
|
Add PIR sensor to the scene.
|
|
61
39
|
|
|
@@ -67,13 +45,8 @@ class PirSensor(SessionContainer):
|
|
|
67
45
|
"""
|
|
68
46
|
|
|
69
47
|
Session.get_current().query_sim_rpc(
|
|
70
|
-
endpoint="
|
|
71
|
-
payload=
|
|
72
|
-
path=path,
|
|
73
|
-
config=config,
|
|
74
|
-
world_pose=world_pose,
|
|
75
|
-
local_pose=local_pose,
|
|
76
|
-
),
|
|
48
|
+
endpoint="pir_sensor/add",
|
|
49
|
+
payload={"path": path, "config": config, "world_pose": world_pose, "local_pose": local_pose},
|
|
77
50
|
)
|
|
78
51
|
return cls(path, config)
|
|
79
52
|
|
|
@@ -81,39 +54,28 @@ class PirSensor(SessionContainer):
|
|
|
81
54
|
"""
|
|
82
55
|
Get current detection status.
|
|
83
56
|
|
|
84
|
-
:return: Detection status with is_detected, signal_strength,
|
|
57
|
+
:return: Detection status with is_detected, signal_strength, and per-sensor details.
|
|
85
58
|
"""
|
|
86
59
|
|
|
87
|
-
|
|
88
|
-
endpoint="get_pir_detection_status",
|
|
89
|
-
payload=GetPirDetectionStatus(path=self._path),
|
|
90
|
-
response_type=PirStatus,
|
|
91
|
-
)
|
|
92
|
-
return status
|
|
60
|
+
return PirStatus(**self._session.query_sim_rpc(endpoint="pir_sensor/get_status", payload={"path": self._path}))
|
|
93
61
|
|
|
94
62
|
def set_debug_mode(self, enabled: bool) -> None:
|
|
95
63
|
"""
|
|
96
64
|
Enable or disable debug ray visualization.
|
|
97
65
|
|
|
98
66
|
When enabled, rays are drawn each update:
|
|
99
|
-
-
|
|
100
|
-
- Blue
|
|
101
|
-
-
|
|
67
|
+
- Green: Center sensor
|
|
68
|
+
- Blue: Left sensor
|
|
69
|
+
- Red: Right sensor
|
|
70
|
+
- Cyan points at hit locations
|
|
102
71
|
|
|
103
72
|
:param enabled: Whether to enable debug visualization.
|
|
104
73
|
"""
|
|
105
74
|
|
|
106
|
-
self._session.query_sim_rpc(
|
|
107
|
-
endpoint="set_pir_debug_mode",
|
|
108
|
-
payload=SetPirDebugMode(path=self._path, enabled=enabled),
|
|
109
|
-
)
|
|
75
|
+
self._session.query_sim_rpc(endpoint="pir_sensor/set_debug_mode", payload={"path": self._path, "enabled": enabled})
|
|
110
76
|
|
|
111
77
|
|
|
112
|
-
def set_pir_material(
|
|
113
|
-
path: str,
|
|
114
|
-
emissivity: float = 0.9,
|
|
115
|
-
temperature_c: float | None = None,
|
|
116
|
-
) -> None:
|
|
78
|
+
def set_pir_material(path: str, emissivity: float = 0.9, temperature_c: float | None = None) -> None:
|
|
117
79
|
"""
|
|
118
80
|
Set PIR-specific thermal properties on a prim.
|
|
119
81
|
|
|
@@ -131,10 +93,6 @@ def set_pir_material(
|
|
|
131
93
|
"""
|
|
132
94
|
|
|
133
95
|
Session.get_current().query_sim_rpc(
|
|
134
|
-
endpoint="
|
|
135
|
-
payload=
|
|
136
|
-
path=path,
|
|
137
|
-
emissivity=emissivity,
|
|
138
|
-
temperature_c=temperature_c,
|
|
139
|
-
),
|
|
96
|
+
endpoint="pir_material/set",
|
|
97
|
+
payload={"path": path, "emissivity": emissivity, "temperature_c": temperature_c},
|
|
140
98
|
)
|