Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
chore: qtm multicam csv processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouwrice committed Dec 14, 2023
1 parent c8df2ec commit cedd9ca
Show file tree
Hide file tree
Showing 6 changed files with 222,529 additions and 5 deletions.
47,035 changes: 47,035 additions & 0 deletions data/multicam_asil_01/qtm_multicam_asil_01.csv

Large diffs are not rendered by default.

36,581 changes: 36,581 additions & 0 deletions data/multicam_asil_02/qtm_multicam_asil_02.csv

Large diffs are not rendered by default.

43,265 changes: 43,265 additions & 0 deletions data/multicam_asil_03/qtm_multicam_asil_03.csv

Large diffs are not rendered by default.

47,965 changes: 47,965 additions & 0 deletions data/multicam_ms_01/qtm_multicam_ms_01.csv

Large diffs are not rendered by default.

47,679 changes: 47,679 additions & 0 deletions data/multicam_ms_02/qtm_multicam_ms_02.csv

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/csv_objects/qtm_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import time

import qtm_rt

from csv_objects.csv_object import CSVWriter
Expand All @@ -10,14 +8,15 @@ class QTMWriter:
Class to write the captured data to a CSV file.
"""

def __init__(self, path: str):
def __init__(self, path: str, time_per_frame: float = 0.01):
self.csv_writer = CSVWriter(path)
self.time_per_frame = time_per_frame

def on_packet(self, packet: qtm_rt.QRTPacket):
""" Callback function that is called everytime a data packet arrives from QTM """
_, markers = packet.get_3d_markers()
# packets at 100 Hz so time is frame number * 10 ms
packet_time = packet.framenumber * 10
packet_time = packet.framenumber * self.time_per_frame
if self.csv_writer is not None:
for i, marker in enumerate(markers):
self.csv_writer.write(packet.framenumber, packet_time, i, marker.x, marker.y, marker.z)
Expand All @@ -28,7 +27,7 @@ async def main():
if connection is None:
return

writer = QTMWriter("qtm_multicam_7.csv_objects")
writer = QTMWriter("qtm_multicam_ms_02.csv", time_per_frame=1 / 120)

await connection.stream_frames(components=["3d"], on_packet=writer.on_packet)

Expand Down

0 comments on commit cedd9ca

Please sign in to comment.