rosbag
Loading data from rosbag topics.
RosbagLoader(path, topics)
Bases: Dataset
Environment to load data from a rosbag file.
The RosbagEnvironment is used to load data from a rosbag file. The environment is initialized with the path to the rosbag file and a dictionary of topics to load.
Example
from flowcean.environments.rosbag import RosbagLoader
environment = RosbagLoader(
path="example_rosbag",
topics={
"/j100_0000/amcl_pose": [
"pose.pose.position.x",
"pose.pose.position.y",
],
"/j100_0000/odometry": [
"pose.pose.position.x",
"pose.pose.position.y",
],
},
)
environment.load()
data = environment.get_data()
print(data)
Initialize the RosbagEnvironment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str | Path
|
Path to the rosbag. |
required |
topics
|
dict[str, list[str]]
|
Dictionary of topics to load ( |
required |
Source code in src/flowcean/environments/rosbag.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
read_timeseries(reader, topic, keys)
Read a timeseries from a rosbag topic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reader
|
AnyReader
|
Rosbag reader. |
required |
topic
|
str
|
Topic name. |
required |
keys
|
Sequence[str]
|
Keys to read from the topic. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Timeseries DataFrame. |
Source code in src/flowcean/environments/rosbag.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|