Modbus API
Limelight OS features a Modbus TCP server running at (ipaddress):502
-
Integers: Integers are SIGNED and encoded using twos complement. This method is universally recognized and ensures correct sign interpretation.
-
Floating-Point Numbers: Floats are encoded using the IEEE 754 standard. To comply with the 16-bit register limitation of the Modbus protocol, floating-point numbers are divided into two parts:
- The higher-order 16 bits are stored in the second register, and the lower-order 16 bits in the first register.
- Little-endian format ensures compatibility with the Modbus spec.
USB and Ethernet Limelights may be tested with ModbusTool
Modbus enables support for part inspection and industrial automation use-cases. To get started with Modbus, you need to do the following:
-
Connect to your Limelight via Ethernet or USB-C and configure a pipeline.
- While all pipelines will output results over modbus, our python snapscript pipelines are extremely versatile for industrial use-cases since they support custom input output data.
-
Give your Limelight a static IP address
-
Attach your Limelight to a modbus network.
Modbus Register Specification
Input / Read-Only Registers
Register | Key | Type | Description |
---|---|---|---|
0 | hb | int | Heartbeat value. Increases once per frame |
1 | pipelineIndex | int | Current active pipeline index (0 .. 9). |
2 | validTarget | int | 1 if a valid target exists, 0 otherwise. |
3 | resultsCount | int | Total results count. Includes all fiducial detections, neural detections, etc |
4 | ID | int | ID / Team Number |
5 | modbusMode | int | Modbus Server Output Mode. |
6 | cpuTemp | int | CPU temperature in Celsius. |
7 | cpuUsage | int | CPU usage percentage. |
8 | ramUsage | int | RAM usage percentage. |
9 | currentFPS | int | Current frames per second. |
10 | captureLatency | int | Capture latency. (milliseconds) |
11 | targetLatency | int | Processing latency. (milliseconds) |
12-15 | reserved | int |
If Output Mode is set to 0:
Register | Key | Type | Description |
---|---|---|---|
16,17 | tx | float32 | Horizontal angular offset to target in degrees |
18,19 | ty | float32 | Vertical angular offset to target in degrees |
20,21 | txnc | float32 | Horizontal angular offset to target (relative to principal pixel) in degrees |
22,23 | tync | float32 | Vertical angular offset to target (relative to principal pixel) in degrees |
24,25 | ta | float32 (0-1) | Area of the target as a percentage of the image size |
26 | fiducialID | int | Current AprilTag ID |
27 | classifierClass | int | Class Index of current classifier pipeline output. -1 if no Classifier results |
28 | detectorClass | int | Class Index of current detector pipeline output. -1 if no Detector results |
29 | reserved | int | |
30,31 | python[0] | float32 | Custom python output array [0] |
32,33 | python[1] | float32 | Custom python output array [1] |
34,35 | python[2] | float32 | Custom python output array [2] |
36,37 | python[3] | float32 | Custom python output array [3] |
38,39 | python[4] | float32 | Custom python output array [4] |
40,41 | python[5] | float32 | Custom python output array [5] |
42,43 | python[6] | float32 | Custom python output array [6] |
44,45 | python[7] | float32 | Custom python output array [7] |
Holding / Write-Only Registers
Register | Key | Type | Description |
---|---|---|---|
0 | unlocked | int | Unlocks the pipeline. Set to 1 to enable pipeline switching and custom input data |
1 | pipeIndex | int | Sets the pipeline index if "unlocked" is set to 1 |
2 | outputMode | int | Sets the output mode. 0 - standard, 1 - rawtargets (WIP) |
3 | reserved | int | |
4 | reserved | int | |
5 | reserved | int | |
6 | reserved | int | |
7 | reserved | int | |
8 | pythonInput[0] | int | Custom python input array [0] |
9 | pythonInput[1] | int | Custom python input array [1] |
10 | pythonInput[2] | int | Custom python input array [2] |
11 | pythonInput[3] | int | Custom python input array [3] |
12 | pythonInput[4] | int | Custom python input array [4] |
13 | pythonInput[5] | int | Custom python input array [5] |
14 | pythonInput[6] | int | Custom python input array [6] |
15 | pythonInput[7] | int | Custom python input array [7] |
16,17 | pythonInput[8] | float32 | Custom python input array [8] |
18,19 | pythonInput[9] | float32 | Custom python input array [9] |
20,21 | pythonInput[10] | float32 | Custom python input array [10] |
22,23 | pythonInput[11] | float32 | Custom python input array [11] |
24,25 | pythonInput[12] | float32 | Custom python input array [12] |
26,27 | pythonInput[13] | float32 | Custom python input array [13] |
28,29 | pythonInput[14] | float32 | Custom python input array [14] |
30,31 | pythonInput[15] | float32 | Custom python input array [15] |