pamoja-sim
Noisy and replay sensors, a recording actuator, and a simulated robot that dead-reckons its pose. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
pip install pamoja-sim
from pamoja import sim
This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.
Example
The script the test suite runs, spliced here as it ran.
From bindings/python/guides/sim.py:
import asyncio
from pamoja.sim import RecordingActuator, Replay, SimulatedRobot
async def main() -> None:
# The clear distance ahead, in meters, taken from an earlier survey run. A replay hands
# it back one reading at a time, so the loop below sees the same input on every run: the
# same rover code, driven by a recording rather than a range finder.
capture = [4.0, 3.0, 1.5, 0.5]
ahead = Replay(capture)
throttle = RecordingActuator()
rover = SimulatedRobot(0.5) # each command advances the rover half a second
seen = []
for _ in capture:
reading = await ahead.read()
seen.append(reading)
# Drive on while there is room ahead, otherwise stop and turn on the spot.
clear = reading > 1.0
speed = 1.0 if clear else 0.0
turn = 0.0 if clear else 1.0
await throttle.apply(speed)
await rover.apply(vx=speed, omega=turn)
print(f"{reading} m ahead, so drive at {speed} and turn at {turn}")
# The recording actuator kept every command, which is how a test says what the control
# loop decided rather than only what it ended up doing.
commands = await throttle.commands()
print(f"commands {commands}")
# Three half-second commands at 1 m/s reach 1.5 m along x. The last one turns on the
# spot at 1 rad/s for half a second, which moves the rover nowhere.
pose = await rover.pose()
print(f"pose x {pose.x:.1f} m, y {pose.y:.1f} m, heading {pose.theta:.1f} rad")
return seen, commands, pose
seen, commands, pose = asyncio.run(main())
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-sim |
reference, docs.rs, install |
| TypeScript | @pamoja/sim |
reference, install |
| Python | pamoja-sim |
reference, install |
| C# | Pamoja.Sim |
reference, install |
Documentation
pamoja.simreference, every class and function in this module.- The Simulators guide, with the same example in Rust, TypeScript, and C#.
- Every capability, and the install page.
License
MIT
Release files for pamoja-sim 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pamoja_sim-0.1.18.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pamoja_sim-0.1.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / pamoja_sim-0.1.18.tar.gz
| Download URL | pamoja_sim-0.1.18.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
805e348e815734006d44a54ef496c5423cc3c03942b539151d213e7573813d95
|
|
BLAKE2b-256 checksum How to use checksums |
a3bd125006d311509da2cb81c6c8f0489daac579623359a709b09b280af8107b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / pamoja_sim-0.1.18-py3-none-any.whl
| Download URL | pamoja_sim-0.1.18-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
997a21413c75697aa026a88342b4168937eb44827be556304abcbf0e9d9d0893
|
|
BLAKE2b-256 checksum How to use checksums |
f9d7b3cf268744652ca953266baed22d8155ae58ad242a5b7659ef11dde23e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|