This knowledge base article covers how to trigger LUCID’s TRI02KA line scan camera.
What is a line scan camera?
In contrast with an area scan camera, which takes rectangular images at once, a line scan camera acquires image data using a single row of pixels at a time. The camera then stacks the data from multiple rows of pixels to form a rectangular image.
Triggering a line scan camera
Similarly to an area scan camera, a line scan camera can be triggered using software triggering, hardware triggering, and PTP Sync. However, to achieve higher triggering speeds, you need to use hardware triggering.
The TRI02KA can be triggered at 60,000 Hz, which means that it acquires 60,000 lines per second. In line scan cameras, this rate is known as the line rate. Assuming that one image is made up of 64 lines, this means that AcquisitionFrameRate is equal to 60,000 lines / 64 lines ~= 937.5 frames per second (). Alternatively, if the Height is set to 100, this number of lines will be combined to form an image, making AcquisitionFrameRate equal to 60,000 lines / 100 lines = 600.
Incomplete images
If the trigger stops during the construction of an image, e.g. at 20 lines out of 64 lines, the image is incomplete. The returned image will then consist of 20 new lines and 44 lines from the previous image. You can tell if an image is incomplete through the IsIncomplete attribute of the IBuffer interface of the Arena SDK.
The images below show two frames—one complete frame, and another image where the trigger signal stopped before there was enough information for a complete image.
Figure 1: A complete frame made up of multiple lines. Note that the lines are stacked from the bottom of the image.
Figure 2: The subsequent frame only has 20 new lines at the bottom. The remaining 44 lines are from the previous images.
Achieving adequate line rate and frame rate
Keep in mind the following points.
- Use a Width of 1752 to achieve a AcquisitonLineRate value of 60,000. You may be able to reach higher values by reducing the width.
- The maximum value of AcquisitionFrameRate is 1000. To achieve this frame rate, use at least Height = 60 at AcquisitonLineRate value of 60,000. Remember that Height x AcquisitionFrameRate = AcquisitonLineRate.
Sample code
See here for Python sample code that uses the following configuration to trigger a line scan camera:
- Width = 1752
- Height = 60
- Trigger Selector = LineStart
- Trigger Mode = On
- Trigger Source = Line 0 (you can any line of your choice)
About the Encoder control
Our Encoder control (a quadrature decoder) is designed to work with an external incremental encoder. The Encoder control outputs trigger signals and can be used as a trigger source by the Acquisition control.
We describe several nodes in the Encoder control below.
EncoderMode
EncoderMode sets whether the decoder uses FourPhase mode with jitter filtering or the HighResolution mode without jitter filtering. Jitter includes phase error and symmetry error as shown in the diagram below.
Mode | Jitter Filtering | Description |
Single Phase | yes | The camera interprets every pulse as positive direction (works like normal triggering), only one Source needs to be configured |
Four Phase | yes | Uses two Sources to determine encoder position and direction |
High Resolution | no | High-resolution mode instead tracks every change in state between A and B to give 4x the resolution but is susceptible to jitter – count will be shifted if any of the pulses are early or late |
The decoder tracks every state change and only increments the position after we pass through all of them, which results in a 1/4 the resolution of the actual displacement of the encoder, but is at the same time makes the position more reliable.
Jitter filtering makes the “Actual” signal more reliable.
EncoderDivider
This node decides the number input pulses are required before the decoder produces an output pulse.
- With a divider of 1, it means for every input pulse, the camera generates one output pulse.
- With a divider of 10, the decoder generates an output pulse after 10 input pulses.
EncoderOutputMode
This node selects the conditions for the Encoder interface to generate an Encoder output signal
Mode | Details |
Off | No output pulses from encoder control to acquisition control. |
DirectionUp | Only generate output pulses when we are moving in a positive direction, any pulses in the negative direction are ignored. |
DirectionDown | Only generate output pulses when we are moving in a negative direction, any pulses in the positive direction are ignored. |
PositionUp # | Only generate output pulses when our overall position is increasing. See the example below. |
PositionDown | Only generate output pulses when our overall position is decreasing. |
Motion | The direction is ignored completely. With a divider of n, after n pulses in any direction, it will output a trigger. |
Position Up
Suppose that the encoder is moving in the positive direction and the position counter increases to 100 (suppose also that the camera is are generating output pulses during this time). Suppose that the conveyor stops and starts moving backwards. The decoder stops outputting pulses and the counter decreases, say to 80. If the encoder subsequently stops and starts moving in the positive direction again, the decoder does not output any pulses while moving in the positive direction until the position reaches 100 again. Once the position passes 100, the position counter starts increasing again and the decoder start outputting pulses again.
Encoder Reset
Can be used to restore all of the logic to a known state (clears the location information). You can also enter a position in EncoderValue to start the encoder at a desired position when you restart it.
When to use Encoder Reset
Suppose that you have EncoderOutputMode configured to PositionUp. After running normally, the conveyor has an issue and you need to run the conveyor in the reverse direction for some time. You restart the conveyor, and you use the Encoder Reset command so the camera starts imaging immediately without waiting for conveyor to make up the earlier reverse travel.
The decoder has wraparound protection for when the position reaches the max value. It is able to keep working correctly during and after a wraparound (in other words, it is able to run indefinitely).