npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@totemsdk/edge-ros2

v0.1.0

Published

Edge runtime adapter for ROS 2 — robotics, DDS middleware, typed topics

Downloads

145

Readme

@totemsdk/edge-ros2

Edge runtime adapter for ROS 2 — robotics, DDS middleware, typed topics.

Install

npm install @totemsdk/edge-ros2

Design

This package does not import rclnodejs, rclcpp, or any ROS 2 client library. All DDS/ROS behaviour is injected via Ros2TransportPort. The package handles topic subscription, service calls, and proof generation.

Quick start

import { createEdgeRuntime, createEdgeDevice, createCapabilitySet } from '@totemsdk/edge';
import { createRos2Gateway, createRos2SensorBridge } from '@totemsdk/edge-ros2';
import type { Ros2TransportPort } from '@totemsdk/edge-ros2';

// 1. Implement Ros2TransportPort (e.g. using rclnodejs)
const transport: Ros2TransportPort = {
  async init(args) { /* initialise ROS 2 context */ },
  async shutdown() { /* shutdown */ },
  async createPublisher(topic, messageType) { /* create publisher */ return { async publish(msg) {}, async destroy() {} }; },
  async createSubscription(topic, messageType, handler) { /* create subscription */ return { async destroy() {} }; },
  async createClient(service, serviceType) { /* create service client */ return { async call(req, timeout) { return { data: new Uint8Array(), type: '', receivedAt: Date.now() }; }, async destroy() {} }; },
  async createService(service, serviceType, handler) { /* create service server */ return { async destroy() {} }; },
  onError(handler) { return () => {}; },
};

// 2. Wire into Edge runtime
const runtime = createEdgeRuntime({
  deviceId: 'ros2-gateway-01',
  capabilities: createCapabilitySet(['transport:ros2', 'proof:create']),
  ports: { /* proof port */ },
});

// 3. Create gateway with topic subscriptions
const gateway = createRos2Gateway({
  runtime,
  transport,
  nodeName: 'totem_edge_node',
  subscriptions: [
    { topic: '/sensors/temperature', messageType: 'sensor_msgs/msg/Temperature', sensorId: 'temp-sensor' },
    { topic: '/odom', messageType: 'nav_msgs/msg/Odometry', sensorId: 'odometry' },
  ],
});
await gateway.start();
// Topic messages are automatically sent to the proof port

// 4. Publish a message
const pub = await gateway.createPublisher('/cmd_vel', 'geometry_msgs/msg/Twist');
await pub.publish({ data: new TextEncoder().encode('...'), type: 'geometry_msgs/msg/Twist', receivedAt: Date.now() });

// 5. Call a service
const result = await gateway.callService('/get_pose', 'nav_msgs/srv/GetPose', { data: new Uint8Array(), type: 'nav_msgs/srv/GetPose_Request', receivedAt: Date.now() });

// 6. Or use the sensor bridge with field extraction
const bridge = createRos2SensorBridge({
  runtime,
  transport,
  gateway,
  bindings: [
    {
      sensorId: 'battery-voltage',
      topic: '/battery_state',
      messageType: 'sensor_msgs/msg/BatteryState',
      dataType: 'voltage',
      unit: 'V',
      fieldExtractor: (msg) => {
        // Extract voltage field from serialised message
        return new DataView(msg.data.buffer).getFloat32(0, true);
      },
    },
  ],
});
await bridge.start();

Transport port

| Method | Description | |--------|-------------| | init(args?) | Initialise ROS 2 context | | shutdown() | Shutdown ROS 2 context | | createPublisher(topic, type) | Create a publisher on a typed topic | | createSubscription(topic, type, handler) | Create a subscription on a typed topic | | createClient(service, type) | Create a service client | | createService(service, type, handler) | Create a service server | | onError(handler) | Register handler for node errors |

Capabilities

  • transport:ros2 — required for ROS 2 transport

License

MIT