@gov.nasa.jpl.honeycomb/rosbag-loader
v0.0.6
Published
Loader and parser for processing rosbag files.
Readme
rosbag-loader
Loader for loading and parsing ROS Bag files using the rosbag package.
!> Note that only lz4 decompression is implemented when reading compressed Rosbags.
!> Note that for the moment RosbagLoader always uses the browser implementation of rosbag.js. See #439
Use
Functions
load
load( url : String, options : ReaderOptions | null = null ) : Map | Array | RosbagReaderLoads and parses the ROS bag file. The promise resolves with the returned data from the parse function.
parse
parse( data : Blob, options : ReaderOptions | null = null ) : Map | Array | RosbagReaderTakes a file handle blob to read and a set of options to read the messages with. If readAllData is
false a RosbagReader instance is returned otherwise all frames are read and returned. See the
#RosbagReader#read for a description of the returned data.
ReaderOptions
flattenState
flattenState : Boolean = falseIf true the hierarchy of objects is flattened into a single object with the flattenDelimiter separating
object children.
flattenDelimiter
flattenDelimiter : String = '_'The character to use to separate nested object names when flattening the object state.
indexTransform
indexTransform : Boolean = trueIf true the transform object in the "/tf" and "/tf_static" messages are converted from an array in to an
object indexed by child_frame_id:
{
transforms: [
{ child_frame_id: 'base_link', transform: { ... } },
{ child_frame_id: 'world', transform: { ... } }
]
}
// into
{
transforms: {
'base_link': { child_frame_id: 'base_link', transform: { ... } },
'world': { child_frame_id: 'world', transform: { ... } }
}
}
readAllData
readAllData : Boolean = trueIf true the full list of Rosbag data will be returned from the reader in the callback. Otherwise a RosbagReader handle will be returned so data can be read as needed.
normalizeTopicNames
normalizeTopicNames : Boolean = trueIf true all topic names are normalized to be prefixed with a / the way roslibjs
registers them over websocket. If false some topic name may not be prefixed with slashes.
separateTopicArrays
separateTopicArrays : Boolean = falseIf true all topics are broken out into separate arrays of data in a map. Otherwise a single array of data is returned.
RosbagReader
Class for reading data from the rosbag file.
start
start : NumberThe start time in ms of the rosbag file.
end
end : NumberThe end time in ms of the rosbag file.
messageTypes
messageTypes : ObjectA map from topic name to ROS topic message type.
topics
topics : Array<String>The list of topics available in the given Rosbag.
constructor
constructor( handle : RosbagHandle, options : ReaderOptions ) : voidTakes a handle to the Rosbag.js Bag Instance to read messages from an a set of options to use when reading messages.
read
read( from : Number, to : Number, options : ReaderOptions ) : Promise<Object | Array>Takes a from time and and to time in milliseconds and returns the set of data between those times. A set of options can be provided to override the set of options originally passed into the reader. Options from rosbag.js cannot be overriden here.
The shape of the returned data depends on the separateTopicArrays. If true then a map of topic name
to array of frames of data is returned:
{
'/tf' : [ ... ],
'/tf_static' : [ ... ],
'/markers' : [ ... ],
}Otherwise an array of frames is returned. A frame consists of a time field in ms and state field which
contains the ros topic message contents:
{
time: number,
state: {
//...
}
}