pamoja-ros2
ROS 2 names, RIHS01 type hashes, CDR encoding, and rmw_zenoh key assembly, with no ROS 2 installed. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
pip install pamoja-ros2
from pamoja import ros2
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/ros2.py:
from pamoja.ros2 import EntityKind, dds_topic, dds_type_name, is_fully_qualified, is_valid_name
# A name is slash-separated tokens of letters, digits, and underscores. A token may not start
# with a digit, and a name may not end in a slash, hold an empty token, or double an
# underscore.
camera = "/robot1/camera_left/image_raw"
if is_valid_name(camera):
print(f"valid {camera}")
for name, why in [
("/2foo", "a token starts with a digit"),
("/cmd_vel/", "it ends in a slash"),
("/robot1//odom", "it has an empty token"),
("/robot1/cmd__vel", "it doubles an underscore"),
]:
if not is_valid_name(name):
print(f"invalid {name}, since {why}")
# A name with no leading slash is relative, and one that starts with a tilde is private. Both
# are valid, and both resolve against the node before they reach the wire, so neither is
# fully qualified.
for label, name, against in [
("relative", "cmd_vel", "the node's namespace"),
("private", "~/setpoint", "the node's own name"),
]:
if is_valid_name(name) and not is_fully_qualified(name):
print(f"{label:<10}{name} is valid, and resolves against {against} first")
# Only a fully qualified name reaches the wire. DDS puts a prefix before it that says what
# kind of endpoint it is, and a service travels on two topics, each ending in the suffix the
# middleware appends.
published = dds_topic("/robot1/cmd_vel", EntityKind.TOPIC)
asked = dds_topic("/robot1/add_two_ints", EntityKind.SERVICE_REQUEST)
answered = dds_topic("/robot1/add_two_ints", EntityKind.SERVICE_RESPONSE)
print(f"topic /robot1/cmd_vel travels on {published}")
print(f"request /robot1/add_two_ints asks on {asked}")
print(f"reply and answers on {answered}")
# A message type maps to a DDS type name the same way, so both ends agree on what is carried
# before a byte is exchanged. A name that is not package/namespace/Type maps to nothing rather
# than to something plausible.
for ros_type in ["std_msgs/msg/String", "example_interfaces/srv/AddTwoInts", "std_msgs/String"]:
carried = dds_type_name(ros_type)
if carried is not None:
print(f"type {ros_type} is named {carried}")
else:
print(f"malformed {ros_type} is not package/namespace/Type, so it has no DDS type name")
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-ros2 |
reference, docs.rs, install |
| TypeScript | @pamoja/ros2 |
reference, install |
| Python | pamoja-ros2 |
reference, install |
| C# | Pamoja.Ros2 |
reference, install |
Documentation
pamoja.ros2reference, every class and function in this module.- The ROS 2 rules guide, with the same example in Rust, TypeScript, and C#.
- Every capability, and the install page.
License
MIT
Release files for pamoja-ros2 0.2.0
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_ros2-0.2.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pamoja_ros2-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / pamoja_ros2-0.2.0.tar.gz
| Download URL | pamoja_ros2-0.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b004f1fd6d300ca24ba25111c3d5b60973d7ba83bbad99805abc2ada5e377be
|
|
BLAKE2b-256 checksum How to use checksums |
80ff8b7697e7dfa7a244191f64a8cd12590dec247da05a1bec2eae9632bab31a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / pamoja_ros2-0.2.0-py3-none-any.whl
| Download URL | pamoja_ros2-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b3dae7e174dda4b3f771bce616d96cc471c9268cbf10a83733d88751ed47cfe
|
|
BLAKE2b-256 checksum How to use checksums |
c68c85d3b446ee0c4353f3065ed7ce31a1b605f18cee1e2f3647923005e9aeb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|