Trigger Cameras
The Behavior generates camera trigger pulses on DO0 and DO1, so video frames are captured — and timestamped — on the device clock. Trigger frequency is set per camera with the Camera0Frequency register, triggering is switched with StartCameras and StopCameras, and each emitted trigger broadcasts a Camera0Frame event. The examples below use camera 0 on DO0.
The complete workflow is shown below:
Configure Trigger Frequency
- Insert a
KeyDownoperator and set theFilterproperty toA. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectCamera0FrequencyPayload.Camera0Frequency- Set the trigger frequency in Hz (e.g. 30). Valid values are 2 to 600.
- Insert a
MulticastSubjectoperator namedBehavior Commands.
Run the workflow and press A to set the trigger frequency. Configure the frequency before starting the camera — the value is read when triggering starts.
Start and Stop Cameras
- Insert a
KeyDownoperator and set theFilterproperty toS. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectStartCamerasPayload.StartCameras- SelectCameraOutput0.
- Insert a
MulticastSubjectoperator namedBehavior Commands.
In a separate branch:
- Insert a
KeyDownoperator and set theFilterproperty toD. - Insert a
CreateMessageoperator and configure the following properties:Payload- SelectStopCamerasPayload.StopCameras- SelectCameraOutput0.
- Insert a
MulticastSubjectoperator namedBehavior Commands.
Run the workflow, press S to start the trigger train on DO0 and D to stop it. The stop command lets the current trigger pulse finish cleanly — the device broadcasts a StopCameras event when the last pulse has actually been emitted, so no truncated frame reaches the camera. Triggering also stops automatically when the device leaves active mode.
Visualize Frame Events
Each trigger pulse broadcasts a Camera0Frame event, giving the device timestamp of every captured frame:
- Insert a
SubscribeSubjectoperator namedBehavior Events. - Insert a
FilterMessageTypeoperator and configure theMessageTypeproperty toEvent. - Insert a
Parseoperator and configure theRegisterproperty toTimestamped<Camera0Frame>. - Insert a
VisualizerWindowoperator. This will automatically open a window displaying the parsed events when the workflow starts.
Run the workflow and press S. The visualizer displays:
FrameAcquired@10.351072
The first value confirms the frame trigger and the second is the timestamp on the device clock. Match these timestamps against the frames saved by your video capture software to align video with the rest of the data.
Warning
DO0 and DO1 share their hardware timers with the PWM generator. Don't run PWM and a camera trigger on the same output at the same time.
Last updated with:
Hardware v2.1
Firmware v3.3
Bonsai Package v0.2