Table of Contents

Class Ros2

Namespace
Pamoja.Ros2
Assembly
Pamoja.Ros2.dll

The ROS 2 naming and encoding rules, none of which need a ROS installation.

public static class Ros2
Inheritance
Ros2
Inherited Members

Remarks

A gateway written in C# can validate a name, derive the DDS topic and the Zenoh key an rmw_zenoh peer subscribes on, and encode a geometry_msgs/msg/Twist with no ROS distribution anywhere near it. Driving a live graph does need one, so that stays in the Rust crate.

Methods

DdsTopic(string, EntityKind)

Returns the DDS topic a fully qualified name maps onto.

public static string? DdsTopic(string fqn, EntityKind kind)

Parameters

fqn string

The fully qualified name.

kind EntityKind

Which subsystem the name belongs to.

Returns

string

The DDS topic, or null if the name is not fully qualified.

DdsTypeName(string)

Returns the DDS type name an interface type maps onto.

public static string? DdsTypeName(string rosType)

Parameters

rosType string

The interface type as package/namespace/Type.

Returns

string

The DDS type name, or null if the type is not valid.

EntityKey(uint, string, string, string)

Builds the Zenoh key an rmw_zenoh peer publishes an entity on.

public static string? EntityKey(uint domainId, string fqn, string rosType, string typeHash)

Parameters

domainId uint

The ROS 2 domain.

fqn string

The fully qualified entity name.

rosType string

The interface type as package/namespace/Type.

typeHash string

The message type hash as its RIHS01_ string.

Returns

string

The key, or null if the name, type, or hash is not usable.

IsFullyQualified(string)

Reports whether a name resolves with no namespace applied.

public static bool IsFullyQualified(string name)

Parameters

name string

The candidate name.

Returns

bool

true when the name is fully qualified.

IsValidName(string)

Reports whether a string is a valid ROS 2 topic or service name.

public static bool IsValidName(string name)

Parameters

name string

The candidate name.

Returns

bool

true when the name obeys the ROS 2 rules.

PercentMangle(string)

Percent-mangles a name the way a DDS partition requires.

public static string PercentMangle(string name)

Parameters

name string

The name to mangle.

Returns

string

The mangled name.

PrefixFor(EntityKind)

Returns the DDS topic prefix a subsystem uses.

public static string PrefixFor(EntityKind kind)

Parameters

kind EntityKind

The subsystem.

Returns

string

rt, rq, or rr.

TwistFromCdr(ReadOnlySpan<byte>)

Decodes a twist from its CDR representation.

public static Ros2Twist? TwistFromCdr(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

The encoded bytes.

Returns

Ros2Twist?

The command, or null if the bytes are not a well-formed twist.

TwistToCdr(Ros2Twist)

Encodes a twist into its CDR representation.

public static byte[] TwistToCdr(Ros2Twist twist)

Parameters

twist Ros2Twist

The command to encode.

Returns

byte[]

The encoded bytes.

TypeHashDigest(string)

Returns the 32-byte digest a RIHS01 hash string carries.

public static byte[]? TypeHashDigest(string text)

Parameters

text string

The hash as its RIHS01_ string.

Returns

byte[]

The digest, or null if the string is malformed.