Socket
Socket
Sign inDemoInstall

@foxglove/rosmsg2-serialization

Package Overview
Dependencies
3
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @foxglove/rosmsg2-serialization

ROS 2 (Robot Operating System) message serialization, for reading and writing bags and network messages


Version published
Weekly downloads
476
decreased by-23.23%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

@foxglove/rosmsg2-serialization

ROS 2 (Robot Operating System) message serialization, for reading and writing bags and network messages

npm version

MessageReader

Message reader deserializes ROS 2 CDR messages into plain objects. The messages are fully deserialized.

import { MessageReader } from "@foxglove/rosmsg2-serialization";

// message definition comes from `parse()` in @foxglove/rosmsg
const reader = new MessageReader(messageDefinition);

// deserialize a buffer into an object
const message = reader.readMessage([0x00, 0x01, ...]);

// access message fields
message.header.stamp;

MessageWriter

Convert an object, array, or primitive value into binary data using ROS 2 CDR message serialization.

import { MessageWriter } from "@foxglove/rosmsg2-serialization";

// message definition comes from `parse()` in @foxglove/rosmsg
const writer = new MessageWriter(pointStampedMessageDefinition);

// serialize the passed in object to a Uint8Array as a geometry_msgs/PointStamped message
const uint8Array = writer.writeMessage({
  header: {
    stamp: { sec: 0, nanosec: 0 },
    frame_id: ""
  },
  x: 1,
  y: 0,
  z: 0
});

Test

yarn test

License

@foxglove/rosmsg2-serialization is licensed under the MIT License.

Releasing

  1. Run yarn version --[major|minor|patch] to bump version
  2. Run git push && git push --tags to push new tag
  3. GitHub Actions will take care of the rest

Stay in touch

Join our Slack channel to ask questions, share feedback, and stay up to date on what our team is working on.

Keywords

FAQs

Last updated on 24 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc