Hi,
do I understand correctly that you trigger each segment "by hand" (marked ######) because you don't have an external trigger, so that I can ignore this part of the code if I have one?
Also do I have to manually start the the recording?
And finally if I disable the looping of the ring buffer the recording will stop when the buffer is full. Is it correct, that it'll also stop if the defined number of segments is reached, even if the segments aren't "full"?
For better understanding, I want to capture an repetitive, very short event so it's not possible to save between events. That's why I want to use the segmented record mode. But I don't know how long such an event lasts till it's re-triggered and starts from the beginning, therefore my idea was to define 10 segments to capture 10 events after one another just try. My fear is that there will be a problem if the segment is defined for 2000 frames but the trigger for the next event hits every 1500 frames.
Thanks in advance for your help!
#!/usr/bin/python3
import time
import requests
ipAddress = '192.168.12.1'
totalFrames = 20000
totalSegments = 50
segmentInterval = 5
print(f'Flushing any previously recorded data for Chronos at {ipAddress}')
requests.post(f'http://{ipAddress}/control/flushRecording', json = {})
print(f'Setting recording frames quantity to {totalFrames}')
requests.post(f'http://{ipAddress}/control/set', json = {'recMaxFrames': totalFrames})
print('Setting recording mode to segmented')
requests.post(f'http://{ipAddress}/control/set', json = {'recMode': 'segmented'})
print(f'Setting recording segments quantity to {totalSegments}, each with a duration of {totalFrames // totalSegments} frames')
requests.post(f'http://{ipAddress}/control/set', json = {'recSegments': totalSegments})
print('Starting first segment recording')
requests.post(f'http://{ipAddress}/control/startRecording', json = {})
##########
for i in range(totalSegments):
# Wait segment interval
time.sleep(segmentInterval)
# Trigger next recording segment
requests.post(f'http://{ipAddress}/control/set', json = {"ioMappingTrigger": {"source": "alwaysHigh", "invert": True }})
requests.post(f'http://{ipAddress}/control/set', json = {"ioMappingTrigger": {"source": "alwaysHigh", "invert": False }})
print(f'Recorded segment {i + 1} of {totalSegments}')
##########
# Wait segment interval
time.sleep(segmentInterval)
print('Stopping recording')
requests.post(f'http://{ipAddress}/control/stopRecording', json = {})