@lichtblick/rosmsg-serialization
ROS1 (Robot Operating System) message serialization, for reading and writing bags and network messages
MessageReader
Message reader deserializes ROS messages into plain objects. The messages are fully deserialized.
import { MessageReader } from "@lichtblick/rosmsg-serialization";
const reader = new MessageReader(messageDefinition);
const message = reader.readMessage([0x00, 0x00, ...]);
message.header.stamp;
LazyMessage
Lazy messages provide on-demand access and deserialization to fields of a serialized ROS message. Creating
a lazy message from a buffer performs no de-serialization during creation. Only accessed fields are
deserialized; the deserialization occurs at access time.
import { LazyMessageReader } from "@lichtblick/rosmsg-serialization";
const reader = new LazyMessageReader(messageDefinition);
const message = reader.readMessage([0x00, 0x00, ...]);
message.header.stamp;
MessageWriter
Convert an object, array, or primitive value into binary data using ROS message serialization.
import { MessageWriter } from "@lichtblick/rosmsg-serialization";
const writer = new MessageWriter(pointStampedMessageDefinition);
const uint8Array = writer.writeMessage({
header: {
seq: 0,
stamp: { sec: 0, nsec: 0 },
frame_id: ""
},
x: 1,
y: 0,
z: 0
});
Test
yarn test
License
@lichtblick/rosmsg-serialization is licensed under the MIT License.
Releasing
- Run
yarn version --[major|minor|patch]
to bump version - Run
git push && git push --tags
to push new tag - GitHub Actions will take care of the rest
Benchmarks
The bench
folder contains benchmarks. Run with:
yarn bench
yarn bench:benny
To run benchmarks in web:
yarn bench:web