antioch-py 3.0.6__tar.gz

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 (68) hide show
  1. antioch_py-3.0.6/LICENSE +21 -0
  2. antioch_py-3.0.6/MANIFEST.in +3 -0
  3. antioch_py-3.0.6/PKG-INFO +112 -0
  4. antioch_py-3.0.6/README.md +105 -0
  5. antioch_py-3.0.6/README.pypi.md +77 -0
  6. antioch_py-3.0.6/antioch/__init__.py +101 -0
  7. antioch_py-3.0.6/antioch/clock.py +62 -0
  8. antioch_py-3.0.6/antioch/execution.py +278 -0
  9. antioch_py-3.0.6/antioch/input.py +125 -0
  10. antioch_py-3.0.6/antioch/module.py +201 -0
  11. antioch_py-3.0.6/antioch/node.py +358 -0
  12. antioch_py-3.0.6/antioch_py.egg-info/PKG-INFO +112 -0
  13. antioch_py-3.0.6/antioch_py.egg-info/SOURCES.txt +66 -0
  14. antioch_py-3.0.6/antioch_py.egg-info/dependency_links.txt +1 -0
  15. antioch_py-3.0.6/antioch_py.egg-info/requires.txt +16 -0
  16. antioch_py-3.0.6/antioch_py.egg-info/top_level.txt +2 -0
  17. antioch_py-3.0.6/common/__init__.py +0 -0
  18. antioch_py-3.0.6/common/ark/__init__.py +50 -0
  19. antioch_py-3.0.6/common/ark/ark.py +91 -0
  20. antioch_py-3.0.6/common/ark/hardware.py +97 -0
  21. antioch_py-3.0.6/common/ark/kinematics.py +31 -0
  22. antioch_py-3.0.6/common/ark/module.py +107 -0
  23. antioch_py-3.0.6/common/ark/node.py +137 -0
  24. antioch_py-3.0.6/common/ark/scheduler.py +412 -0
  25. antioch_py-3.0.6/common/ark/sim.py +33 -0
  26. antioch_py-3.0.6/common/ark/token.py +59 -0
  27. antioch_py-3.0.6/common/assets/__init__.py +3 -0
  28. antioch_py-3.0.6/common/assets/rigging.usd +0 -0
  29. antioch_py-3.0.6/common/constants.py +126 -0
  30. antioch_py-3.0.6/common/core/__init__.py +65 -0
  31. antioch_py-3.0.6/common/core/auth.py +278 -0
  32. antioch_py-3.0.6/common/core/container.py +261 -0
  33. antioch_py-3.0.6/common/core/registry.py +310 -0
  34. antioch_py-3.0.6/common/core/rome.py +251 -0
  35. antioch_py-3.0.6/common/core/telemetry.py +176 -0
  36. antioch_py-3.0.6/common/core/types.py +219 -0
  37. antioch_py-3.0.6/common/message/__init__.py +75 -0
  38. antioch_py-3.0.6/common/message/annotation.py +240 -0
  39. antioch_py-3.0.6/common/message/array.py +524 -0
  40. antioch_py-3.0.6/common/message/camera.py +113 -0
  41. antioch_py-3.0.6/common/message/color.py +165 -0
  42. antioch_py-3.0.6/common/message/detection.py +40 -0
  43. antioch_py-3.0.6/common/message/foxglove.py +20 -0
  44. antioch_py-3.0.6/common/message/frame.py +114 -0
  45. antioch_py-3.0.6/common/message/image.py +220 -0
  46. antioch_py-3.0.6/common/message/imu.py +34 -0
  47. antioch_py-3.0.6/common/message/joint.py +106 -0
  48. antioch_py-3.0.6/common/message/log.py +76 -0
  49. antioch_py-3.0.6/common/message/message.py +517 -0
  50. antioch_py-3.0.6/common/message/pir.py +33 -0
  51. antioch_py-3.0.6/common/message/plot.py +57 -0
  52. antioch_py-3.0.6/common/message/point.py +158 -0
  53. antioch_py-3.0.6/common/message/point_cloud.py +99 -0
  54. antioch_py-3.0.6/common/message/pose.py +188 -0
  55. antioch_py-3.0.6/common/message/quaternion.py +286 -0
  56. antioch_py-3.0.6/common/message/radar.py +224 -0
  57. antioch_py-3.0.6/common/message/twist.py +34 -0
  58. antioch_py-3.0.6/common/message/types.py +72 -0
  59. antioch_py-3.0.6/common/message/vector.py +721 -0
  60. antioch_py-3.0.6/common/sim/__init__.py +49 -0
  61. antioch_py-3.0.6/common/sim/objects.py +460 -0
  62. antioch_py-3.0.6/common/sim/state.py +11 -0
  63. antioch_py-3.0.6/common/utils/__init__.py +4 -0
  64. antioch_py-3.0.6/common/utils/comms.py +589 -0
  65. antioch_py-3.0.6/common/utils/logger.py +142 -0
  66. antioch_py-3.0.6/common/utils/time.py +42 -0
  67. antioch_py-3.0.6/pyproject.toml +95 -0
  68. antioch_py-3.0.6/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Antioch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.pypi.md
