antioch-py 2.0.6__py3-none-any.whl → 3.0.12__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/__init__.py +101 -0
- antioch/{module/execution.py → execution.py} +1 -1
- antioch/{module/input.py → input.py} +2 -4
- antioch/{module/module.py → module.py} +17 -34
- antioch/{module/node.py → node.py} +17 -16
- {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/METADATA +8 -11
- antioch_py-3.0.12.dist-info/RECORD +61 -0
- {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/WHEEL +1 -1
- antioch_py-3.0.12.dist-info/licenses/LICENSE +21 -0
- common/ark/__init__.py +6 -16
- common/ark/ark.py +23 -60
- common/ark/hardware.py +13 -37
- common/ark/kinematics.py +1 -1
- common/ark/module.py +22 -0
- common/ark/node.py +46 -3
- common/ark/scheduler.py +2 -29
- common/ark/sim.py +1 -1
- {antioch/module → common/ark}/token.py +17 -0
- common/assets/rigging.usd +0 -0
- common/constants.py +83 -4
- common/core/__init__.py +37 -24
- common/core/auth.py +87 -114
- common/core/container.py +261 -0
- common/core/registry.py +131 -152
- common/core/rome.py +251 -0
- common/core/telemetry.py +176 -0
- common/core/types.py +219 -0
- common/message/__init__.py +19 -3
- common/message/annotation.py +174 -23
- common/message/array.py +25 -1
- common/message/camera.py +23 -1
- common/message/color.py +32 -6
- common/message/detection.py +40 -0
- common/message/foxglove.py +20 -0
- common/message/frame.py +71 -7
- common/message/image.py +58 -9
- common/message/imu.py +24 -4
- common/message/joint.py +69 -10
- common/message/log.py +52 -7
- common/message/pir.py +22 -5
- common/message/plot.py +57 -0
- common/message/point.py +55 -6
- common/message/point_cloud.py +55 -19
- common/message/pose.py +59 -19
- common/message/quaternion.py +105 -92
- common/message/radar.py +195 -29
- common/message/twist.py +34 -0
- common/message/types.py +40 -5
- common/message/vector.py +180 -245
- common/sim/__init__.py +49 -0
- common/sim/objects.py +460 -0
- common/sim/state.py +11 -0
- common/utils/comms.py +30 -12
- common/utils/logger.py +26 -7
- antioch/message.py +0 -87
- antioch/module/__init__.py +0 -53
- antioch/session/__init__.py +0 -150
- antioch/session/ark.py +0 -504
- antioch/session/asset.py +0 -65
- antioch/session/error.py +0 -80
- antioch/session/record.py +0 -158
- antioch/session/scene.py +0 -1521
- antioch/session/session.py +0 -220
- antioch/session/task.py +0 -323
- antioch/session/views/__init__.py +0 -40
- antioch/session/views/animation.py +0 -189
- antioch/session/views/articulation.py +0 -245
- antioch/session/views/basis_curve.py +0 -186
- antioch/session/views/camera.py +0 -92
- antioch/session/views/collision.py +0 -75
- antioch/session/views/geometry.py +0 -74
- antioch/session/views/ground_plane.py +0 -63
- antioch/session/views/imu.py +0 -73
- antioch/session/views/joint.py +0 -64
- antioch/session/views/light.py +0 -175
- antioch/session/views/pir_sensor.py +0 -140
- antioch/session/views/radar.py +0 -73
- antioch/session/views/rigid_body.py +0 -282
- antioch/session/views/xform.py +0 -119
- antioch_py-2.0.6.dist-info/RECORD +0 -99
- antioch_py-2.0.6.dist-info/entry_points.txt +0 -2
- common/core/agent.py +0 -296
- common/core/task.py +0 -36
- common/rome/__init__.py +0 -9
- common/rome/client.py +0 -430
- common/rome/error.py +0 -16
- common/session/__init__.py +0 -54
- common/session/environment.py +0 -31
- common/session/sim.py +0 -240
- 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
- common/utils/usd.py +0 -12
- /antioch/{module/clock.py → clock.py} +0 -0
- {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/top_level.txt +0 -0
- /common/message/{base.py → message.py} +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session
|
|
2
|
-
from common.session.views.collision import (
|
|
3
|
-
GetMeshApproximation,
|
|
4
|
-
GetMeshApproximationResponse,
|
|
5
|
-
HasCollision,
|
|
6
|
-
HasCollisionResponse,
|
|
7
|
-
RemoveCollision,
|
|
8
|
-
SetCollision,
|
|
9
|
-
)
|
|
10
|
-
from common.session.views.geometry import MeshApproximation
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def set_collision(path: str, mesh_approximation: MeshApproximation | None = None) -> None:
|
|
14
|
-
"""
|
|
15
|
-
Apply collision API to a prim, optionally with mesh approximation.
|
|
16
|
-
|
|
17
|
-
:param path: USD path to the prim.
|
|
18
|
-
:param mesh_approximation: Optional mesh approximation method for collision geometry.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
Session.get_current().query_sim_rpc(
|
|
22
|
-
endpoint="set_collision",
|
|
23
|
-
payload=SetCollision(path=path, mesh_approximation=mesh_approximation),
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def remove_collision(path: str) -> None:
|
|
28
|
-
"""
|
|
29
|
-
Remove collision API from a prim.
|
|
30
|
-
|
|
31
|
-
:param path: USD path to the prim.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
Session.get_current().query_sim_rpc(
|
|
35
|
-
endpoint="remove_collision",
|
|
36
|
-
payload=RemoveCollision(path=path),
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def has_collision(path: str) -> bool:
|
|
41
|
-
"""
|
|
42
|
-
Check if a prim has collision API applied.
|
|
43
|
-
|
|
44
|
-
:param path: USD path to the prim.
|
|
45
|
-
:return: True if collision API is applied.
|
|
46
|
-
"""
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
Session.get_current()
|
|
50
|
-
.query_sim_rpc(
|
|
51
|
-
endpoint="has_collision",
|
|
52
|
-
payload=HasCollision(path=path),
|
|
53
|
-
response_type=HasCollisionResponse,
|
|
54
|
-
)
|
|
55
|
-
.has_collision
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def get_mesh_approximation(path: str) -> MeshApproximation | None:
|
|
60
|
-
"""
|
|
61
|
-
Get mesh collision approximation from a prim.
|
|
62
|
-
|
|
63
|
-
:param path: USD path to the prim.
|
|
64
|
-
:return: Mesh approximation method, or None if not set.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
Session.get_current()
|
|
69
|
-
.query_sim_rpc(
|
|
70
|
-
endpoint="get_mesh_approximation_rpc",
|
|
71
|
-
payload=GetMeshApproximation(path=path),
|
|
72
|
-
response_type=GetMeshApproximationResponse,
|
|
73
|
-
)
|
|
74
|
-
.approximation
|
|
75
|
-
)
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.message import Pose
|
|
3
|
-
from common.session.views.geometry import AddGeometry, GeometryConfig, GetGeometry, GetGeometryResponse
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Geometry(SessionContainer):
|
|
7
|
-
"""
|
|
8
|
-
Ergonomic wrapper for geometry operations.
|
|
9
|
-
|
|
10
|
-
Geometry provides basic shapes (sphere, cube, cylinder, cone, capsule) with
|
|
11
|
-
collision, material, and visual properties. Geometries should be added using
|
|
12
|
-
scene.add_geometry() or retrieved using scene.get_geometry().
|
|
13
|
-
|
|
14
|
-
Example:
|
|
15
|
-
scene = Scene()
|
|
16
|
-
|
|
17
|
-
# Add geometry with flexible types (lists/tuples auto-convert)
|
|
18
|
-
geom = scene.add_geometry(
|
|
19
|
-
path="/World/cube",
|
|
20
|
-
geometry_type=GeometryType.CUBE,
|
|
21
|
-
size=[1.0, 1.0, 1.0],
|
|
22
|
-
color=(1.0, 0.0, 0.0),
|
|
23
|
-
world_pose={"position": [0, 0, 1], "orientation": [1, 0, 0, 0]}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
# For dynamic pose control, use XForm
|
|
27
|
-
xform = scene.get_xform(path="/World/cube")
|
|
28
|
-
pose = xform.get_world_pose()
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
def __init__(self, path: str):
|
|
32
|
-
"""
|
|
33
|
-
Initialize geometry by resolving path and validating existence.
|
|
34
|
-
|
|
35
|
-
:param path: USD path for the geometry.
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
super().__init__()
|
|
39
|
-
|
|
40
|
-
# Validate path
|
|
41
|
-
self._path = self._session.query_sim_rpc(
|
|
42
|
-
endpoint="get_geometry",
|
|
43
|
-
payload=GetGeometry(path=path),
|
|
44
|
-
response_type=GetGeometryResponse,
|
|
45
|
-
).path
|
|
46
|
-
|
|
47
|
-
@classmethod
|
|
48
|
-
def add(
|
|
49
|
-
cls,
|
|
50
|
-
path: str,
|
|
51
|
-
config: GeometryConfig,
|
|
52
|
-
world_pose: Pose | None,
|
|
53
|
-
local_pose: Pose | None,
|
|
54
|
-
) -> "Geometry":
|
|
55
|
-
"""
|
|
56
|
-
Add geometry to the scene.
|
|
57
|
-
|
|
58
|
-
:param path: USD path for the geometry.
|
|
59
|
-
:param config: Geometry configuration.
|
|
60
|
-
:param world_pose: Optional world pose.
|
|
61
|
-
:param local_pose: Optional local pose.
|
|
62
|
-
:return: The geometry instance.
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
Session.get_current().query_sim_rpc(
|
|
66
|
-
endpoint="add_geometry",
|
|
67
|
-
payload=AddGeometry(
|
|
68
|
-
path=path,
|
|
69
|
-
config=config,
|
|
70
|
-
world_pose=world_pose,
|
|
71
|
-
local_pose=local_pose,
|
|
72
|
-
),
|
|
73
|
-
)
|
|
74
|
-
return cls(path)
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.session.views.ground_plane import AddGroundPlane, GetGroundPlane, GetGroundPlaneResponse, GroundPlaneConfig
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class GroundPlane(SessionContainer):
|
|
6
|
-
"""
|
|
7
|
-
Ergonomic wrapper for ground plane operations.
|
|
8
|
-
|
|
9
|
-
Ground planes should be added using scene.add_ground_plane() or retrieved using scene.get_ground_plane().
|
|
10
|
-
|
|
11
|
-
Note: Ground planes do not support pose modification after creation.
|
|
12
|
-
Set the z_position during creation.
|
|
13
|
-
|
|
14
|
-
Example:
|
|
15
|
-
scene = Scene()
|
|
16
|
-
|
|
17
|
-
# Add ground plane
|
|
18
|
-
ground = scene.add_ground_plane(
|
|
19
|
-
path="/World/Ground",
|
|
20
|
-
size=5000.0,
|
|
21
|
-
z_position=0.0,
|
|
22
|
-
color=[0.5, 0.5, 0.5]
|
|
23
|
-
)
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
def __init__(self, path: str):
|
|
27
|
-
"""
|
|
28
|
-
Initialize ground plane by resolving path and validating existence.
|
|
29
|
-
|
|
30
|
-
:param path: USD path for the ground plane.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
super().__init__()
|
|
34
|
-
|
|
35
|
-
# Validate path
|
|
36
|
-
self._path = self._session.query_sim_rpc(
|
|
37
|
-
endpoint="get_ground_plane",
|
|
38
|
-
payload=GetGroundPlane(path=path),
|
|
39
|
-
response_type=GetGroundPlaneResponse,
|
|
40
|
-
).path
|
|
41
|
-
|
|
42
|
-
@classmethod
|
|
43
|
-
def add(
|
|
44
|
-
cls,
|
|
45
|
-
path: str,
|
|
46
|
-
config: GroundPlaneConfig,
|
|
47
|
-
) -> "GroundPlane":
|
|
48
|
-
"""
|
|
49
|
-
Add a ground plane to the scene.
|
|
50
|
-
|
|
51
|
-
:param path: USD path for the ground plane.
|
|
52
|
-
:param config: Ground plane configuration.
|
|
53
|
-
:return: The ground plane instance.
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
Session.get_current().query_sim_rpc(
|
|
57
|
-
endpoint="add_ground_plane",
|
|
58
|
-
payload=AddGroundPlane(
|
|
59
|
-
path=path,
|
|
60
|
-
config=config,
|
|
61
|
-
),
|
|
62
|
-
)
|
|
63
|
-
return cls(path)
|
antioch/session/views/imu.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.message import ImuSample, Pose
|
|
3
|
-
from common.session.views.imu import AddImu, GetImu, GetImuResponse, GetImuSample, ImuConfig
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Imu(SessionContainer):
|
|
7
|
-
"""
|
|
8
|
-
IMU view for time-synchronized sensor data.
|
|
9
|
-
|
|
10
|
-
Example:
|
|
11
|
-
scene = Scene()
|
|
12
|
-
imu = scene.get_imu(name="my_ark/my_module/my_imu")
|
|
13
|
-
sample = imu.get_sample()
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def __init__(self, path: str):
|
|
17
|
-
"""
|
|
18
|
-
Initialize IMU view.
|
|
19
|
-
|
|
20
|
-
:param path: USD path for the IMU.
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
super().__init__()
|
|
24
|
-
|
|
25
|
-
self._path = self._session.query_sim_rpc(
|
|
26
|
-
endpoint="get_imu",
|
|
27
|
-
payload=GetImu(path=path),
|
|
28
|
-
response_type=GetImuResponse,
|
|
29
|
-
).path
|
|
30
|
-
|
|
31
|
-
@classmethod
|
|
32
|
-
def add(
|
|
33
|
-
cls,
|
|
34
|
-
path: str,
|
|
35
|
-
config: ImuConfig,
|
|
36
|
-
world_pose: Pose | None,
|
|
37
|
-
local_pose: Pose | None,
|
|
38
|
-
) -> "Imu":
|
|
39
|
-
"""
|
|
40
|
-
Add IMU to the scene.
|
|
41
|
-
|
|
42
|
-
:param path: USD path for the IMU.
|
|
43
|
-
:param config: IMU configuration.
|
|
44
|
-
:param world_pose: Optional world pose.
|
|
45
|
-
:param local_pose: Optional local pose.
|
|
46
|
-
:return: The IMU instance.
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
Session.get_current().query_sim_rpc(
|
|
50
|
-
endpoint="add_imu",
|
|
51
|
-
payload=AddImu(
|
|
52
|
-
path=path,
|
|
53
|
-
config=config,
|
|
54
|
-
world_pose=world_pose,
|
|
55
|
-
local_pose=local_pose,
|
|
56
|
-
),
|
|
57
|
-
)
|
|
58
|
-
return cls(path)
|
|
59
|
-
|
|
60
|
-
def get_sample(self) -> ImuSample | None:
|
|
61
|
-
"""
|
|
62
|
-
Get IMU sensor sample.
|
|
63
|
-
|
|
64
|
-
:return: IMU sensor measurements, or None if sensor data is not ready.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
sample = self._session.query_sim_rpc(
|
|
68
|
-
endpoint="get_imu_sample",
|
|
69
|
-
payload=GetImuSample(path=self._path),
|
|
70
|
-
response_type=ImuSample,
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return sample
|
antioch/session/views/joint.py
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.session.views.joint import AddJoint, GetJoint, GetJointResponse, JointConfig
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class Joint(SessionContainer):
|
|
6
|
-
"""
|
|
7
|
-
Ergonomic wrapper for joint operations.
|
|
8
|
-
|
|
9
|
-
Joints connect two bodies and define kinematic constraints between them.
|
|
10
|
-
Joints should be added using scene.add_joint() or retrieved using scene.get_joint().
|
|
11
|
-
|
|
12
|
-
Example:
|
|
13
|
-
scene = Scene()
|
|
14
|
-
|
|
15
|
-
# Add a revolute joint between two bodies
|
|
16
|
-
joint = scene.add_joint(
|
|
17
|
-
path="/World/robot/joint1",
|
|
18
|
-
parent_path="/World/robot/link1",
|
|
19
|
-
child_path="/World/robot/link2",
|
|
20
|
-
joint_type=JointType.REVOLUTE,
|
|
21
|
-
axis=JointAxis.Z,
|
|
22
|
-
lower_limit=-180.0,
|
|
23
|
-
upper_limit=180.0,
|
|
24
|
-
)
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
def __init__(self, path: str):
|
|
28
|
-
"""
|
|
29
|
-
Initialize joint by resolving path and validating existence.
|
|
30
|
-
|
|
31
|
-
:param path: USD path for the joint.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
super().__init__()
|
|
35
|
-
|
|
36
|
-
# Validate path
|
|
37
|
-
self._path = self._session.query_sim_rpc(
|
|
38
|
-
endpoint="get_joint",
|
|
39
|
-
payload=GetJoint(path=path),
|
|
40
|
-
response_type=GetJointResponse,
|
|
41
|
-
).path
|
|
42
|
-
|
|
43
|
-
@classmethod
|
|
44
|
-
def add(
|
|
45
|
-
cls,
|
|
46
|
-
path: str,
|
|
47
|
-
config: JointConfig,
|
|
48
|
-
) -> "Joint":
|
|
49
|
-
"""
|
|
50
|
-
Add a joint to the scene.
|
|
51
|
-
|
|
52
|
-
:param path: USD path for the joint.
|
|
53
|
-
:param config: Joint configuration.
|
|
54
|
-
:return: The joint instance.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
Session.get_current().query_sim_rpc(
|
|
58
|
-
endpoint="add_joint",
|
|
59
|
-
payload=AddJoint(
|
|
60
|
-
path=path,
|
|
61
|
-
config=config,
|
|
62
|
-
),
|
|
63
|
-
)
|
|
64
|
-
return cls(path)
|
antioch/session/views/light.py
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.message import Pose, Vector3
|
|
3
|
-
from common.session.sim import GetLocalPose, GetWorldPose, SetLocalPose, SetWorldPose
|
|
4
|
-
from common.session.views.light import (
|
|
5
|
-
AddLight,
|
|
6
|
-
DisableLight,
|
|
7
|
-
EnableLight,
|
|
8
|
-
GetLight,
|
|
9
|
-
GetLightResponse,
|
|
10
|
-
LightConfig,
|
|
11
|
-
SetLightColor,
|
|
12
|
-
SetLightIntensity,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class Light(SessionContainer):
|
|
17
|
-
"""
|
|
18
|
-
Ergonomic wrapper for light operations.
|
|
19
|
-
|
|
20
|
-
Lights should be added using scene.add_light() or retrieved using scene.get_light().
|
|
21
|
-
|
|
22
|
-
Example:
|
|
23
|
-
scene = Scene()
|
|
24
|
-
|
|
25
|
-
# Add light
|
|
26
|
-
light = scene.add_light(
|
|
27
|
-
path="/World/Sun",
|
|
28
|
-
light_type=LightType.DISTANT,
|
|
29
|
-
intensity=30000.0,
|
|
30
|
-
color=[1.0, 0.9, 0.8]
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
# Set color with a tuple
|
|
34
|
-
light.set_color((0.5, 0.7, 1.0))
|
|
35
|
-
pose = light.get_world_pose()
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
def __init__(self, path: str):
|
|
39
|
-
"""
|
|
40
|
-
Initialize light by resolving path and validating existence.
|
|
41
|
-
|
|
42
|
-
:param path: USD path for the light.
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
super().__init__()
|
|
46
|
-
|
|
47
|
-
# Validate path
|
|
48
|
-
self._path = self._session.query_sim_rpc(
|
|
49
|
-
endpoint="get_light",
|
|
50
|
-
payload=GetLight(path=path),
|
|
51
|
-
response_type=GetLightResponse,
|
|
52
|
-
).path
|
|
53
|
-
|
|
54
|
-
@classmethod
|
|
55
|
-
def add(
|
|
56
|
-
cls,
|
|
57
|
-
path: str,
|
|
58
|
-
config: LightConfig,
|
|
59
|
-
world_pose: Pose | None,
|
|
60
|
-
local_pose: Pose | None,
|
|
61
|
-
) -> "Light":
|
|
62
|
-
"""
|
|
63
|
-
Add a light to the scene.
|
|
64
|
-
|
|
65
|
-
:param path: USD path for the light.
|
|
66
|
-
:param config: Light configuration.
|
|
67
|
-
:param world_pose: Optional world pose.
|
|
68
|
-
:param local_pose: Optional local pose.
|
|
69
|
-
:return: The light instance.
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
Session.get_current().query_sim_rpc(
|
|
73
|
-
endpoint="add_light",
|
|
74
|
-
payload=AddLight(
|
|
75
|
-
path=path,
|
|
76
|
-
config=config,
|
|
77
|
-
world_pose=world_pose,
|
|
78
|
-
local_pose=local_pose,
|
|
79
|
-
),
|
|
80
|
-
)
|
|
81
|
-
return cls(path)
|
|
82
|
-
|
|
83
|
-
def get_world_pose(self) -> Pose:
|
|
84
|
-
"""
|
|
85
|
-
Get the world pose of the light.
|
|
86
|
-
|
|
87
|
-
:return: World pose.
|
|
88
|
-
"""
|
|
89
|
-
|
|
90
|
-
return self._session.query_sim_rpc(
|
|
91
|
-
endpoint="get_light_world_pose",
|
|
92
|
-
payload=GetWorldPose(path=self._path),
|
|
93
|
-
response_type=Pose,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
def get_local_pose(self) -> Pose:
|
|
97
|
-
"""
|
|
98
|
-
Get the local pose of the light.
|
|
99
|
-
|
|
100
|
-
:return: Local pose.
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
return self._session.query_sim_rpc(
|
|
104
|
-
endpoint="get_light_local_pose",
|
|
105
|
-
payload=GetLocalPose(path=self._path),
|
|
106
|
-
response_type=Pose,
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
def set_world_pose(self, pose: Pose | dict) -> None:
|
|
110
|
-
"""
|
|
111
|
-
Set the world pose of the light.
|
|
112
|
-
|
|
113
|
-
:param pose: World pose as Pose (or dict with position/orientation lists).
|
|
114
|
-
"""
|
|
115
|
-
|
|
116
|
-
self._session.query_sim_rpc(
|
|
117
|
-
endpoint="set_light_world_pose",
|
|
118
|
-
payload=SetWorldPose(path=self._path, pose=Pose.from_any(pose)),
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
def set_local_pose(self, pose: Pose | dict) -> None:
|
|
122
|
-
"""
|
|
123
|
-
Set the local pose of the light.
|
|
124
|
-
|
|
125
|
-
:param pose: Local pose as Pose (or dict with position/orientation lists).
|
|
126
|
-
"""
|
|
127
|
-
|
|
128
|
-
self._session.query_sim_rpc(
|
|
129
|
-
endpoint="set_light_local_pose",
|
|
130
|
-
payload=SetLocalPose(path=self._path, pose=Pose.from_any(pose)),
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
def set_intensity(self, intensity: float) -> None:
|
|
134
|
-
"""
|
|
135
|
-
Set the intensity of the light.
|
|
136
|
-
|
|
137
|
-
:param intensity: Light intensity value.
|
|
138
|
-
"""
|
|
139
|
-
|
|
140
|
-
self._session.query_sim_rpc(
|
|
141
|
-
endpoint="set_light_intensity",
|
|
142
|
-
payload=SetLightIntensity(path=self._path, intensity=intensity),
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
def set_color(self, color: Vector3 | list[float] | tuple[float, float, float]) -> None:
|
|
146
|
-
"""
|
|
147
|
-
Set the color of the light.
|
|
148
|
-
|
|
149
|
-
:param color: RGB color as Vector3 (or list/tuple of 3 floats) with values 0-1.
|
|
150
|
-
"""
|
|
151
|
-
|
|
152
|
-
self._session.query_sim_rpc(
|
|
153
|
-
endpoint="set_light_color",
|
|
154
|
-
payload=SetLightColor(path=self._path, color=Vector3.from_any(color)),
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
def enable(self) -> None:
|
|
158
|
-
"""
|
|
159
|
-
Enable the light (make it illuminate the scene).
|
|
160
|
-
"""
|
|
161
|
-
|
|
162
|
-
self._session.query_sim_rpc(
|
|
163
|
-
endpoint="enable_light",
|
|
164
|
-
payload=EnableLight(path=self._path),
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
def disable(self) -> None:
|
|
168
|
-
"""
|
|
169
|
-
Disable the light (turn it off).
|
|
170
|
-
"""
|
|
171
|
-
|
|
172
|
-
self._session.query_sim_rpc(
|
|
173
|
-
endpoint="disable_light",
|
|
174
|
-
payload=DisableLight(path=self._path),
|
|
175
|
-
)
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
from antioch.session.session import Session, SessionContainer
|
|
2
|
-
from common.message import PirStatus, Pose
|
|
3
|
-
from common.session.views.pir_sensor import (
|
|
4
|
-
AddPirSensor,
|
|
5
|
-
GetPirDetectionStatus,
|
|
6
|
-
GetPirSensor,
|
|
7
|
-
GetPirSensorResponse,
|
|
8
|
-
PirSensorConfig,
|
|
9
|
-
SetPirDebugMode,
|
|
10
|
-
SetPirMaterial,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class PirSensor(SessionContainer):
|
|
15
|
-
"""
|
|
16
|
-
PIR (Passive Infrared) sensor view for motion detection.
|
|
17
|
-
|
|
18
|
-
PIR sensors detect infrared radiation changes caused by moving warm objects.
|
|
19
|
-
The sensor uses a dual-element design with interleaved zones for motion detection.
|
|
20
|
-
|
|
21
|
-
Example:
|
|
22
|
-
scene = Scene()
|
|
23
|
-
pir = scene.add_pir_sensor(path="/World/pir_sensor")
|
|
24
|
-
scene.play()
|
|
25
|
-
scene.step(dt_us=100_000)
|
|
26
|
-
status = pir.get_detection_status()
|
|
27
|
-
print(f"Detected: {status.is_detected}")
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
def __init__(
|
|
31
|
-
self,
|
|
32
|
-
path: str,
|
|
33
|
-
config: PirSensorConfig | None = None,
|
|
34
|
-
):
|
|
35
|
-
"""
|
|
36
|
-
Initialize PIR sensor view.
|
|
37
|
-
|
|
38
|
-
:param path: USD path for the PIR sensor.
|
|
39
|
-
:param config: Optional PIR sensor config.
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
super().__init__()
|
|
43
|
-
|
|
44
|
-
self._config = config
|
|
45
|
-
self._path = self._session.query_sim_rpc(
|
|
46
|
-
endpoint="get_pir_sensor",
|
|
47
|
-
payload=GetPirSensor(path=path),
|
|
48
|
-
response_type=GetPirSensorResponse,
|
|
49
|
-
).path
|
|
50
|
-
|
|
51
|
-
@classmethod
|
|
52
|
-
def add(
|
|
53
|
-
cls,
|
|
54
|
-
path: str,
|
|
55
|
-
config: PirSensorConfig,
|
|
56
|
-
world_pose: Pose | None,
|
|
57
|
-
local_pose: Pose | None,
|
|
58
|
-
) -> "PirSensor":
|
|
59
|
-
"""
|
|
60
|
-
Add PIR sensor to the scene.
|
|
61
|
-
|
|
62
|
-
:param path: USD path for the PIR sensor.
|
|
63
|
-
:param config: PIR sensor configuration.
|
|
64
|
-
:param world_pose: Optional world pose.
|
|
65
|
-
:param local_pose: Optional local pose.
|
|
66
|
-
:return: The PIR sensor instance.
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
|
-
Session.get_current().query_sim_rpc(
|
|
70
|
-
endpoint="add_pir_sensor",
|
|
71
|
-
payload=AddPirSensor(
|
|
72
|
-
path=path,
|
|
73
|
-
config=config,
|
|
74
|
-
world_pose=world_pose,
|
|
75
|
-
local_pose=local_pose,
|
|
76
|
-
),
|
|
77
|
-
)
|
|
78
|
-
return cls(path, config)
|
|
79
|
-
|
|
80
|
-
def get_detection_status(self) -> PirStatus:
|
|
81
|
-
"""
|
|
82
|
-
Get current detection status.
|
|
83
|
-
|
|
84
|
-
:return: Detection status with is_detected, signal_strength, threshold, element_flux, and element_signal.
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
status = self._session.query_sim_rpc(
|
|
88
|
-
endpoint="get_pir_detection_status",
|
|
89
|
-
payload=GetPirDetectionStatus(path=self._path),
|
|
90
|
-
response_type=PirStatus,
|
|
91
|
-
)
|
|
92
|
-
return status
|
|
93
|
-
|
|
94
|
-
def set_debug_mode(self, enabled: bool) -> None:
|
|
95
|
-
"""
|
|
96
|
-
Enable or disable debug ray visualization.
|
|
97
|
-
|
|
98
|
-
When enabled, rays are drawn each update:
|
|
99
|
-
- Red rays for element 0
|
|
100
|
-
- Blue rays for element 1
|
|
101
|
-
- Green points at hit locations
|
|
102
|
-
|
|
103
|
-
:param enabled: Whether to enable debug visualization.
|
|
104
|
-
"""
|
|
105
|
-
|
|
106
|
-
self._session.query_sim_rpc(
|
|
107
|
-
endpoint="set_pir_debug_mode",
|
|
108
|
-
payload=SetPirDebugMode(path=self._path, enabled=enabled),
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def set_pir_material(
|
|
113
|
-
path: str,
|
|
114
|
-
emissivity: float = 0.9,
|
|
115
|
-
temperature_c: float | None = None,
|
|
116
|
-
) -> None:
|
|
117
|
-
"""
|
|
118
|
-
Set PIR-specific thermal properties on a prim.
|
|
119
|
-
|
|
120
|
-
These properties define how the prim appears to PIR sensors:
|
|
121
|
-
- emissivity: How well the surface emits infrared radiation (0-1)
|
|
122
|
-
- temperature_c: Surface temperature in Celsius
|
|
123
|
-
|
|
124
|
-
Example:
|
|
125
|
-
# Make a target detectable by PIR sensors
|
|
126
|
-
set_pir_material("/World/person", emissivity=0.98, temperature_c=37.0)
|
|
127
|
-
|
|
128
|
-
:param path: USD path of the prim to configure.
|
|
129
|
-
:param emissivity: Material emissivity (0-1, default 0.9).
|
|
130
|
-
:param temperature_c: Surface temperature in Celsius (optional).
|
|
131
|
-
"""
|
|
132
|
-
|
|
133
|
-
Session.get_current().query_sim_rpc(
|
|
134
|
-
endpoint="set_pir_material",
|
|
135
|
-
payload=SetPirMaterial(
|
|
136
|
-
path=path,
|
|
137
|
-
emissivity=emissivity,
|
|
138
|
-
temperature_c=temperature_c,
|
|
139
|
-
),
|
|
140
|
-
)
|