Skip to content

basler-config ​

Sends parameter values to the selected cameras when a message arrives. The values are constants or come from the message or from the flow and global context.

The node has one input and one output.

Properties ​

PropertyDescription
NameLabel of the node in the flow. basler-config when empty
ParametersList of parameters to send. Add parameter adds a row with the parameter, its value and the source of the value
Basler ServicesState of the services on the host, with the Start Basler and Stop Basler buttons
Available CamerasThe cameras that the discovery service finds. The Select checkbox marks the cameras that this node configures

The last two panels are the ones of basler-collector and act on the same services and containers: see its Properties. A camera can be selected once its publisher container is running.

Parameters ​

Each row has a parameter from the list below, or Custom… with the exact name of a GenICam node of the camera. The value is a constant of the type in the table, a property of the message (msg.) or a context value (flow., global.).

ParameterValueHow the publisher applies it
Width (pixels), Height (pixels): Width, HeightNumber, in pixelsRounded to an integer and written as it is: a value outside the range of the camera, or off its increment, is refused
Offset X (pixels), Offset Y (pixels): OffsetX, OffsetYNumber, in pixelsAs Width and Height
Exposure Time (µs): ExposureTimeNumber, in microsecondsWritten as it is. The camera must have ExposureAuto set to Off
Gain (dB): GainNumber, in dBWritten as it is. The camera must have GainAuto set to Off
Acquisition Mode: AcquisitionModeText, typically Continuous, SingleFrame or MultiFrameThe name of one of the entries of the camera
Custom…Text, number or booleanThe node with that name is set according to its type: an integer or float node takes a number, a boolean node a boolean, a string node a text, an enumeration the name or the numeric value of one of its entries. A command node is executed, whatever the value
  • The type of the value must fit the node: a number given as a text ("5000") is refused by a numeric node.
  • The names Width, Height, OffsetX, OffsetY, ExposureTime, Gain and AcquisitionMode are recognised in any letter case and sent as written here. exposure, in any letter case, is sent as Exposure, which the publisher sets like any other name. Any other name is sent as it is written; a name that the camera does not have is ignored without any notice.
  • The publisher stops grabbing, writes the parameters and grabs again, so the frames pause for a moment on every message. Messages that reach it during the same pass of its acquisition loop, which waits up to 200 ms for a frame, are merged and written together.
  • The parameters are written in the order of their names, compared character by character: ExposureAuto comes before ExposureTime, but Gain before GainAuto, Height before OffsetY and OffsetX before Width. Switch the automatic modes off in an earlier message than the values, and send a size and its offset in separate messages, with a pause between them, when the new combination only fits the camera in one order.

Input ​

Any message makes the node evaluate its parameters and send them.

PropertyTypeDescription
msg.parametersobjectOptional. Parameter names and values that are added to the ones of the dialog and replace those with the same name. The values are text, numbers or booleans; values of other types are left out
msg.camerasarray of stringsOptional. MAC addresses of the cameras to configure for this message, in place of the selection of the dialog. Both aa:bb:cc:dd:ee:ff and AA-BB-CC-DD-EE-FF are accepted. An empty array means no camera

A parameter whose value is missing (undefined or null), an empty text or the text none is left out; texts are sent without the spaces around them. A numeric row left empty is sent as 0. The remaining parameters are sent together to each camera.

To set the exposure and the gain by hand, the automatic modes must be off. They can be switched off with the same node, in a message of their own:

javascript
msg.parameters = {
    "ExposureAuto": "Off",
    "GainAuto": "Off"
}

The values only reach a camera whose publisher container is running. The publisher keeps every parameter it has received since its container started, commands included: values that arrive while it is not acquiring (during the 10 seconds after it starts, or while it reconnects to the camera) are applied once the camera acquires, and after every reconnection all of them are applied again, in up to three passes so that values that depend on each other settle. They are forgotten when the publisher container is restarted.

Output ​

The incoming message, with the summary of what was sent in msg.baslerConfig:

javascript
msg.baslerConfig = {
    cameras: ["aa:bb:cc:dd:ee:ff"],        // cameras the parameters were sent to
    parameters: ["ExposureTime", "Gain"],  // names of the parameters sent
    timestamp: 1710500000000               // moment of sending, in milliseconds
}
SituationOutput
The parameters were sentThe message with msg.baslerConfig
No parameter has a valueThe message, unchanged
There is no camera to configure, or the sending failsNo message

The camera does not answer: msg.baslerConfig tells what the node sent, not what the camera accepted. A value that the camera refuses is written to the log of the publisher container (docker logs basler-<MAC>, with the MAC address in upper case and hyphens).

Status ​

StatusMeaning
Green dot, N cams | M paramsThe node is ready, with N cameras selected and M parameter rows in its dialog (1 cam, 1 param in the singular)
Grey ring, 0 cams | M paramsNo camera is selected in the dialog
Green dot, sent K (N cams | M params)The last message sent K parameters
Yellow ring, no cameras selectedA message arrived and there is no camera to configure
Yellow ring, no parametersA message arrived and no parameter has a value
Red ring, config errorThe parameters could not be sent

Errors ​

MessageLevelCause
No cameras selected for configurationWarningA message arrived and there is no camera to configure: msg.cameras is an empty array, or it is absent and no camera is selected in the dialog
Parameter <name>: <reason>WarningThe value of a row could not be read from the message or the context. The parameter is left out
Parameter <name>: unsupported value type <type>WarningThe value of a row is not text, a number or a boolean. The parameter is left out
Parameter <name>: numeric value must be finiteWarningThe value of a row is NaN or infinite. The parameter is left out
Parameter <name>: empty or none value ignoredWarningThe value of a row is an empty text or none. The parameter is left out
No parameter values to applyWarningNo parameter is left to send
NATS connection failed: <reason>WarningThe NATS server could not be reached when the node started
Failed to configure cameras: <reason>ErrorA message arrived and the parameters could not be sent to the NATS server

The errors are logged without the message, so they appear in the debug sidebar and in the Node-RED log but do not trigger a Catch node.

The basler-config nodes and their dialog share one connection to NATS, opened the first time one of them needs it. If that first attempt fails it is not repeated: start the NATS server and restart Node-RED.