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
common/session/config.py
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
from pydantic.alias_generators import to_camel
|
|
5
|
+
|
|
6
|
+
from common.message import CameraInfo, Message, Pose, Vector3
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GeometryType(str, Enum):
|
|
10
|
+
"""
|
|
11
|
+
Supported geometry types.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
SPHERE = "sphere"
|
|
15
|
+
CUBE = "cube"
|
|
16
|
+
CYLINDER = "cylinder"
|
|
17
|
+
CONE = "cone"
|
|
18
|
+
CAPSULE = "capsule"
|
|
19
|
+
MESH = "mesh"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MeshApproximation(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
Collision mesh approximation type.
|
|
25
|
+
|
|
26
|
+
Values are stored in snake_case for consistency with Rust. Use to_usd()
|
|
27
|
+
to get the camelCase format required by USD/Isaac Sim.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
NONE = "none"
|
|
31
|
+
CONVEX_HULL = "convex_hull"
|
|
32
|
+
CONVEX_DECOMPOSITION = "convex_decomposition"
|
|
33
|
+
BOUNDING_SPHERE = "bounding_sphere"
|
|
34
|
+
BOUNDING_CUBE = "bounding_cube"
|
|
35
|
+
MESH_SIMPLIFICATION = "mesh_simplification"
|
|
36
|
+
SDF = "sdf"
|
|
37
|
+
SPHERE_FILL = "sphere_fill"
|
|
38
|
+
|
|
39
|
+
def to_usd(self) -> str:
|
|
40
|
+
"""
|
|
41
|
+
Convert to USD camelCase format.
|
|
42
|
+
|
|
43
|
+
:return: The USD camelCase format.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
return to_camel(self.value)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class GeometryConfig(Message):
|
|
50
|
+
"""
|
|
51
|
+
Configuration for creating geometry.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
geometry_type: GeometryType = Field(description="Geometry type")
|
|
55
|
+
radius: float | None = Field(default=None, description="Radius for sphere/cylinder/cone/capsule")
|
|
56
|
+
height: float | None = Field(default=None, description="Height for cylinder/cone/capsule")
|
|
57
|
+
size: float | None = Field(default=None, description="Size for cube (uniform)")
|
|
58
|
+
color: Vector3 | None = Field(default=None, description="RGB color (0-1)")
|
|
59
|
+
opacity: float = Field(default=1.0, description="Opacity (0=transparent, 1=opaque)")
|
|
60
|
+
enable_collision: bool = Field(default=True, description="Whether to enable collision on this geometry")
|
|
61
|
+
static_friction: float = Field(default=0.5, description="Static friction coefficient")
|
|
62
|
+
dynamic_friction: float = Field(default=0.5, description="Dynamic friction coefficient")
|
|
63
|
+
restitution: float = Field(default=0.2, description="Restitution (bounciness)")
|
|
64
|
+
mesh_file_path: str | None = Field(default=None, description="Path to mesh file (FBX, OBJ, glTF, STL, etc.) - required for MESH type")
|
|
65
|
+
mesh_approximation: MeshApproximation = Field(default=MeshApproximation.CONVEX_DECOMPOSITION, description="Mesh approximation method")
|
|
66
|
+
contact_offset: float | None = Field(default=None, description="Distance at which collision detection begins")
|
|
67
|
+
rest_offset: float | None = Field(default=None, description="Minimum separation distance between objects")
|
|
68
|
+
torsional_patch_radius: float | None = Field(default=None, description="Radius for torsional friction calculations")
|
|
69
|
+
min_torsional_patch_radius: float | None = Field(default=None, description="Minimum radius for torsional friction")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class CameraMode(str, Enum):
|
|
73
|
+
"""
|
|
74
|
+
Camera capture modes.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
RGB = "rgb"
|
|
78
|
+
DEPTH = "depth"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class DistortionModel(str, Enum):
|
|
82
|
+
"""
|
|
83
|
+
Camera lens distortion model types.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
PINHOLE = "pinhole"
|
|
87
|
+
OPENCV_PINHOLE = "opencv_pinhole"
|
|
88
|
+
OPENCV_FISHEYE = "opencv_fisheye"
|
|
89
|
+
FTHETA = "ftheta"
|
|
90
|
+
KANNALA_BRANDT_K3 = "kannala_brandt_k3"
|
|
91
|
+
RAD_TAN_THIN_PRISM = "rad_tan_thin_prism"
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class CameraConfig(Message):
|
|
95
|
+
"""
|
|
96
|
+
Configuration for camera sensor.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
mode: CameraMode = Field(default=CameraMode.RGB, description="Camera capture mode (RGB or depth)")
|
|
100
|
+
frequency: int = Field(default=30, description="Camera update frequency in Hz")
|
|
101
|
+
width: int = Field(default=640, description="Image width in pixels")
|
|
102
|
+
height: int = Field(default=480, description="Image height in pixels")
|
|
103
|
+
focal_length: float = Field(default=50.0, description="Focal length in mm")
|
|
104
|
+
sensor_width: float = Field(default=20.4, description="Physical sensor width in mm")
|
|
105
|
+
sensor_height: float = Field(default=15.3, description="Physical sensor height in mm")
|
|
106
|
+
near_clip: float = Field(default=0.1, description="Near clipping plane in meters")
|
|
107
|
+
far_clip: float = Field(default=1000.0, description="Far clipping plane in meters")
|
|
108
|
+
f_stop: float = Field(default=0.0, description="F-stop for depth of field")
|
|
109
|
+
focus_distance: float = Field(default=10.0, description="Focus distance in meters")
|
|
110
|
+
principal_point_x: float = Field(default=0.0, description="Principal point X offset in pixels")
|
|
111
|
+
principal_point_y: float = Field(default=0.0, description="Principal point Y offset in pixels")
|
|
112
|
+
distortion_model: DistortionModel = Field(default=DistortionModel.PINHOLE, description="Lens distortion model")
|
|
113
|
+
distortion_coefficients: list[float] | None = Field(default=None, description="Distortion coefficients")
|
|
114
|
+
|
|
115
|
+
def to_camera_info(self, frame_id: str = "camera_optical_frame") -> CameraInfo:
|
|
116
|
+
"""
|
|
117
|
+
Convert camera configuration to CameraInfo with calculated intrinsics.
|
|
118
|
+
|
|
119
|
+
:param frame_id: The coordinate frame ID for the camera.
|
|
120
|
+
:return: CameraInfo with full intrinsics and distortion parameters.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
# Convert mm to pixels for focal length
|
|
124
|
+
fx = self.width * self.focal_length / self.sensor_width
|
|
125
|
+
fy = self.height * self.focal_length / self.sensor_height
|
|
126
|
+
|
|
127
|
+
# Principal point (image center + offset)
|
|
128
|
+
cx = self.width / 2.0 + self.principal_point_x
|
|
129
|
+
cy = self.height / 2.0 + self.principal_point_y
|
|
130
|
+
|
|
131
|
+
return CameraInfo(
|
|
132
|
+
width=self.width,
|
|
133
|
+
height=self.height,
|
|
134
|
+
fx=fx,
|
|
135
|
+
fy=fy,
|
|
136
|
+
cx=cx,
|
|
137
|
+
cy=cy,
|
|
138
|
+
distortion_model=self.distortion_model.value,
|
|
139
|
+
distortion_coefficients=self.distortion_coefficients or [],
|
|
140
|
+
frame_id=frame_id,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class ArticulationJointConfig(Message):
|
|
145
|
+
"""
|
|
146
|
+
Complete configuration for a single joint in an articulation.
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
path: str = Field(description="Name of the joint/DOF")
|
|
150
|
+
stiffness: float | None = Field(default=None, description="PD controller stiffness (Kp)")
|
|
151
|
+
damping: float | None = Field(default=None, description="PD controller damping (Kd)")
|
|
152
|
+
lower_limit: float | None = Field(default=None, description="Lower joint limit")
|
|
153
|
+
upper_limit: float | None = Field(default=None, description="Upper joint limit")
|
|
154
|
+
armature: float | None = Field(default=None, description="Joint armature")
|
|
155
|
+
friction_coefficient: float | None = Field(default=None, description="Joint friction coefficient")
|
|
156
|
+
max_velocity: float | None = Field(default=None, description="Maximum joint velocity")
|
|
157
|
+
max_effort: float | None = Field(default=None, description="Maximum joint effort")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class ArticulationConfig(Message):
|
|
161
|
+
"""
|
|
162
|
+
Configuration for applying articulation root to a prim.
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
solver_position_iterations: int = Field(default=32, description="Number of position iterations for the solver")
|
|
166
|
+
solver_velocity_iterations: int = Field(default=1, description="Number of velocity iterations for the solver")
|
|
167
|
+
sleep_threshold: float = Field(default=0.005, description="Sleep threshold for the articulation")
|
|
168
|
+
stabilization_threshold: float = Field(default=0.001, description="Stabilization threshold for the articulation")
|
|
169
|
+
enable_self_collisions: bool = Field(default=False, description="Whether to enable self-collisions")
|
|
170
|
+
joint_configs: list[ArticulationJointConfig] = Field(default_factory=list, description="Per-joint configurations")
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class JointType(str, Enum):
|
|
174
|
+
"""
|
|
175
|
+
Types of joints supported by the simulator.
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
REVOLUTE = "revolute"
|
|
179
|
+
PRISMATIC = "prismatic"
|
|
180
|
+
FIXED = "fixed"
|
|
181
|
+
SPHERICAL = "spherical"
|
|
182
|
+
DISTANCE = "distance"
|
|
183
|
+
GENERIC = "generic"
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class JointAxis(str, Enum):
|
|
187
|
+
"""
|
|
188
|
+
Axis of motion for joints.
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
X = "x"
|
|
192
|
+
Y = "y"
|
|
193
|
+
Z = "z"
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class JointConfig(Message):
|
|
197
|
+
"""
|
|
198
|
+
Configuration for a joint object that connects two bodies.
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
# Joint relationships
|
|
202
|
+
parent_path: str = Field(description="USD path to parent body")
|
|
203
|
+
child_path: str = Field(description="USD path to child body")
|
|
204
|
+
|
|
205
|
+
# Transform
|
|
206
|
+
pose: Pose = Field(default_factory=Pose.identity, description="Joint pose relative to parent")
|
|
207
|
+
|
|
208
|
+
# Joint properties
|
|
209
|
+
joint_type: JointType = Field(default=JointType.FIXED, description="Type of joint motion allowed")
|
|
210
|
+
axis: JointAxis = Field(default=JointAxis.X, description="Axis of motion for non-fixed joints")
|
|
211
|
+
|
|
212
|
+
# Motion limits (for revolute: degrees, for prismatic: meters)
|
|
213
|
+
lower_limit: float | None = Field(default=None, description="Lower motion limit")
|
|
214
|
+
upper_limit: float | None = Field(default=None, description="Upper motion limit")
|
|
215
|
+
|
|
216
|
+
# Physics properties
|
|
217
|
+
friction: float = Field(default=0.01, description="Joint friction (unitless)")
|
|
218
|
+
armature: float = Field(default=0.1, description="Joint armature (kg for prismatic, kg-m^2 for revolute)")
|
|
219
|
+
|
|
220
|
+
# Special properties
|
|
221
|
+
exclude_from_articulation: bool = Field(default=False, description="Whether to exclude this joint from articulation")
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class BodyType(str, Enum):
|
|
225
|
+
"""
|
|
226
|
+
Type of rigid body.
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
DYNAMIC = "dynamic"
|
|
230
|
+
KINEMATIC = "kinematic"
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class RigidBodyConfig(Message):
|
|
234
|
+
"""
|
|
235
|
+
Configuration for rigid body physics properties.
|
|
236
|
+
|
|
237
|
+
Note: Collision properties (friction, restitution, mesh approximation) are configured
|
|
238
|
+
on the geometry, not the rigid body.
|
|
239
|
+
"""
|
|
240
|
+
|
|
241
|
+
body_type: BodyType = Field(default=BodyType.DYNAMIC, description="Type of rigid body")
|
|
242
|
+
mass: float = Field(default=1.0, description="Mass in kg")
|
|
243
|
+
density: float | None = Field(default=None, description="Density in kg/m³ (alternative to mass)")
|
|
244
|
+
center_of_mass: Vector3 | None = Field(default=None, description="Center of mass offset in body frame")
|
|
245
|
+
diagonal_inertia: Vector3 | None = Field(default=None, description="Diagonal inertia values (Ixx, Iyy, Izz)")
|
|
246
|
+
principal_axes: Vector3 | None = Field(default=None, description="Principal axes orientation as RPY")
|
|
247
|
+
sleep_threshold: float | None = Field(default=None, description="Mass-normalized kinetic energy threshold for sleeping")
|
|
248
|
+
linear_velocity: Vector3 | None = Field(default=None, description="Initial linear velocity")
|
|
249
|
+
angular_velocity: Vector3 | None = Field(default=None, description="Initial angular velocity")
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class LightType(str, Enum):
|
|
253
|
+
"""
|
|
254
|
+
Supported light types.
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
SPHERE = "sphere"
|
|
258
|
+
RECT = "rect"
|
|
259
|
+
DISK = "disk"
|
|
260
|
+
CYLINDER = "cylinder"
|
|
261
|
+
DISTANT = "distant"
|
|
262
|
+
DOME = "dome"
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class LightConfig(Message):
|
|
266
|
+
"""
|
|
267
|
+
Configuration for creating a light.
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
light_type: LightType = Field(default=LightType.SPHERE, description="Light type")
|
|
271
|
+
intensity: float = Field(default=30000.0, description="Light intensity")
|
|
272
|
+
exposure: float = Field(default=10.0, description="Light exposure")
|
|
273
|
+
color: Vector3 = Field(default_factory=Vector3.ones, description="RGB color (0-1)")
|
|
274
|
+
radius: float = Field(default=0.1, description="Radius for sphere lights (meters)")
|
|
275
|
+
width: float | None = Field(default=None, description="Width for rect lights (meters)")
|
|
276
|
+
height: float | None = Field(default=None, description="Height for rect/cylinder lights (meters)")
|
|
277
|
+
length: float | None = Field(default=None, description="Length for cylinder lights (meters)")
|
|
278
|
+
angle: float | None = Field(default=None, description="Angle for distant lights (degrees)")
|
|
279
|
+
texture_file: str | None = Field(default=None, description="Texture file for dome lights")
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class GroundPlaneConfig(Message):
|
|
283
|
+
"""
|
|
284
|
+
Configuration for creating a ground plane.
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
size: float = Field(default=5000.0, description="Size of the ground plane in meters")
|
|
288
|
+
z_position: float = Field(default=0.0, description="Z position of the ground plane")
|
|
289
|
+
color: Vector3 = Field(default=Vector3.new(0.5, 0.5, 0.5), description="RGB color (0-1)")
|
|
290
|
+
static_friction: float = Field(default=0.5, description="Static friction coefficient")
|
|
291
|
+
dynamic_friction: float = Field(default=0.5, description="Dynamic friction coefficient")
|
|
292
|
+
restitution: float = Field(default=0.0, description="Restitution (bounciness)")
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
class ImuConfig(Message):
|
|
296
|
+
"""
|
|
297
|
+
Configuration for IMU sensor.
|
|
298
|
+
"""
|
|
299
|
+
|
|
300
|
+
frequency: int | None = Field(default=None, description="Sensor update frequency in Hz (optional, defaults to physics rate)")
|
|
301
|
+
linear_acceleration_filter_size: int = Field(default=10, description="Filter window size for linear acceleration")
|
|
302
|
+
angular_velocity_filter_size: int = Field(default=10, description="Filter window size for angular velocity")
|
|
303
|
+
orientation_filter_size: int = Field(default=10, description="Filter window size for orientation")
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class RadarConfig(Message):
|
|
307
|
+
"""
|
|
308
|
+
Configuration for RTX radar sensor.
|
|
309
|
+
|
|
310
|
+
All parameters can be customized with sensible defaults provided.
|
|
311
|
+
"""
|
|
312
|
+
|
|
313
|
+
# Core sensor parameters
|
|
314
|
+
frequency: int = Field(default=10, description="Sensor update frequency in Hz")
|
|
315
|
+
|
|
316
|
+
# Field of view (degrees from center, so total FOV is 2x these values)
|
|
317
|
+
max_azimuth: float = Field(default=66.0, description="Maximum azimuth angle in degrees (±FOV from center)")
|
|
318
|
+
max_elevation: float = Field(default=20.0, description="Maximum elevation angle in degrees (±FOV from center)")
|
|
319
|
+
|
|
320
|
+
# Range parameters
|
|
321
|
+
max_range: float = Field(default=200.0, description="Maximum detection range in meters")
|
|
322
|
+
range_resolution: float = Field(default=0.4, description="Range resolution in meters")
|
|
323
|
+
|
|
324
|
+
# Angular resolution at boresight (center of FOV)
|
|
325
|
+
azimuth_resolution: float = Field(default=1.3, description="Azimuth resolution at boresight in degrees")
|
|
326
|
+
elevation_resolution: float = Field(default=5.0, description="Elevation resolution at boresight in degrees")
|
|
327
|
+
|
|
328
|
+
# Noise parameters (standard deviation for Gaussian noise)
|
|
329
|
+
azimuth_noise: float = Field(default=0.0, description="Azimuth measurement noise standard deviation in radians")
|
|
330
|
+
range_noise: float = Field(default=0.0, description="Range measurement noise standard deviation in meters")
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
class PirSensorConfig(Message):
|
|
334
|
+
"""
|
|
335
|
+
Configuration for PIR (Passive Infrared) motion sensor.
|
|
336
|
+
|
|
337
|
+
PIR sensors detect infrared radiation changes caused by moving warm objects.
|
|
338
|
+
The sensor uses a 3-sensor design (center, left, right) with dual elements per sensor.
|
|
339
|
+
"""
|
|
340
|
+
|
|
341
|
+
# Core sensor parameters
|
|
342
|
+
update_rate_hz: float = Field(default=60.0, description="Sensor update frequency in Hz")
|
|
343
|
+
max_range: float = Field(default=20.0, description="Maximum detection range in meters")
|
|
344
|
+
|
|
345
|
+
# FOV configuration
|
|
346
|
+
total_horiz_fov_deg: float = Field(default=150.0, description="Total horizontal coverage")
|
|
347
|
+
sensor_side_fov_deg: float = Field(default=45.0, description="Horizontal FOV for side sensors")
|
|
348
|
+
sensor_center_fov_deg: float = Field(default=45.0, description="Horizontal FOV for center sensor")
|
|
349
|
+
|
|
350
|
+
# Ray configuration
|
|
351
|
+
sensor_rays_horiz: int = Field(default=128, description="Number of rays per sensor in horizontal direction")
|
|
352
|
+
sensor_rays_vert: int = Field(default=16, description="Number of rays per sensor in vertical direction")
|
|
353
|
+
|
|
354
|
+
# Sensor vertical angle range
|
|
355
|
+
min_vertical_angle_center: float = Field(default=-30.0, description="Minimum vertical angle for center sensor in degrees")
|
|
356
|
+
max_vertical_angle_center: float = Field(default=30.0, description="Maximum vertical angle for center sensor in degrees")
|
|
357
|
+
min_vertical_angle_side: float = Field(default=-30.0, description="Minimum vertical angle for side sensors in degrees")
|
|
358
|
+
max_vertical_angle_side: float = Field(default=30.0, description="Maximum vertical angle for side sensors in degrees")
|
|
359
|
+
|
|
360
|
+
# DSP / electronics parameters
|
|
361
|
+
gain_center: float = Field(default=0.015, description="Amplifier gain for center sensor")
|
|
362
|
+
gain_sides: float = Field(default=0.01, description="Amplifier gain for side sensors")
|
|
363
|
+
hp_corner_hz: float = Field(default=0.4, description="High-pass filter corner frequency in Hz")
|
|
364
|
+
lp_corner_hz: float = Field(default=10.0, description="Low-pass filter corner frequency in Hz")
|
|
365
|
+
blind_time_s: float = Field(default=0.5, description="Blind time after detection in seconds")
|
|
366
|
+
pulse_counter: int = Field(default=2, description="Number of pulses required to trigger detection (1-4)")
|
|
367
|
+
window_time_s: float = Field(default=2.0, description="Window time for pulse counting in seconds")
|
|
368
|
+
count_mode: int = Field(default=0, description="Pulse counting mode (0: sign change required, 1: any crossing)")
|
|
369
|
+
|
|
370
|
+
# Lens parameters
|
|
371
|
+
lens_transmission: float = Field(default=0.9, description="Lens transmission coefficient (0-1)")
|
|
372
|
+
lens_segments_h: int = Field(default=6, description="Number of horizontal lens segments (facets)")
|
|
373
|
+
|
|
374
|
+
# Environment parameters
|
|
375
|
+
ambient_temp_c: float = Field(default=20.0, description="Ambient temperature in Celsius")
|
|
376
|
+
|
|
377
|
+
# Hard-coded threshold (if not none) overrides auto-calibration
|
|
378
|
+
threshold: float | None = Field(default=None, description="Detection threshold (auto-calibrated if None)")
|
|
379
|
+
threshold_scale: float = Field(default=1.0, description="Scale factor applied to auto-calibrated threshold")
|
|
380
|
+
|
|
381
|
+
# Pyroelectric element parameters
|
|
382
|
+
thermal_time_constant_s: float = Field(default=0.2, description="Element thermal time constant in seconds")
|
|
383
|
+
pyro_responsivity: float = Field(default=4000.0, description="Pyroelectric responsivity scaling factor")
|
|
384
|
+
noise_amplitude: float = Field(default=20e-6, description="Thermal/electronic noise amplitude")
|
|
385
|
+
|
|
386
|
+
# Auto-threshold calibration parameters
|
|
387
|
+
target_delta_t: float = Field(default=10.0, description="Target temperature difference for threshold calibration in Celsius")
|
|
388
|
+
target_distance: float = Field(default=5.0, description="Target distance for threshold calibration in meters")
|
|
389
|
+
target_emissivity: float = Field(default=0.98, description="Target emissivity for threshold calibration")
|
|
390
|
+
target_velocity_mps: float = Field(default=1.0, description="Target velocity for threshold calibration in m/s")
|
common/session/sim.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import time
|
|
2
1
|
from enum import Enum
|
|
3
|
-
from typing import Any
|
|
2
|
+
from typing import Any, TypeVar, cast
|
|
4
3
|
|
|
5
|
-
from
|
|
4
|
+
from common.message import Message
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
T = TypeVar("T")
|
|
7
|
+
_MISSING = object()
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class SimulationState(str, Enum):
|
|
@@ -17,14 +17,6 @@ class SimulationState(str, Enum):
|
|
|
17
17
|
STOPPED = "stopped"
|
|
18
18
|
|
|
19
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
20
|
class SimulationInfo(Message):
|
|
29
21
|
"""
|
|
30
22
|
Full simulation info.
|
|
@@ -42,77 +34,9 @@ class SimulationTime(Message):
|
|
|
42
34
|
time_us: int
|
|
43
35
|
|
|
44
36
|
|
|
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
37
|
class RpcError(Message):
|
|
114
38
|
"""
|
|
115
|
-
RPC error.
|
|
39
|
+
RPC error details.
|
|
116
40
|
"""
|
|
117
41
|
|
|
118
42
|
message: str
|
|
@@ -122,69 +46,44 @@ class RpcError(Message):
|
|
|
122
46
|
|
|
123
47
|
class RpcCall(Message):
|
|
124
48
|
"""
|
|
125
|
-
RPC
|
|
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.
|
|
49
|
+
RPC request with dict payload.
|
|
135
50
|
"""
|
|
136
51
|
|
|
137
|
-
|
|
138
|
-
payload: bytes | None = None
|
|
139
|
-
error: RpcError | None = None
|
|
140
|
-
|
|
52
|
+
data: dict[str, Any] | None = None
|
|
141
53
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"""
|
|
54
|
+
def get(self, key: str, *, type: type[T] | None = None, default: T | object = _MISSING) -> T:
|
|
55
|
+
"""
|
|
56
|
+
Get a value from the call data with optional type conversion.
|
|
146
57
|
|
|
147
|
-
|
|
148
|
-
|
|
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")
|
|
58
|
+
If type is a Message subclass, auto-converts via model_validate.
|
|
59
|
+
Raises KeyError if key missing and no default provided.
|
|
156
60
|
|
|
61
|
+
:param key: The key to lookup in data.
|
|
62
|
+
:param type: The expected type class (optional).
|
|
63
|
+
:param default: Default value to return if key is missing (can be None).
|
|
64
|
+
:return: The value (converted if type provided).
|
|
65
|
+
:raises KeyError: If key is missing and no default provided.
|
|
66
|
+
"""
|
|
157
67
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
68
|
+
if self.data is None or key not in self.data:
|
|
69
|
+
if default is not _MISSING:
|
|
70
|
+
return cast(T, default)
|
|
71
|
+
raise KeyError(f"Missing required field '{key}'")
|
|
161
72
|
|
|
162
|
-
|
|
163
|
-
|
|
73
|
+
value = self.data[key]
|
|
74
|
+
if type is not None and isinstance(value, dict) and issubclass(type, Message):
|
|
75
|
+
return cast(T, type.model_validate(value))
|
|
164
76
|
|
|
165
|
-
|
|
166
|
-
attribute_name: str = Field(description="Name of the attribute to get")
|
|
77
|
+
return cast(T, value)
|
|
167
78
|
|
|
168
79
|
|
|
169
|
-
class
|
|
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):
|
|
80
|
+
class RpcResponse(Message):
|
|
183
81
|
"""
|
|
184
|
-
|
|
82
|
+
RPC response with arbitrary payload or error.
|
|
185
83
|
"""
|
|
186
84
|
|
|
187
|
-
|
|
85
|
+
data: Any = None
|
|
86
|
+
error: RpcError | None = None
|
|
188
87
|
|
|
189
88
|
|
|
190
89
|
class SceneTarget(str, Enum):
|
|
@@ -210,17 +109,8 @@ class PrimInfo(Message):
|
|
|
210
109
|
Information about a prim in the scene with its applicable view types.
|
|
211
110
|
"""
|
|
212
111
|
|
|
213
|
-
path: str
|
|
214
|
-
targets: list[SceneTarget]
|
|
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)")
|
|
112
|
+
path: str
|
|
113
|
+
targets: list[SceneTarget]
|
|
224
114
|
|
|
225
115
|
|
|
226
116
|
class SceneQueryResponse(Message):
|
|
@@ -228,13 +118,12 @@ class SceneQueryResponse(Message):
|
|
|
228
118
|
Response containing the results of a scene query.
|
|
229
119
|
"""
|
|
230
120
|
|
|
231
|
-
prims: list[PrimInfo]
|
|
121
|
+
prims: list[PrimInfo]
|
|
232
122
|
|
|
233
123
|
|
|
234
|
-
class
|
|
124
|
+
class PrimAttributeValue(Message):
|
|
235
125
|
"""
|
|
236
|
-
|
|
126
|
+
Response containing an attribute value.
|
|
237
127
|
"""
|
|
238
128
|
|
|
239
|
-
|
|
240
|
-
render_interval_us: int | None = Field(default=None, description="Render interval in microseconds")
|
|
129
|
+
value: float | int | str | bool | list[float]
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from antioch.session.views.animation import Animation
|
|
2
|
-
from antioch.session.views.articulation import Articulation
|
|
3
|
-
from antioch.session.views.basis_curve import BasisCurve
|
|
4
|
-
from antioch.session.views.camera import Camera
|
|
5
|
-
from antioch.session.views.collision import (
|
|
6
|
-
get_mesh_approximation,
|
|
7
|
-
has_collision,
|
|
8
|
-
remove_collision,
|
|
9
|
-
set_collision,
|
|
10
|
-
)
|
|
11
|
-
from antioch.session.views.geometry import Geometry
|
|
12
|
-
from antioch.session.views.ground_plane import GroundPlane
|
|
13
|
-
from antioch.session.views.imu import Imu
|
|
14
|
-
from antioch.session.views.joint import Joint
|
|
15
|
-
from antioch.session.views.light import Light
|
|
16
|
-
from antioch.session.views.material import set_nonvisual_material
|
|
17
|
-
from antioch.session.views.pir_sensor import PirSensor, set_pir_material
|
|
18
|
-
from antioch.session.views.radar import Radar
|
|
19
|
-
from antioch.session.views.rigid_body import RigidBody
|
|
20
|
-
from antioch.session.views.xform import XForm
|
|
21
|
-
|
|
22
|
-
__all__ = [
|
|
23
|
-
"Animation",
|
|
24
|
-
"Articulation",
|
|
25
|
-
"BasisCurve",
|
|
26
|
-
"Camera",
|
|
27
|
-
"Geometry",
|
|
28
|
-
"GroundPlane",
|
|
29
|
-
"Imu",
|
|
30
|
-
"Joint",
|
|
31
|
-
"Light",
|
|
32
|
-
"PirSensor",
|
|
33
|
-
"Radar",
|
|
34
|
-
"RigidBody",
|
|
35
|
-
"XForm",
|
|
36
|
-
"get_mesh_approximation",
|
|
37
|
-
"has_collision",
|
|
38
|
-
"remove_collision",
|
|
39
|
-
"set_collision",
|
|
40
|
-
"set_nonvisual_material",
|
|
41
|
-
"set_pir_material",
|
|
42
|
-
]
|