Skip to content

Commit

Permalink
database: add high resolution snapshot and binned stream records.
Browse files Browse the repository at this point in the history
Most cameras have high-throughput when operating with its full
resolution. To make it possible to run at higher frame rates when
streaming, add new records to enable and disable binning feature and
change the resolution correspondingly.

Using channel access links to `Acquire` is required here to have the
desired effect. Otherwise, sometimes the record won't be reprocessed at
the right time (blocking with RPRO=1). This issue has not been further
investigated, but has not shown to occur with channel access links. To
avoid delays and have explicit support for waiting for record
processing, sseq from calc module is used. It should be further
investigated if checking for read-back values is more appropriate to
ensure the setting is satisfied.

Even though the camera firmware knows which value is the updated maximum
when applying binning, it does not deliver the image when such parameter
is not explicitly reset. Thus, the operation mode switch must enforce
this. In a similar vein, GC_{Height,Width}Max_RBV do not update in time
when decreasing binning. Thus, use `GC_Sensor{Height,Width}_RBV` instead
to avoid empirical delays. Curiously, this does not apply to
`$(P)$(R)Stream`. These can possibly be fixed by waiting for read-backs.

This has been tested with a Alvium G1-500c. Some features, such as
binning mode, may have different names for other devices, which may lead
to unexpected behaviours. It should be refactored to use uniform records
if another camera is to be supported for this operation mode.

A template (cmd) script is provided to make it easier to load such
records in a clean way in the main start-up script.
  • Loading branch information
henriquesimoes committed Apr 23, 2024
1 parent cfa9d46 commit 7718fe5
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
58 changes: 58 additions & 0 deletions CameraApp/Db/binned-streaming.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Records for encapusaling logic to change from low resolution (binned) video
# streaming to full resolution single shot capture.

record(sseq, "$(P)$(R)Snapshot") {
field(DESC, "Capture single image in full resolution")
field(SELM, "All")
field(LNK1, "$(P)$(R)Acquire CA")
field(DO1, "0")
field(WAIT1, "Wait")
field(LNK2, "$(P)$(R)GC_BinningVertical CA")
field(DO2, "1")
field(WAIT2, "Wait")
field(LNK3, "$(P)$(R)GC_BinningHorizontal CA")
field(DO3, "1")
field(WAIT3, "Wait")
field(LNK4, "$(P)$(R)GC_Height CA")
field(DOL4, "$(P)$(R)GC_SensorHeight_RBV CA")
field(WAIT4, "Wait")
field(LNK5, "$(P)$(R)GC_Width CA")
field(DOL5, "$(P)$(R)GC_SensorWidth_RBV CA")
field(WAIT5, "Wait")
field(LNK6, "$(P)$(R)ImageMode CA")
field(DO6, "0")
field(WAIT6, "Wait")
field(LNK8, "$(P)$(R)Acquire CA")
field(DO8, "1")
}

record(sseq, "$(P)$(R)Stream") {
field(DESC, "Start low resolution (binned) streaming")
field(SELM, "All")
field(LNK1, "$(P)$(R)Acquire CA")
field(DO1, "0")
field(WAIT1, "Wait")
field(LNK2, "$(P)$(R)GC_BinningVertical CA")
field(DO2, "2")
field(WAIT2, "Wait")
field(LNK3, "$(P)$(R)GC_BinningHorizontal CA")
field(DO3, "2")
field(WAIT3, "Wait")
field(LNK4, "$(P)$(R)GC_BinVerticalMode CA")
field(DO4, "1")
field(WAIT4, "Wait")
field(LNK5, "$(P)$(R)GC_BinHorizontalMode CA")
field(DO5, "1")
field(WAIT5, "Wait")
field(LNK6, "$(P)$(R)GC_Height CA")
field(DOL6, "$(P)$(R)GC_HeightMax_RBV CA")
field(WAIT6, "Wait")
field(LNK7, "$(P)$(R)GC_Width CA")
field(DOL7, "$(P)$(R)GC_WidthMax_RBV CA")
field(WAIT7, "Wait")
field(LNK8, "$(P)$(R)ImageMode CA")
field(DO8, "2")
field(WAIT9, "Wait")
field(LNKA, "$(P)$(R)Acquire CA")
field(DOA, "1")
}
3 changes: 3 additions & 0 deletions CameraApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Camera_LIBS += ADAravis
Camera_DBD += asSupport.dbd
Camera_LIBS += autosave

Camera_DBD += sseqRecord.dbd
Camera_LIBS += calc

Camera_SRCS += Camera_registerRecordDeviceDriver.cpp

# Build the main IOC entry point on workstation OSs.
Expand Down
8 changes: 8 additions & 0 deletions iocBoot/iocCamera/binned-streaming.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Load records for binned streaming and high resolution snapshots
#
# Parameters:
#
# $(PREFIX)
# Prefix for all PVs.

dbLoadRecords("$(TOP)/db/binned-streaming.db", "P=$(PREFIX), R=cam1:")

0 comments on commit 7718fe5

Please sign in to comment.