Tagging
Tagging provides a way for users to augment log data with easy-to-use labels. Tags are always assigned to one, and only one, log as well as one, and only one, label. Tags can optionally be assigned to a specific topic within the assigned log. Tags can be given a start time and end time representating a range of time for which the tag applies, a start time representating a specific instant in time in which a tag applies, or no time at all which represents that a tag applies to the entirety of the log.
Tutorial: Tagging Based on Record Query Data
Tags work well in combination with record querying in that record querying allows you to find interesting points-in-time in your logs and tags can be used to mark those points-in-time. This tutorial will show you how to use LogQS to tag interesting points-in-time in your logs based on record query data.
1. Fetch a Topic with Records We’re Interested In
Here, we assume we have a specific log in mind and are interesting in querying the record’s for the log’s IMU data:
imu_topic = lqs.list.topic(
log_id=log_id,
type_name="sensor_msgs/Imu",
).data[0]
2. Query for Records in the Topic
Next, we find all the records in the topic which meet specific criteria. In this case, we’re finding all IMU records where the linear acceleration in the z direction is less than -18.0 m/s^2.
res = lqs.list.record(
topic_id=imu_topic.id,
query_data_filter={
"var": "linear_acceleration.z",
"op": "<",
"val": -18.0,
}
)
print(f"Found {res.count} records matching the query.")
>> Found 7 records matching the query.
records = res.data
3. Fetch the Label we Want to Use
We assume the label already exists, so we fetch it by its value.
label = lqs.list.label(value="Extreme Vertical Acceleration").data[0]