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

@altara/ros

v0.1.1

Published

ROS2 rosbridge adapter for React — pipe live sensor_msgs/* topics (IMU, GPS, battery, range, temperature) into real-time Altara dashboards. Typed factories, auto-reconnect, ROS timestamp normalization.

Readme

@altara/ros

ROS2 rosbridge adapter for Altara. Subscribe to a ROS2 topic from React in one line and pipe live samples (IMU, GPS, battery, range, temperature, ...) into any @altara/core component. Built for robotics dashboards, drone ground stations, and rover monitoring UIs.

npm version bundle size types included license

Install

npm install @altara/core @altara/ros

You'll also need rosbridge_suite running on your robot (or in a Docker container during development):

ros2 launch rosbridge_server rosbridge_websocket_launch.xml
# → ws://localhost:9090

Quick start

import { AltaraProvider, TimeSeries } from '@altara/core';
import { createRosbridgeAdapter } from '@altara/ros';

const source = createRosbridgeAdapter({
  url: 'ws://localhost:9090',
  topic: '/imu/data',
  messageType: 'sensor_msgs/Imu',
  valueExtractor: (msg) => msg.angular_velocity.z,
});

export function App() {
  return (
    <AltaraProvider theme="dark">
      <TimeSeries dataSource={source} height={240} />
    </AltaraProvider>
  );
}

What you get

createRosbridgeAdapter handles:

  • rosbridge v2 envelope ({ op: 'subscribe', topic, type }) on connect
  • Auto-reconnect with exponential backoff (1 s → 30 s)
  • ROS header.stamp.{sec, nanosec} → unix milliseconds normalization
  • Optional throttleMs to drop samples that arrive faster than you want to render
  • Three timestamp modes ('wallclock' / 'message' / 'relative')
  • Cleanup on destroy() including the unsubscribe envelope

Typed convenience factories

For common ROS message types, skip the messageType + valueExtractor boilerplate:

| Factory | Message type | Extracted value | | --- | --- | --- | | createBatteryStateAdapter | sensor_msgs/BatteryState | percentage * 100 (voltage fallback — see below) | | createRangeAdapter | sensor_msgs/Range | range (m) | | createTemperatureAdapter | sensor_msgs/Temperature | temperature (°C) | | createNavSatFixAdapter({ axis }) | sensor_msgs/NavSatFix | latitude / longitude / altitude | | createImuAdapter | sensor_msgs/Imu | { roll, pitch, yaw } in degrees (see below) | | createFloat32Adapter | std_msgs/Float32 | data | | createFloat64Adapter | std_msgs/Float64 | data |

import { createBatteryStateAdapter } from '@altara/ros';

const battery = createBatteryStateAdapter({
  url: 'ws://localhost:9090',
  topic: '/battery',
});
// hand to any component that takes `dataSource={…}`

Battery state of charge with a voltage fallback

PX4 and ArduPilot publish BatteryState.percentage as -1 (or NaN) when the firmware has no fuel-gauge estimate — the common case on a bare LiPo pack. By default that sample is dropped and the gauge stays blank. Pass a voltageRange to derive an estimate from voltage instead:

const battery = createBatteryStateAdapter({
  url: 'ws://localhost:9090',
  topic: '/mavros/battery',
  voltageRange: { min: 14.0, max: 16.8 }, // 4S LiPo (3.5–4.2 V/cell)
});

⚠️ The voltage→charge map is a clamped linear approximation. A LiPo's discharge curve is non-linear, so treat this as presence-of-charge (is there juice left?), not an accurate range-remaining percentage. A valid percentage from the firmware always takes precedence.

Multi-channel sources & the PFD

A flight display needs several signals at once (roll, pitch, heading, airspeed, altitude). Two helpers make that one coherent dataSource:

  • channels — pass a { name: extractor } map to createRosbridgeAdapter (or use createImuAdapter) to pull several numbers from one message over one socket. Returns { [name]: AltaraDataSource }.
  • mergeChannels — union several single-value sources into one channel-tagged source that a multi-input component routes by channel.

createImuAdapter converts sensor_msgs/Imu.orientation (a quaternion) into { roll, pitch, yaw } degree channels for you (the standalone quaternionToEuler(q) is exported too, clamped at the ±90° poles). Note IMU yaw is heading in the IMU frame, not compass heading — drive the PFD's heading from VFR_HUD.

A full Primary Flight Display wires on two sockets — one IMU, one VFR_HUD:

import { PrimaryFlightDisplay } from '@altara/aerospace';
import { createImuAdapter, createRosbridgeAdapter, mergeChannels } from '@altara/ros';

const imu = createImuAdapter({ url, topic: '/mavros/imu/data' }); // { roll, pitch, yaw }
const hud = createRosbridgeAdapter({
  url,
  topic: '/mavros/vfr_hud',
  messageType: 'mavros_msgs/VFR_HUD',
  channels: {
    heading: (m) => m.heading,
    airspeed: (m) => m.airspeed * 1.94384, // m/s -> kt
    altitude: (m) => m.altitude * 3.28084, // m -> ft
  },
});

const source = mergeChannels({
  roll: imu.roll,
  pitch: imu.pitch,
  heading: hud.heading,
  airspeed: hud.airspeed,
  altitude: hud.altitude,
});

// <PrimaryFlightDisplay dataSource={source} showFlightDirector />

mergeChannels is re-exported from @altara/ros (it lives in @altara/core), so a single import line covers the whole wiring.

Documentation

Or run Storybook locally:

git clone https://github.com/JayaSaiKishanChapparam/altara.git
cd altara
pnpm install
pnpm --filter @altara/storybook storybook

Then open Guides → Connecting ROS2.

Sibling packages

| Package | What it does | | --- | --- | | @altara/core | Components, hooks, MQTT/mock adapters, design tokens. The starting point. | | @altara/aerospace | Flight instruments — PFD, HSI, altimeter, airspeed, VSI, engine cluster, TCAS, TAWS, FMA, fuel gauge, radio altimeter. | | @altara/mqtt | MQTT-over-WebSocket adapter for IoT brokers. |

Links

License

MIT — see LICENSE.