pamoja-sim 0.1.18__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.
@@ -0,0 +1,13 @@
1
+ # Native extensions are built per platform, not committed.
2
+ *.so
3
+ *.pyd
4
+ *.dylib
5
+
6
+ # Build and packaging output.
7
+ dist/
8
+ wheels/
9
+ target/
10
+
11
+ # Local virtual environments.
12
+ .venv/
13
+ venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anthony Wiedman
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,106 @@
1
+ Metadata-Version: 2.5
2
+ Name: pamoja-sim
3
+ Version: 0.1.18
4
+ Summary: Noisy and replay sensors, a recording actuator, and a simulated robot that dead-reckons its pose.
5
+ Project-URL: Repository, https://github.com/molexxxx/pamoja
6
+ Project-URL: Documentation, https://pamoja.molex.cloud/docs/guides/sim.html
7
+ Author: molexxxx
8
+ License: MIT
9
+ License-File: LICENSE-MIT
10
+ Keywords: iot,pamoja,robotics,sim
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: pamoja-native==0.1.18
17
+ Description-Content-Type: text/markdown
18
+
19
+ # pamoja-sim
20
+
21
+ Noisy and replay sensors, a recording actuator, and a simulated robot that dead-reckons its pose. One capability of [pamoja](https://github.com/molexxxx/pamoja), one memory-safe Rust core with bindings for TypeScript, Python, and C#.
22
+
23
+ [![read the guide](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-guide.svg)](https://pamoja.molex.cloud/docs/guides/sim.html)
24
+ [![documentation](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-docs.svg)](https://pamoja.molex.cloud/docs/)
25
+ [![API reference](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-api.svg)](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html)
26
+
27
+ ## Install
28
+
29
+ ```sh
30
+ pip install pamoja-sim
31
+ ```
32
+
33
+ ```python
34
+ from pamoja import sim
35
+ ```
36
+
37
+ This pulls in `pamoja-native`, the compiled engine. `pip install pamoja` is the whole framework in one package.
38
+
39
+ ## Example
40
+
41
+ The script the test suite runs, spliced here as it ran.
42
+
43
+ From [`bindings/python/guides/sim.py`](https://github.com/molexxxx/pamoja/blob/main/bindings/python/guides/sim.py):
44
+
45
+ ```python
46
+ import asyncio
47
+
48
+ from pamoja.sim import RecordingActuator, Replay, SimulatedRobot
49
+
50
+
51
+ async def main() -> None:
52
+ # The clear distance ahead, in meters, taken from an earlier survey run. A replay hands
53
+ # it back one reading at a time, so the loop below sees the same input on every run: the
54
+ # same rover code, driven by a recording rather than a range finder.
55
+ capture = [4.0, 3.0, 1.5, 0.5]
56
+ ahead = Replay(capture)
57
+ throttle = RecordingActuator()
58
+ rover = SimulatedRobot(0.5) # each command advances the rover half a second
59
+
60
+ seen = []
61
+ for _ in capture:
62
+ reading = await ahead.read()
63
+ seen.append(reading)
64
+
65
+ # Drive on while there is room ahead, otherwise stop and turn on the spot.
66
+ clear = reading > 1.0
67
+ speed = 1.0 if clear else 0.0
68
+ turn = 0.0 if clear else 1.0
69
+ await throttle.apply(speed)
70
+ await rover.apply(vx=speed, omega=turn)
71
+ print(f"{reading} m ahead, so drive at {speed} and turn at {turn}")
72
+
73
+ # The recording actuator kept every command, which is how a test says what the control
74
+ # loop decided rather than only what it ended up doing.
75
+ commands = await throttle.commands()
76
+ print(f"commands {commands}")
77
+
78
+ # Three half-second commands at 1 m/s reach 1.5 m along x. The last one turns on the
79
+ # spot at 1 rad/s for half a second, which moves the rover nowhere.
80
+ pose = await rover.pose()
81
+ print(f"pose x {pose.x:.1f} m, y {pose.y:.1f} m, heading {pose.theta:.1f} rad")
82
+
83
+ return seen, commands, pose
84
+
85
+
86
+ seen, commands, pose = asyncio.run(main())
87
+ ```
88
+
89
+ ## The same capability in every language
90
+
91
+ | Language | Package | Reference |
92
+ | --- | --- | --- |
93
+ | Rust | [`pamoja-sim`](https://crates.io/crates/pamoja-sim) | [reference](https://pamoja.molex.cloud/docs/reference/rust/pamoja_sim/index.html), [docs.rs](https://docs.rs/pamoja-sim), [install](https://pamoja.molex.cloud/docs/reference/rust.html#rust-sim) |
94
+ | TypeScript | [`@pamoja/sim`](https://www.npmjs.com/package/@pamoja/sim) | [reference](https://pamoja.molex.cloud/docs/reference/node/modules/_pamoja_sim.html), [install](https://pamoja.molex.cloud/docs/reference/node.html#node-sim) |
95
+ | Python | [`pamoja-sim`](https://pypi.org/project/pamoja-sim/) | [reference](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html), [install](https://pamoja.molex.cloud/docs/reference/python.html#python-sim) |
96
+ | C# | [`Pamoja.Sim`](https://www.nuget.org/packages/Pamoja.Sim) | [reference](https://pamoja.molex.cloud/docs/reference/dotnet/api/Pamoja.Sim.html), [install](https://pamoja.molex.cloud/docs/reference/dotnet.html#dotnet-sim) |
97
+
98
+ ## Documentation
99
+
100
+ - [`pamoja.sim` reference](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html), every class and function in this module.
101
+ - [The Simulators guide](https://pamoja.molex.cloud/docs/guides/sim.html), with the same example in Rust, TypeScript, and C#.
102
+ - [Every capability](https://pamoja.molex.cloud/docs/), and the [install page](https://pamoja.molex.cloud/docs/install.html).
103
+
104
+ ## License
105
+
106
+ MIT
@@ -0,0 +1,88 @@
1
+ # pamoja-sim
2
+
3
+ Noisy and replay sensors, a recording actuator, and a simulated robot that dead-reckons its pose. One capability of [pamoja](https://github.com/molexxxx/pamoja), one memory-safe Rust core with bindings for TypeScript, Python, and C#.
4
+
5
+ [![read the guide](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-guide.svg)](https://pamoja.molex.cloud/docs/guides/sim.html)
6
+ [![documentation](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-docs.svg)](https://pamoja.molex.cloud/docs/)
7
+ [![API reference](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-api.svg)](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html)
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ pip install pamoja-sim
13
+ ```
14
+
15
+ ```python
16
+ from pamoja import sim
17
+ ```
18
+
19
+ This pulls in `pamoja-native`, the compiled engine. `pip install pamoja` is the whole framework in one package.
20
+
21
+ ## Example
22
+
23
+ The script the test suite runs, spliced here as it ran.
24
+
25
+ From [`bindings/python/guides/sim.py`](https://github.com/molexxxx/pamoja/blob/main/bindings/python/guides/sim.py):
26
+
27
+ ```python
28
+ import asyncio
29
+
30
+ from pamoja.sim import RecordingActuator, Replay, SimulatedRobot
31
+
32
+
33
+ async def main() -> None:
34
+ # The clear distance ahead, in meters, taken from an earlier survey run. A replay hands
35
+ # it back one reading at a time, so the loop below sees the same input on every run: the
36
+ # same rover code, driven by a recording rather than a range finder.
37
+ capture = [4.0, 3.0, 1.5, 0.5]
38
+ ahead = Replay(capture)
39
+ throttle = RecordingActuator()
40
+ rover = SimulatedRobot(0.5) # each command advances the rover half a second
41
+
42
+ seen = []
43
+ for _ in capture:
44
+ reading = await ahead.read()
45
+ seen.append(reading)
46
+
47
+ # Drive on while there is room ahead, otherwise stop and turn on the spot.
48
+ clear = reading > 1.0
49
+ speed = 1.0 if clear else 0.0
50
+ turn = 0.0 if clear else 1.0
51
+ await throttle.apply(speed)
52
+ await rover.apply(vx=speed, omega=turn)
53
+ print(f"{reading} m ahead, so drive at {speed} and turn at {turn}")
54
+
55
+ # The recording actuator kept every command, which is how a test says what the control
56
+ # loop decided rather than only what it ended up doing.
57
+ commands = await throttle.commands()
58
+ print(f"commands {commands}")
59
+
60
+ # Three half-second commands at 1 m/s reach 1.5 m along x. The last one turns on the
61
+ # spot at 1 rad/s for half a second, which moves the rover nowhere.
62
+ pose = await rover.pose()
63
+ print(f"pose x {pose.x:.1f} m, y {pose.y:.1f} m, heading {pose.theta:.1f} rad")
64
+
65
+ return seen, commands, pose
66
+
67
+
68
+ seen, commands, pose = asyncio.run(main())
69
+ ```
70
+
71
+ ## The same capability in every language
72
+
73
+ | Language | Package | Reference |
74
+ | --- | --- | --- |
75
+ | Rust | [`pamoja-sim`](https://crates.io/crates/pamoja-sim) | [reference](https://pamoja.molex.cloud/docs/reference/rust/pamoja_sim/index.html), [docs.rs](https://docs.rs/pamoja-sim), [install](https://pamoja.molex.cloud/docs/reference/rust.html#rust-sim) |
76
+ | TypeScript | [`@pamoja/sim`](https://www.npmjs.com/package/@pamoja/sim) | [reference](https://pamoja.molex.cloud/docs/reference/node/modules/_pamoja_sim.html), [install](https://pamoja.molex.cloud/docs/reference/node.html#node-sim) |
77
+ | Python | [`pamoja-sim`](https://pypi.org/project/pamoja-sim/) | [reference](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html), [install](https://pamoja.molex.cloud/docs/reference/python.html#python-sim) |
78
+ | C# | [`Pamoja.Sim`](https://www.nuget.org/packages/Pamoja.Sim) | [reference](https://pamoja.molex.cloud/docs/reference/dotnet/api/Pamoja.Sim.html), [install](https://pamoja.molex.cloud/docs/reference/dotnet.html#dotnet-sim) |
79
+
80
+ ## Documentation
81
+
82
+ - [`pamoja.sim` reference](https://pamoja.molex.cloud/docs/reference/python/pamoja/sim.html), every class and function in this module.
83
+ - [The Simulators guide](https://pamoja.molex.cloud/docs/guides/sim.html), with the same example in Rust, TypeScript, and C#.
84
+ - [Every capability](https://pamoja.molex.cloud/docs/), and the [install page](https://pamoja.molex.cloud/docs/install.html).
85
+
86
+ ## License
87
+
88
+ MIT
@@ -0,0 +1,22 @@
1
+ """Idiomatic simulated-device facade.
2
+
3
+ Drive a whole node with no hardware attached: a sensor that drifts, a replay of a
4
+ real capture, an actuator that records what it was told, and a robot that moves
5
+ only in arithmetic. A lossy link is `Transport.degraded`, since it wraps a
6
+ transport rather than standing alone.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from pamoja._native import Pose, RecordingActuatorHandle, Replay, SimulatedRobot, SimulatedSensor
12
+
13
+ __all__ = [
14
+ "Pose",
15
+ "RecordingActuator",
16
+ "Replay",
17
+ "SimulatedRobot",
18
+ "SimulatedSensor",
19
+ ]
20
+
21
+ #: An actuator that records every command instead of acting on one.
22
+ RecordingActuator = RecordingActuatorHandle
File without changes
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pamoja-sim"
7
+ version = "0.1.18"
8
+ description = "Noisy and replay sensors, a recording actuator, and a simulated robot that dead-reckons its pose."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ license-files = ["LICENSE-MIT"]
12
+ requires-python = ">=3.10"
13
+ authors = [{ name = "molexxxx" }]
14
+ keywords = ["pamoja", "iot", "robotics", "sim"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Typing :: Typed",
20
+ ]
21
+ dependencies = [
22
+ "pamoja-native==0.1.18",
23
+ ]
24
+
25
+ [project.urls]
26
+ Repository = "https://github.com/molexxxx/pamoja"
27
+ Documentation = "https://pamoja.molex.cloud/docs/guides/sim.html"
28
+
29
+ [tool.hatch.build.targets.wheel]
30
+ packages = ["pamoja"]