2
+ include LICENSE
3
+
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: antioch-py
3
+ Version: 3.0.6
4
+ Summary: Antioch Python Module SDK
5
+ Author-email: Antioch Robotics <support@antioch.dev>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://antioch.com
8
+ Keywords: robotics,simulation,middleware,sdk,modules
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Requires-Python: <3.13,>=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: click>=8.0.0
19
+ Requires-Dist: docker>=7.0.0
20
+ Requires-Dist: eclipse-zenoh>=1.5.0
21
+ Requires-Dist: foxglove-sdk>=0.14.1
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: loguru>=0.7.3
24
+ Requires-Dist: msgpack==1.1.1
25
+ Requires-Dist: msgpack>=1.1.1
26
+ Requires-Dist: numpy==1.26.0
27
+ Requires-Dist: ormsgpack>=1.6.0
28
+ Requires-Dist: pydantic>=2.11.6
29
+ Requires-Dist: pydantic>=2.11.7
30
+ Requires-Dist: pyyaml>=6.0.2
31
+ Requires-Dist: scipy==1.15.3
32
+ Requires-Dist: sortedcontainers-stubs>=2.4.3
33
+ Requires-Dist: sortedcontainers>=2.4.0
34
+ Dynamic: license-file
35
+
36
+ # antioch-py
37
+
38
+ Python SDK for the [Antioch](https://antioch.com) autonomy simulation platform.
39
+
40
+ ## Overview
41
+
42
+ The antioch-py package provides two components:
43
+
44
+ ### Module SDK (`antioch.module`)
45
+
46
+ The Module SDK is a framework for building Antioch modules in Python. Modules are containerized components that run alongside your simulation, processing sensor data and producing outputs. Each module runs in its own Docker container and communicates with the simulation through the Antioch runtime. Install the SDK in your module's Dockerfile to read sensors, run inference, and publish results.
47
+
48
+ ```python
49
+ from antioch.module import Execution, Module
50
+
51
+ def process_radar(execution: Execution) -> None:
52
+ scan = execution.read_radar("sensor")
53
+ if scan is not None and len(scan.detections) > 0:
54
+ execution.output("detections").set(scan)
55
+
56
+ if __name__ == "__main__":
57
+ module = Module()
58
+ module.register("radar_node", process_radar)
59
+ module.spin()
60
+ ```
61
+
62
+ ### Session SDK (`antioch.session`)
63
+
64
+ The Session SDK is a client library for orchestrating Antioch simulations. Use it from Python scripts or Jupyter notebooks to programmatically build scenes, load assets, spawn robots, control simulation playback, and record data. The Session SDK connects to your Antioch deployment and provides a high-level API for automation and experimentation.
65
+
66
+ ```python
67
+ from antioch.session import Scene, Session, Task, TaskOutcome
68
+
69
+ session = Session()
70
+ scene = Scene()
71
+
72
+ # Load environment and robot
73
+ scene.add_asset(path="/World/environment", name="warehouse", version="1.0.0")
74
+ ark = scene.add_ark(name="my_robot", version="0.1.0")
75
+
76
+ # Run simulation
77
+ task = Task()
78
+ task.start(mcap_path="/tmp/recording.mcap")
79
+
80
+ scene.step(1_000_000) # step 1 second
81
+
82
+ task.finish(outcome=TaskOutcome.SUCCESS)
83
+ ```
84
+
85
+ ## Installation
86
+
87
+ To install in your Python environment:
88
+
89
+ ```bash
90
+ pip install antioch-py
91
+ ```
92
+
93
+ To install in your Python-based Docker image (e.g. for an Antioch module):
94
+
95
+ ```dockerfile
96
+ FROM python:3.12-slim
97
+
98
+ RUN pip install antioch-py
99
+
100
+ COPY . /app
101
+ WORKDIR /app
102
+
103
+ CMD ["python", "module.py"]
104
+ ```
105
+
106
+ ## Documentation
107
+
108
+ Visit [antioch.com](https://antioch.com) for full documentation.
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,105 @@
1
+ # antioch-py
2
+
3
+ The Antioch Python Module SDK for building deterministic robotic modules.
4
+
5
+ ## Overview
6
+
7
+ `antioch-py` provides the Python client library for implementing Antioch modules - the core computational units that run inside Arks. Modules contain nodes that execute callbacks on a deterministic schedule, communicating via tokens.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install antioch-py
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from antioch import Module, Execution
19
+
20
+ def my_callback(execution: Execution) -> None:
21
+ """Process inputs and produce outputs."""
22
+ # Read input data
23
+ input_data = execution.input("sensor_data")
24
+
25
+ # Process data
26
+ result = process(input_data)
27
+
28
+ # Write output
29
+ execution.output("processed", result)
30
+
31
+ # Create and run module
32
+ module = Module()
33
+ module.register("my_node", my_callback)
34
+ module.spin()
35
+ ```
36
+
37
+ ## Key Concepts
38
+
39
+ ### Module
40
+
41
+ The `Module` class is the main entry point for implementing Antioch modules. It handles:
42
+ - Configuration loading from environment (container mode) or explicit parameters (local mode)
43
+ - Node registration and lifecycle management
44
+ - Startup handshake and synchronization
45
+
46
+ ### Node
47
+
48
+ Nodes are the computational units within a module. Each node:
49
+ - Runs in its own thread
50
+ - Executes on a deterministic schedule
51
+ - Receives input tokens and produces output tokens
52
+
53
+ ### Execution
54
+
55
+ The `Execution` object is passed to node callbacks and provides:
56
+ - Access to input data via `input(name)`
57
+ - Output publishing via `output(name, data)`
58
+ - Hardware read/write for simulation mode
59
+ - Logging via `execution.logger`
60
+
61
+ ## Modes of Operation
62
+
63
+ ### Container Mode (Default)
64
+
65
+ When running inside an Ark pod, the module automatically loads configuration from environment variables:
66
+ - `_MODULE_NAME`: Module name
67
+ - `_ARK`: Ark configuration JSON
68
+ - `_ENVIRONMENT`: Execution environment (sim/real)
69
+ - `_DEBUG`: Debug mode flag
70
+
71
+ ### Local Mode
72
+
73
+ For testing and development, provide configuration explicitly:
74
+
75
+ ```python
76
+ from antioch import Module, Environment
77
+
78
+ module = Module(
79
+ module_name="my_module",
80
+ ark=my_ark_config,
81
+ environment=Environment.SIM,
82
+ debug=True,
83
+ )
84
+ ```
85
+
86
+ ## API Reference
87
+
88
+ ### Module
89
+
90
+ - `Module(module_name=None, ark=None, environment=Environment.REAL, debug=False)`: Create a module
91
+ - `register(name, callback)`: Register a node callback
92
+ - `spin()`: Start the module and wait for shutdown
93
+ - `join(timeout=None)`: Wait for all nodes to finish
94
+
95
+ ### Execution
96
+
97
+ - `input(name) -> list[Token]`: Get input tokens for an input
98
+ - `output(name, data)`: Set output data for an output
99
+ - `hardware_read(name) -> bytes`: Read hardware data (sim mode)
100
+ - `hardware_write(name, data)`: Write hardware data (sim mode)
101
+ - `logger`: Logger for telemetry and debugging
102
+
103
+ ## License
104
+
105
+ MIT
@@ -0,0 +1,77 @@
1
+ # antioch-py
2
+
3
+ Python SDK for the [Antioch](https://antioch.com) autonomy simulation platform.
4
+
5
+ ## Overview
6
+
7
+ The antioch-py package provides two components:
8
+
9
+ ### Module SDK (`antioch.module`)
10
+
11
+ The Module SDK is a framework for building Antioch modules in Python. Modules are containerized components that run alongside your simulation, processing sensor data and producing outputs. Each module runs in its own Docker container and communicates with the simulation through the Antioch runtime. Install the SDK in your module's Dockerfile to read sensors, run inference, and publish results.
12
+
13
+ ```python
14
+ from antioch.module import Execution, Module
15
+
16
+ def process_radar(execution: Execution) -> None:
17
+ scan = execution.read_radar("sensor")
18
+ if scan is not None and len(scan.detections) > 0:
19
+ execution.output("detections").set(scan)
20
+
21
+ if __name__ == "__main__":
22
+ module = Module()
23
+ module.register("radar_node", process_radar)
24
+ module.spin()
25
+ ```
26
+
27
+ ### Session SDK (`antioch.session`)
28
+
29
+ The Session SDK is a client library for orchestrating Antioch simulations. Use it from Python scripts or Jupyter notebooks to programmatically build scenes, load assets, spawn robots, control simulation playback, and record data. The Session SDK connects to your Antioch deployment and provides a high-level API for automation and experimentation.
30
+
31
+ ```python
32
+ from antioch.session import Scene, Session, Task, TaskOutcome
33
+
34
+ session = Session()
35
+ scene = Scene()
36
+
37
+ # Load environment and robot
38
+ scene.add_asset(path="/World/environment", name="warehouse", version="1.0.0")
39
+ ark = scene.add_ark(name="my_robot", version="0.1.0")
40
+
41
+ # Run simulation
42
+ task = Task()
43
+ task.start(mcap_path="/tmp/recording.mcap")
44
+
45
+ scene.step(1_000_000) # step 1 second
46
+
47
+ task.finish(outcome=TaskOutcome.SUCCESS)
48
+ ```
49
+
50
+ ## Installation
51
+
52
+ To install in your Python environment:
53
+
54
+ ```bash
55
+ pip install antioch-py
56
+ ```
57
+
58
+ To install in your Python-based Docker image (e.g. for an Antioch module):
59
+
60
+ ```dockerfile
61
+ FROM python:3.12-slim
62
+
63
+ RUN pip install antioch-py
64
+
65
+ COPY . /app
66
+ WORKDIR /app
67
+
68
+ CMD ["python", "module.py"]
69
+ ```
70
+
71
+ ## Documentation
72
+
73
+ Visit [antioch.com](https://antioch.com) for full documentation.
74
+
75
+ ## License
76
+
77
+ MIT
@@ -0,0 +1,101 @@
1
+ from antioch.clock import Clock
2
+ from antioch.execution import Execution
3
+ from antioch.input import NodeInputBuffer
4
+ from antioch.module import Module
5
+ from antioch.node import Node
6
+ from common.ark import Environment
7
+ from common.ark.token import Token, TokenType
8
+ from common.message import (
9
+ Array,
10
+ Bool,
11
+ CameraInfo,
12
+ CircleAnnotation,
13
+ Color,
14
+ DeserializationError,
15
+ Float,
16
+ FrameTransform,
17
+ FrameTransforms,
18
+ Image,
19
+ ImageAnnotations,
20
+ ImageEncoding,
21
+ Int,
22
+ JointState,
23
+ JointStates,
24
+ JointTarget,
25
+ JointTargets,
26
+ Log,
27
+ LogLevel,
28
+ Message,
29
+ MessageError,
30
+ MismatchError,
31
+ Point2,
32
+ Point3,
33
+ PointCloud,
34
+ PointsAnnotation,
35
+ PointsAnnotationType,
36
+ Pose,
37
+ Quaternion,
38
+ RadarScan,
39
+ SerializationError,
40
+ String,
41
+ TextAnnotation,
42
+ Vector2,
43
+ Vector3,
44
+ )
45
+
46
+ __all__ = [
47
+ # Core
48
+ "Clock",
49
+ "Environment",
50
+ "Execution",
51
+ "Module",
52
+ "Node",
53
+ "NodeInputBuffer",
54
+ "Token",
55
+ "TokenType",
56
+ # Base types
57
+ "Message",
58
+ "MessageError",
59
+ "DeserializationError",
60
+ "SerializationError",
61
+ "MismatchError",
62
+ # Primitive types
63
+ "Array",
64
+ "Bool",
65
+ "Float",
66
+ "Int",
67
+ "String",
68
+ # Geometry types
69
+ "Point2",
70
+ "Point3",
71
+ "Vector2",
72
+ "Vector3",
73
+ "Pose",
74
+ "Quaternion",
75
+ # Color
76
+ "Color",
77
+ # Camera types
78
+ "CameraInfo",
79
+ "Image",
80
+ "ImageEncoding",
81
+ # Joint types
82
+ "JointState",
83
+ "JointStates",
84
+ "JointTarget",
85
+ "JointTargets",
86
+ # Sensor types
87
+ "RadarScan",
88
+ "PointCloud",
89
+ # Logging
90
+ "Log",
91
+ "LogLevel",
92
+ # Annotations
93
+ "CircleAnnotation",
94
+ "ImageAnnotations",
95
+ "PointsAnnotation",
96
+ "PointsAnnotationType",
97
+ "TextAnnotation",
98
+ # Frame transforms
99
+ "FrameTransform",
100
+ "FrameTransforms",
101
+ ]
@@ -0,0 +1,62 @@
1
+ import time
2
+ from threading import Event
3
+
4
+ from common.utils.time import now_us
5
+
6
+
7
+ class Clock:
8
+ """
9
+ Real-time clock for LET-to-wall-time mapping (real mode only).
10
+
11
+ Maps logical execution time to wall-clock time using a fixed start time.
12
+ Provides precise timing for real-mode execution to avoid clock drift.
13
+ """
14
+
15
+ def __init__(self, start_timestamp_us: int, event: Event | None = None):
16
+ """
17
+ Create a new real-time clock.
18
+
19
+ :param start_timestamp_us: Wall-clock time (microseconds since epoch) corresponding to LET=0.
20
+ :param event: Optional event to check for shutdown requests during waits.
21
+ """
22
+
23
+ self._start_timestamp_us = start_timestamp_us
24
+ self._event = event
25
+
26
+ @property
27
+ def let_us(self) -> int:
28
+ """
29
+ Get the current logical time in microseconds.
30
+
31
+ :return: Current logical time.
32
+ """
33
+
34
+ return now_us() - self._start_timestamp_us
35
+
36
+ def wait_until(self, let_us: int) -> bool:
37
+ """
38
+ Sleep until reaching target LET.
39
+
40
+ Checks shutdown event every 100ms. Uses hybrid sleep approach:
41
+ - For waits > 10ms: Sleep in chunks (max 100ms) for shutdown responsiveness
42
+ - For waits < 10ms: Sleep in 100μs increments for precision
43
+
44
+ :param let_us: Target logical execution time in microseconds.
45
+ :return: True if wait completed normally, False if interrupted by event.
46
+ """
47
+
48
+ target_timestamp_us = self._start_timestamp_us + let_us
49
+ while True:
50
+ # Check if we should exit
51
+ current = now_us()
52
+ if current >= target_timestamp_us:
53
+ return True
54
+
55
+ # Check event if provided
56
+ if self._event and self._event.is_set():
57
+ return False
58
+
59
+ # Sleep for chunk
60
+ remaining_us = target_timestamp_us - current
61
+ sleep_us = min(remaining_us, 100_000) if remaining_us > 10_000 else min(remaining_us, 100)
62
+ time.sleep(sleep_us / 1_000_000)