optris::sdk::ShutterEvent
The shutter changed position.
Delivered through Imager::SetShutterCallback(). This is the only way to see a transition, and the only way to get one with a timestamp -- a camera reports Closing and Opening as well, and no single bool can carry four values.
It is NOT the only way to see a closure, and the sentence that stood here until 12.0.1 said it was: it claimed the frames that would report a closed shutter are never delivered, which describes the behaviour before 12.0 and contradicts Imager::SetShutterCallback()'s own comment. The SDK holds the last frame taken with the shutter open and delivers it through the closed window, so ThermalFrame::flag_open is false on those frames on every source and FrameMetadata::is_repeated_frame marks them.
Public attributes
state
ShutterState state = ShutterState::kInitializing
The state now.
previous
ShutterState previous = ShutterState::kInitializing
The state before this transition. Equal to state only for the first event, which reports the state the imager started in.
timestamp_us
uint64_t timestamp_us = 0
When, in microseconds on the host's monotonic clock -- the same clock as std::chrono::steady_clock.
Monotonic rather than wall clock on purpose: this exists to time a cycle, and a cycle timed across a clock adjustment would be wrong exactly when it mattered. It is not a date; host_time_us is.
Always this one clock, because a shutter transition has only one source. AlarmEvent::timestamp_us is not: it carries its input observation's stamp, which for a published signal is wall clock. So do not subtract a shutter timestamp from an alarm one, whatever earlier versions of this comment said.
sequence
uint64_t sequence = 0
Transitions since the imager was created, from 1. A consumer that missed one can tell.
host_time_us
uint64_t host_time_us = 0
The same transition as a date: microseconds since the Unix epoch, from std::chrono::system_clock.
This is the field for a data-log row that has to say when the shutter moved. It is sampled at the point the transition is published, in the same breath as timestamp_us, and not when a subscriber's callback runs -- so the queue latency between the two is not in it.
It is not monotonic, and timestamp_us is. NTP can step the system clock in either direction and an operator can set it, so this value can go backwards or jump by hours from one event to the next. timestamp_us never does. Time a shutter cycle with timestamp_us; stamp a log row with this. Neither is derived from the other -- they are two real readings of two different clocks, taken adjacently on purpose, so a consumer that needs to correlate them can.
Zero only if the SDK could not read the system clock.
How far this can be from the shutter actually moving: How far this can be from the shutter actually moving It is stamped where the SDK decides the transition, and that is not always where the shutter moves. What it costs depends on which transition it is:
kClosingis the command. It is stamped when the SDK tells the shutter to close, before the mechanism has done anything.kClosedandkOpeningare observations, and the only thing that observes the shutter is the frame itself: the camera puts the flag position in each frame's metadata row, so the SDK learns of a movement on the first frame captured after it. The stamp therefore lags the movement by up to one frame period, uniformly distributed, plus that frame's transport and processing time. One frame period is 31 ms on a PI 640 at 32 Hz, 20 ms on an Xi 80 at 50 Hz, 40 ms on an Xi 410 at 25 Hz over Ethernet, and 244 ms on an Xi 410 at 4.1 Hz over USB, which is the worst case across the supported formats. Host-side frame-rate subsampling does not make it worse: it is bypassed for the duration of a cycle, so these are wire rates.kOpenat the end of a cycle is a timer, not an observation: the cycle thread waits out the reopen and publishes. Use thekOpeningstamp if you need the observed reopen.
None of this is jitter in the clock -- both timestamps are read at the same instant and both carry the same lag, so kClosed to kOpening still measures the closed window correctly. It is an offset on when a transition is learned of, and a log row should be read as "no earlier than this, by up to one frame period".