15 def main(bagfile, topic):
16 if not bagfile.exists():
17 print(f
"Bagfile {bagfile} does not exist")
19 if not bagfile.suffix ==
".mcap":
20 print(f
"Bagfile {bagfile} is not an MCAP file")
24 for msg
in tqdm(read_ros2_messages(source=
str(bagfile), topics=[topic])):
28 prev_msg.ros_msg.stamp, msg.ros_msg.stamp
33 for i
in range(len(msg.ros_msg.sensors)):
35 prev_msg.ros_msg.sensors[i].header.stamp, msg.ros_msg.sensors[i].header.stamp
37 row_info[f
"sensor_{i}_average_deviation"] = np.abs(
38 np.array(prev_msg.ros_msg.sensors[i].data.data)
39 - np.array(msg.ros_msg.sensors[i].data.data)
41 row_info[f
"sensor_{i}_data_valid"] = np.uint8(
43 np.sum(msg.ros_msg.sensors[i].data.data)
44 - msg.ros_msg.sensors[i].data.data[-1],
45 msg.ros_msg.sensors[i].data.data[-1],
48 mcap_summary.append(row_info)
50 mcap_summary = pd.DataFrame(mcap_summary)
51 print(mcap_summary.describe())
52 pyperclip.copy(mcap_summary.describe().to_markdown())
str
Definition: examine_sensor_output.py:60
def main(bagfile, topic)
Definition: examine_sensor_output.py:15