antioch-py 2.0.6__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.

Files changed (99) hide show
  1. antioch/__init__.py +0 -0
  2. antioch/message.py +87 -0
  3. antioch/module/__init__.py +53 -0
  4. antioch/module/clock.py +62 -0
  5. antioch/module/execution.py +278 -0
  6. antioch/module/input.py +127 -0
  7. antioch/module/module.py +218 -0
  8. antioch/module/node.py +357 -0
  9. antioch/module/token.py +42 -0
  10. antioch/session/__init__.py +150 -0
  11. antioch/session/ark.py +504 -0
  12. antioch/session/asset.py +65 -0
  13. antioch/session/error.py +80 -0
  14. antioch/session/record.py +158 -0
  15. antioch/session/scene.py +1521 -0
  16. antioch/session/session.py +220 -0
  17. antioch/session/task.py +323 -0
  18. antioch/session/views/__init__.py +40 -0
  19. antioch/session/views/animation.py +189 -0
  20. antioch/session/views/articulation.py +245 -0
  21. antioch/session/views/basis_curve.py +186 -0
  22. antioch/session/views/camera.py +92 -0
  23. antioch/session/views/collision.py +75 -0
  24. antioch/session/views/geometry.py +74 -0
  25. antioch/session/views/ground_plane.py +63 -0
  26. antioch/session/views/imu.py +73 -0
  27. antioch/session/views/joint.py +64 -0
  28. antioch/session/views/light.py +175 -0
  29. antioch/session/views/pir_sensor.py +140 -0
  30. antioch/session/views/radar.py +73 -0
  31. antioch/session/views/rigid_body.py +282 -0
  32. antioch/session/views/xform.py +119 -0
  33. antioch_py-2.0.6.dist-info/METADATA +115 -0
  34. antioch_py-2.0.6.dist-info/RECORD +99 -0
  35. antioch_py-2.0.6.dist-info/WHEEL +5 -0
  36. antioch_py-2.0.6.dist-info/entry_points.txt +2 -0
  37. antioch_py-2.0.6.dist-info/top_level.txt +2 -0
  38. common/__init__.py +0 -0
  39. common/ark/__init__.py +60 -0
  40. common/ark/ark.py +128 -0
  41. common/ark/hardware.py +121 -0
  42. common/ark/kinematics.py +31 -0
  43. common/ark/module.py +85 -0
  44. common/ark/node.py +94 -0
  45. common/ark/scheduler.py +439 -0
  46. common/ark/sim.py +33 -0
  47. common/assets/__init__.py +3 -0
  48. common/constants.py +47 -0
  49. common/core/__init__.py +52 -0
  50. common/core/agent.py +296 -0
  51. common/core/auth.py +305 -0
  52. common/core/registry.py +331 -0
  53. common/core/task.py +36 -0
  54. common/message/__init__.py +59 -0
  55. common/message/annotation.py +89 -0
  56. common/message/array.py +500 -0
  57. common/message/base.py +517 -0
  58. common/message/camera.py +91 -0
  59. common/message/color.py +139 -0
  60. common/message/frame.py +50 -0
  61. common/message/image.py +171 -0
  62. common/message/imu.py +14 -0
  63. common/message/joint.py +47 -0
  64. common/message/log.py +31 -0
  65. common/message/pir.py +16 -0
  66. common/message/point.py +109 -0
  67. common/message/point_cloud.py +63 -0
  68. common/message/pose.py +148 -0
  69. common/message/quaternion.py +273 -0
  70. common/message/radar.py +58 -0
  71. common/message/types.py +37 -0
  72. common/message/vector.py +786 -0
  73. common/rome/__init__.py +9 -0
  74. common/rome/client.py +430 -0
  75. common/rome/error.py +16 -0
  76. common/session/__init__.py +54 -0
  77. common/session/environment.py +31 -0
  78. common/session/sim.py +240 -0
  79. common/session/views/__init__.py +263 -0
  80. common/session/views/animation.py +73 -0
  81. common/session/views/articulation.py +184 -0
  82. common/session/views/basis_curve.py +102 -0
  83. common/session/views/camera.py +147 -0
  84. common/session/views/collision.py +59 -0
  85. common/session/views/geometry.py +102 -0
  86. common/session/views/ground_plane.py +41 -0
  87. common/session/views/imu.py +66 -0
  88. common/session/views/joint.py +81 -0
  89. common/session/views/light.py +96 -0
  90. common/session/views/pir_sensor.py +115 -0
  91. common/session/views/radar.py +82 -0
  92. common/session/views/rigid_body.py +236 -0
  93. common/session/views/viewport.py +21 -0
  94. common/session/views/xform.py +39 -0
  95. common/utils/__init__.py +4 -0
  96. common/utils/comms.py +571 -0
  97. common/utils/logger.py +123 -0
  98. common/utils/time.py +42 -0
  99. common/utils/usd.py +12 -0
