Skip to main content

Ros2TransportPort

@totemsdk/edge-ros2


@totemsdk/edge-ros2 / Ros2TransportPort

Interface: Ros2TransportPort

ROS 2 transport port — injected by the caller.

ROS 2 uses DDS (Data Distribution Service) middleware for discovery, publish/subscribe, and service calls. The caller provides the DDS implementation (eProsima Fast DDS, Cyclone DDS, or rmw layer).

Methods​

createClient()​

createClient(service, serviceType): Promise<Ros2Client>

Create a service client.

Parameters​

service​

string

serviceType​

string

Returns​

Promise<Ros2Client>


createPublisher()​

createPublisher(topic, messageType): Promise<Ros2Publisher>

Create a publisher on a typed topic.

Parameters​

topic​

string

messageType​

string

Returns​

Promise<Ros2Publisher>


createService()​

createService(service, serviceType, handler): Promise<Ros2Server>

Create a service server.

Parameters​

service​

string

serviceType​

string

handler​

(request) => Promise<Ros2Message>

Returns​

Promise<Ros2Server>


createSubscription()​

createSubscription(topic, messageType, handler): Promise<Ros2Subscription>

Create a subscription on a typed topic.

Parameters​

topic​

string

messageType​

string

handler​

(msg) => void

Returns​

Promise<Ros2Subscription>


init()​

init(args?): Promise<void>

Initialise the ROS 2 context.

Parameters​

args?​

string[]

Returns​

Promise<void>


onError()​

onError(handler): () => void

Register handler for node errors.

Parameters​

handler​

(err) => void

Returns​

() => void


shutdown()​

shutdown(): Promise<void>

Shutdown the ROS 2 context.

Returns​

Promise<void>