Control panel
ObisLaserVisualizer shows a dashboard for one laser while a workflow runs: what the laser is, its live readings, controls for emission, power and operating mode, its persistent settings, its faults, and a log of every reply. The dashboard needs the BFC.ObisLaser.Design package; install it in your Bonsai environment along with BFC.ObisLaser.
Connect the panel
The panel receives replies and sends commands, so it connects to Device through the subjects described in Several lasers and devices:
PublishSubjectdeclares theLaserCommandssubject, of typeObisCommand.SubscribeSubjectfeeds the commands sent toLaserCommandsintoDevice, which publishes the replies toLaserReplies.ObisLaserVisualizerreceives the replies fromLaserReplies, and sends the commands requested from the panel toLaserCommands.
Set PortName on Device and Channel on ObisLaserVisualizer: 0 for a laser connected directly, 1 or more for a laser behind an OBIS Remote or LaserBox. Start the workflow and double-click ObisLaserVisualizer to open the panel. The panel requests the device information and state when it opens.
Use the dashboard
- Header: the wavelength, in its color, with the model, serial number and channel. The badge shows whether the laser is emitting, in standby, in a fault, in its CDRH delay or warming up. Live requests the state every
PollInterval(1 s by default) to keep the readings current; setPollStateon the node to start it on when the workflow starts. Refresh reads everything again. - Control: the Emission switch turns emission on and off;
Deviceturns it off when the workflow stops. Drag the Power slider, which runs from 0 to the maximum power of the laser, or type a power in milliwatts; the power is sent when you release the slider or leave the box. The Mode pills select the operating mode, such as CWP for constant power. - Readings: output power, setpoint, diode current, base plate temperature (amber within 3 °C of its limits, red beyond), operating hours and mode.
- Device information: model, wavelength, serial and part numbers, firmware, power ratings, manufacture and calibration dates, hours, power cycles, currents and temperatures.
- Settings: auto start, CDRH delay, diode warm-up, TEC, status indicator, analog blanking and the analog input impedance. These are stored in the laser and persist after power cycles.
- Status and faults: the status and fault flags of the laser, its error queue, and Recover when the laser is in a fault.
- Messages: every reply, newest last: the command, the value or the error, and how long the exchange took. Rejected commands are shown in red.
Values the laser does not support, which depends on its model and firmware, are shown as "Not supported", and settings it does not support are hidden. Each button sends its command and then requests the state, so the display reflects the change. The panel shows only replies to commands for its channel, including commands sent by other parts of the workflow, so its log also shows what the rest of the workflow does to the laser. Commands from the panel share the queue of Device with every other command.
Read-only dashboards
Set Disable on ObisLaserVisualizer to make its dashboard read-only, for example to monitor a laser that an experiment controls. The dashboard still shows the laser and can poll and refresh its state, but its controls for emission, power, mode, settings, fault recovery and the error queue are disabled, and the node sends no command that could change the laser. A READ-ONLY badge is shown in the header. Disable can be changed while the workflow runs, for example from a property mapping.
To control several lasers, add one ObisLaserVisualizer per laser, each with its own Channel.
Choose the laser while the workflow runs
When the channel is only known once the workflow runs, for example from the devices found by FindDevices, connect the channel to a second input of ObisLaserVisualizer. Channel is then ignored: the panel shows "No laser is assigned to this panel" until the first channel arrives, and each new channel starts a new session, which requests the device information and state again.
Draw the dashboard in your own window
To show several lasers in one window, for example as tabs of a Bonsai.ImGui visualizer, create one ObisLaserController per laser in your own code instead of ObisLaserVisualizer nodes. Send its Commands to the Device of the laser, pass the replies to Receive, and call Draw on each frame, for example inside ImGui.BeginTabItem. Draw fills the space available and does not change the style or colors of your ImGui context. Dispose the controller to stop polling the laser.