common/session/sim.py ADDED
@@ -0,0 +1,240 @@
1
+ import time
2
+ from enum import Enum
3
+ from typing import Any
4
+
5
+ from pydantic import Field
6
+
7
+ from common.message import Message, Pose, Vector3
8
+
9
+
10
+ class SimulationState(str, Enum):
11
+ """
12
+ Represents the current state of the simulation.
13
+ """
14
+
15
+ PLAYING = "playing"
16
+ PAUSED = "paused"
17
+ STOPPED = "stopped"
18
+
19
+
20
+ class Step(Message):
21
+ """
22
+ Step the simulation forward by a specified amount of time in microseconds.
23
+ """
24
+
25
+ dt_us: int = 10000 # Default 10ms
26
+
27
+
28
+ class SimulationInfo(Message):
29
+ """
30
+ Full simulation info.
31
+ """
32
+
33
+ state: SimulationState
34
+ sim_time_us: int | None
35
+
36
+
37
+ class SimulationTime(Message):
38
+ """
39
+ Current simulation time in microseconds.
40
+ """
41
+
42
+ time_us: int
43
+
44
+
45
+ class ToggleUi(Message):
46
+ """
47
+ Toggle the UI visibility.
48
+ """
49
+
50
+ show_ui: bool
51
+
52
+
53
+ class GetObject(Message):
54
+ """
55
+ Get information about a specific object.
56
+ """
57
+
58
+ path: str
59
+
60
+
61
+ class ObjectInfo(Message):
62
+ """
63
+ Information about a simulation object.
64
+ """
65
+
66
+ path: str
67
+ type: str
68
+ config: dict[str, Any]
69
+
70
+
71
+ class AllObjectInfo(Message):
72
+ """
73
+ All objects in the scene.
74
+ """
75
+
76
+ objects: list[ObjectInfo]
77
+
78
+
79
+ class GetWorldPose(Message):
80
+ """
81
+ Get the world pose of an object.
82
+ """
83
+
84
+ path: str = Field(description="USD path of the object")
85
+
86
+
87
+ class GetLocalPose(Message):
88
+ """
89
+ Get the local pose of an object.
90
+ """
91
+
92
+ path: str = Field(description="USD path of the object")
93
+
94
+
95
+ class SetWorldPose(Message):
96
+ """
97
+ Set the world pose of an object.
98
+ """
99
+
100
+ path: str = Field(description="USD path of the object")
101
+ pose: Pose
102
+
103
+
104
+ class SetLocalPose(Message):
105
+ """
106
+ Set the local pose of an object.
107
+ """
108
+
109
+ path: str = Field(description="USD path of the object")
110
+ pose: Pose
111
+
112
+
113
+ class RpcError(Message):
114
+ """
115
+ RPC error.
116
+ """
117
+
118
+ message: str
119
+ internal: bool = False
120
+ traceback: str | None = None
121
+
122
+
123
+ class RpcCall(Message):
124
+ """
125
+ RPC call with optional payload.
126
+ """
127
+
128
+ ts: int = Field(default_factory=lambda: int(time.time_ns() // 1000))
129
+ payload: bytes | None = None
130
+
131
+
132
+ class RpcResponse(Message):
133
+ """
134
+ RPC response with optional payload and error.
135
+ """
136
+
137
+ ts: int = Field(default_factory=lambda: int(time.time_ns() // 1000))
138
+ payload: bytes | None = None
139
+ error: RpcError | None = None
140
+
141
+
142
+ class AddAsset(Message):
143
+ """
144
+ Add an asset to the simulation.
145
+ """
146
+
147
+ path: str = Field(description="USD path where asset will be added")
148
+ asset_file_path: str = Field(description="Path to asset file (USD, FBX, OBJ, etc.)")
149
+ asset_prim_path: str | None = Field(default=None, description="Full path to prim in the Usd file to reference")
150
+ remove_articulation: bool = Field(default=True, description="Whether to remove articulation APIs")
151
+ remove_rigid_body: bool = Field(default=False, description="Whether to remove rigid body APIs")
152
+ remove_sensors: bool = Field(default=False, description="Whether to remove sensor and graph prims")
153
+ world_pose: Pose | None = Field(default=None, description="Optional world pose")
154
+ local_pose: Pose | None = Field(default=None, description="Optional local pose")
155
+ scale: Vector3 | None = Field(default=None, description="Optional scale")
156
+
157
+
158
+ class GetPrimAttribute(Message):
159
+ """
160
+ Get an attribute value from a prim.
161
+
162
+ Supports primitive and vector types (float, int, bool, string, Vec2/3/4, Quat).
163
+ """
164
+
165
+ path: str = Field(description="USD path to the prim")
166
+ attribute_name: str = Field(description="Name of the attribute to get")
167
+
168
+
169
+ class SetPrimAttribute(Message):
170
+ """
171
+ Set an attribute value on a prim.
172
+
173
+ Supports primitive and vector types (float, int, bool, string, Vec2/3/4, Quat).
174
+ The attribute must already exist on the prim.
175
+ """
176
+
177
+ path: str = Field(description="USD path to the prim")
178
+ attribute_name: str = Field(description="Name of the attribute to set")
179
+ value: float | int | str | bool | list[float] = Field(description="Value to set (must match attribute type)")
180
+
181
+
182
+ class PrimAttributeValue(Message):
183
+ """
184
+ Response containing an attribute value.
185
+ """
186
+
187
+ value: float | int | str | bool | list[float]
188
+
189
+
190
+ class SceneTarget(str, Enum):
191
+ """
192
+ Enum representing the different types of prims that can be queried in the scene.
193
+ """
194
+
195
+ XFORM = "xform"
196
+ ARTICULATION = "articulation"
197
+ RIGID_BODY = "rigid_body"
198
+ JOINT = "joint"
199
+ LIGHT = "light"
200
+ GROUND_PLANE = "ground_plane"
201
+ GEOMETRY = "geometry"
202
+ CAMERA = "camera"
203
+ RADAR = "radar"
204
+ IMU = "imu"
205
+ ANIMATION = "animation"
206
+
207
+
208
+ class PrimInfo(Message):
209
+ """
210
+ Information about a prim in the scene with its applicable view types.
211
+ """
212
+
213
+ path: str = Field(description="USD path to the prim")
214
+ targets: list[SceneTarget] = Field(description="List of applicable scene targets/view types for this prim")
215
+
216
+
217
+ class QueryScene(Message):
218
+ """
219
+ Query the scene hierarchy for prims matching specific criteria.
220
+ """
221
+
222
+ root_path: str = Field(default="/World", description="Root path to start the query from")
223
+ target: SceneTarget | None = Field(default=None, description="Specific target type to filter for (None returns all)")
224
+
225
+
226
+ class SceneQueryResponse(Message):
227
+ """
228
+ Response containing the results of a scene query.
229
+ """
230
+
231
+ prims: list[PrimInfo] = Field(description="List of matching prims with their applicable targets")
232
+
233
+
234
+ class SetSimulationControls(Message):
235
+ """
236
+ Set simulation control parameters.
237
+ """
238
+
239
+ max_physics_dt_us: int | None = Field(default=None, description="Maximum physics timestep in microseconds")
240
+ render_interval_us: int | None = Field(default=None, description="Render interval in microseconds")
@@ -0,0 +1,263 @@
1
+ from common.message import PirStatus
2
+ from common.session.views.animation import (
3
+ AddAnimationFromBasisCurve,
4
+ AddAnimationFromWaypoints,
5
+ GetAnimation,
6
+ GetAnimationResponse,
7
+ RemoveAnimation,
8
+ UpdateAnimationBasisCurve,
9
+ UpdateAnimationWaypoints,
10
+ )
11
+ from common.session.views.articulation import (
12
+ AddArticulation,
13
+ ArticulationConfig,
14
+ ArticulationJointConfig,
15
+ ArticulationJointConfigs,
16
+ ArticulationJointStates,
17
+ ArticulationJointTargets,
18
+ BufferArticulationRead,
19
+ BufferArticulationWrite,
20
+ BufferArticulationWriteResponse,
21
+ BufferedArticulationState,
22
+ GetArticulation,
23
+ GetArticulationJointConfigs,
24
+ GetArticulationJointStates,
25
+ GetArticulationJointTargets,
26
+ GetArticulationResponse,
27
+ GetBufferedArticulationRead,
28
+ SetArticulationJointConfigs,
29
+ SetArticulationJointStates,
30
+ SetArticulationJointTargets,
31
+ )
32
+ from common.session.views.basis_curve import (
33
+ AddBasisCurveSemiCircle,
34
+ GetBasisCurve,
35
+ GetBasisCurveExtents,
36
+ GetBasisCurveExtentsResponse,
37
+ GetBasisCurvePoints,
38
+ GetBasisCurvePointsResponse,
39
+ GetBasisCurveResponse,
40
+ RemoveBasisCurve,
41
+ SetBasisCurveVisibility,
42
+ )
43
+ from common.session.views.camera import AddCamera, CameraConfig, CameraMode, DistortionModel, GetCamera, GetCameraFrame, GetCameraResponse
44
+ from common.session.views.collision import (
45
+ GetMeshApproximation,
46
+ GetMeshApproximationResponse,
47
+ HasCollision,
48
+ HasCollisionResponse,
49
+ RemoveCollision,
50
+ SetCollision,
51
+ )
52
+ from common.session.views.geometry import AddGeometry, GeometryConfig, GeometryType, GetGeometry, GetGeometryResponse, MeshApproximation
53
+ from common.session.views.ground_plane import AddGroundPlane, GetGroundPlane, GetGroundPlaneResponse, GroundPlaneConfig
54
+ from common.session.views.imu import AddImu, GetImu, GetImuResponse, GetImuSample, ImuConfig
55
+ from common.session.views.joint import AddJoint, GetJoint, GetJointResponse, JointAxis, JointConfig, JointType
56
+ from common.session.views.light import (
57
+ AddLight,
58
+ DisableLight,
59
+ EnableLight,
60
+ GetLight,
61
+ GetLightResponse,
62
+ LightConfig,
63
+ LightType,
64
+ SetLightColor,
65
+ SetLightIntensity,
66
+ )
67
+ from common.session.views.pir_sensor import (
68
+ AddPirSensor,
69
+ GetPirDetectionStatus,
70
+ GetPirSensor,
71
+ GetPirSensorResponse,
72
+ PirSensorConfig,
73
+ SetPirDebugMode,
74
+ SetPirMaterial,
75
+ )
76
+ from common.session.views.radar import (
77
+ AddRadar,
78
+ BufferRadarRead,
79
+ GetBufferedRadarRead,
80
+ GetRadar,
81
+ GetRadarResponse,
82
+ GetRadarScan,
83
+ RadarConfig,
84
+ )
85
+ from common.session.views.rigid_body import (
86
+ AddRigidBody,
87
+ ApplyForce,
88
+ ApplyForceAtPosition,
89
+ ApplyTorque,
90
+ BodyCenterOfMass,
91
+ BodyDistance,
92
+ BodyInertia,
93
+ BodyMass,
94
+ BodyType,
95
+ BodyVelocity,
96
+ BoundingBox,
97
+ DisableGravity,
98
+ DisablePhysics,
99
+ EnableGravity,
100
+ EnablePhysics,
101
+ GetBodyBoundingBox,
102
+ GetBodyCenterOfMass,
103
+ GetBodyInertia,
104
+ GetBodyMass,
105
+ GetBodyVelocity,
106
+ GetDistanceBetweenBodies,
107
+ GetRigidBody,
108
+ GetRigidBodyResponse,
109
+ RigidBodyConfig,
110
+ SetBodyVelocity,
111
+ )
112
+ from common.session.views.viewport import (
113
+ SetActiveViewportCamera,
114
+ SetCameraView,
115
+ )
116
+ from common.session.views.xform import (
117
+ AddXForm,
118
+ GetXForm,
119
+ GetXFormResponse,
120
+ SetXformVisibility,
121
+ )
122
+
123
+ __all__ = [
124
+ # Articulation
125
+ "ArticulationConfig",
126
+ "ArticulationJointConfig",
127
+ "ArticulationJointConfigs",
128
+ "ArticulationJointStates",
129
+ "ArticulationJointTargets",
130
+ "BufferArticulationRead",
131
+ "BufferArticulationWrite",
132
+ "BufferArticulationWriteResponse",
133
+ "BufferedArticulationState",
134
+ "AddArticulation",
135
+ "GetArticulationJointConfigs",
136
+ "GetArticulationJointStates",
137
+ "GetArticulationJointTargets",
138
+ "GetBufferedArticulationRead",
139
+ "GetArticulation",
140
+ "GetArticulationResponse",
141
+ "SetArticulationJointConfigs",
142
+ "SetArticulationJointStates",
143
+ "SetArticulationJointTargets",
144
+ # Camera
145
+ "AddCamera",
146
+ "CameraConfig",
147
+ "CameraMode",
148
+ "DistortionModel",
149
+ "GetCamera",
150
+ "GetCameraFrame",
151
+ "GetCameraResponse",
152
+ # Collision
153
+ "GetMeshApproximation",
154
+ "GetMeshApproximationResponse",
155
+ "HasCollision",
156
+ "HasCollisionResponse",
157
+ "RemoveCollision",
158
+ "SetCollision",
159
+ # Geometry
160
+ "AddGeometry",
161
+ "GeometryConfig",
162
+ "GeometryType",
163
+ "GetGeometry",
164
+ "GetGeometryResponse",
165
+ "MeshApproximation",
166
+ # Ground Plane
167
+ "AddGroundPlane",
168
+ "GetGroundPlane",
169
+ "GetGroundPlaneResponse",
170
+ "GroundPlaneConfig",
171
+ # IMU
172
+ "AddImu",
173
+ "GetImu",
174
+ "GetImuResponse",
175
+ "GetImuSample",
176
+ "ImuConfig",
177
+ # Joint
178
+ "AddJoint",
179
+ "GetJoint",
180
+ "GetJointResponse",
181
+ "JointAxis",
182
+ "JointConfig",
183
+ "JointType",
184
+ # Light
185
+ "AddLight",
186
+ "DisableLight",
187
+ "EnableLight",
188
+ "GetLight",
189
+ "GetLightResponse",
190
+ "LightConfig",
191
+ "LightType",
192
+ "SetLightColor",
193
+ "SetLightIntensity",
194
+ # PIR Sensor
195
+ "AddPirSensor",
196
+ "GetPirDetectionStatus",
197
+ "GetPirSensor",
198
+ "GetPirSensorResponse",
199
+ "PirSensorConfig",
200
+ "PirStatus",
201
+ "SetPirDebugMode",
202
+ "SetPirMaterial",
203
+ # Radar
204
+ "AddRadar",
205
+ "BufferRadarRead",
206
+ "GetBufferedRadarRead",
207
+ "GetRadar",
208
+ "GetRadarResponse",
209
+ "GetRadarScan",
210
+ "RadarConfig",
211
+ # Rigid Body
212
+ "AddRigidBody",
213
+ "ApplyForce",
214
+ "ApplyForceAtPosition",
215
+ "ApplyTorque",
216
+ "BodyCenterOfMass",
217
+ "BodyDistance",
218
+ "BodyInertia",
219
+ "BodyMass",
220
+ "BodyType",
221
+ "BodyVelocity",
222
+ "BoundingBox",
223
+ "DisableGravity",
224
+ "DisablePhysics",
225
+ "EnableGravity",
226
+ "EnablePhysics",
227
+ "GetBodyBoundingBox",
228
+ "GetBodyCenterOfMass",
229
+ "GetBodyInertia",
230
+ "GetBodyMass",
231
+ "GetBodyVelocity",
232
+ "GetDistanceBetweenBodies",
233
+ "GetRigidBody",
234
+ "GetRigidBodyResponse",
235
+ "RigidBodyConfig",
236
+ "SetBodyVelocity",
237
+ # Viewport
238
+ "SetActiveViewportCamera",
239
+ "SetCameraView",
240
+ # XForm
241
+ "AddXForm",
242
+ "GetXForm",
243
+ "GetXFormResponse",
244
+ "SetXformVisibility",
245
+ # Basis Curve
246
+ "AddBasisCurveSemiCircle",
247
+ "GetBasisCurve",
248
+ "GetBasisCurveResponse",
249
+ "GetBasisCurveExtents",
250
+ "GetBasisCurveExtentsResponse",
251
+ "SetBasisCurveVisibility",
252
+ "GetBasisCurvePoints",
253
+ "GetBasisCurvePointsResponse",
254
+ "RemoveBasisCurve",
255
+ # Animation
256
+ "AddAnimationFromWaypoints",
257
+ "AddAnimationFromBasisCurve",
258
+ "UpdateAnimationWaypoints",
259
+ "UpdateAnimationBasisCurve",
260
+ "GetAnimation",
261
+ "GetAnimationResponse",
262
+ "RemoveAnimation",
263
+ ]
@@ -0,0 +1,73 @@
1
+ from typing import Literal
2
+
3
+ from pydantic import Field
4
+
5
+ from common.message import Message, Vector3
6
+
7
+
8
+ class AddAnimationFromWaypoints(Message):
9
+ """
10
+ Add an animation to the scene using waypoints.
11
+ """
12
+
13
+ path: str = Field(description="USD path for the animation")
14
+ waypoints: list[Vector3] = Field(description="List of waypoints")
15
+ loop: bool = Field(default=True, description="Whether to loop the animation")
16
+
17
+
18
+ class AddAnimationFromBasisCurve(Message):
19
+ """
20
+ Add an animation to the scene using a basis curve.
21
+ """
22
+
23
+ path: str = Field(description="USD path for the animation")
24
+ basis_curve: str = Field(description="Path to the basis curve to use for the animation")
25
+ samples_per_segment: int = Field(default=10, description="The number of samples per segment to use from the basis curve")
26
+ sort_by: Literal["X", "Y", "Z"] | None = Field(default=None, description="The axis to sort the points by")
27
+ ascending: bool = Field(default=True, description="Whether to sort the points in ascending order")
28
+
29
+
30
+ class UpdateAnimationWaypoints(Message):
31
+ """
32
+ Update the animation waypoints.
33
+ """
34
+
35
+ path: str = Field(description="USD path for the animation")
36
+ waypoints: list[Vector3] = Field(description="List of waypoints")
37
+ loop: bool = Field(default=True, description="Whether to loop the animation")
38
+
39
+
40
+ class UpdateAnimationBasisCurve(Message):
41
+ """
42
+ Update the animation using a basis curve.
43
+ """
44
+
45
+ path: str = Field(description="USD path for the animation")
46
+ basis_curve: str = Field(description="Path to the basis curve to use for the animation")
47
+ samples_per_segment: int = Field(default=10, description="The number of samples per segment to use from the basis curve")
48
+ sort_by: Literal["X", "Y", "Z"] | None = Field(default=None, description="The axis to sort the points by")
49
+ ascending: bool = Field(default=True, description="Whether to sort the points in ascending order")
50
+
51
+
52
+ class GetAnimation(Message):
53
+ """
54
+ Get an existing animation view from a prim.
55
+ """
56
+
57
+ path: str = Field(description="USD path for the animation")
58
+
59
+
60
+ class GetAnimationResponse(Message):
61
+ """
62
+ Response from getting an animation view.
63
+ """
64
+
65
+ path: str
66
+
67
+
68
+ class RemoveAnimation(Message):
69
+ """
70
+ Remove an animation from the scene (deletes the prim).
71
+ """
72
+
73
+ path: str = Field(description="USD path for the animation")