Package Exports
- @lichtblick/rosmsg2-serialization
- @lichtblick/rosmsg2-serialization/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lichtblick/rosmsg2-serialization) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@lichtblick/rosmsg2-serialization
ROS 2 (Robot Operating System) message serialization, for reading and writing bags and network messages
MessageReader
Message reader deserializes ROS 2 CDR messages into plain objects. The messages are fully deserialized.
import { MessageReader } from "@lichtblick/rosmsg2-serialization";
// message definition comes from `parse()` in @lichtblick/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 "@lichtblick/rosmsg2-serialization";
// message definition comes from `parse()` in @lichtblick/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
@lichtblick/rosmsg2-serialization is licensed under the MIT License.
Releasing
- Run
yarn version --[major|minor|patch]to bump version - Run
git push && git push --tagsto push new tag - GitHub Actions will take care of the rest