All Collections
FLOW - real-time monitoring
How to connect
How to connect a FLOW device with your traffic controller using UDP sinks (inductive loop alternative)
How to connect a FLOW device with your traffic controller using UDP sinks (inductive loop alternative)

Learn how to set up and test communication between FLOW device and a traffic controller using UDP sinks.

DataFromSky avatar
Written by DataFromSky
Updated over a week ago

Introduction

In this article, we will show you how easily you can feed real-time FLOW data to traffic controllers using UDP sinks. To test the FLOW and try to implement data integration with your traffic controller, there is no need to have a real FLOW device analyzing the real camera view. To make the integration super-easy for you, we have prepared FLOW Insights Demokit which contains the simulated live camera view on the intersection with emulated FLOW device running on your localhost (Windows only, Linux version on request). The emulation is 1:1 - thus you develop and test the communication using the SW kit and then simply replace it with the real FLOW device such as TrafficCamera or TrafficXroads unit and it is done. To have all the parts before the start and see how the data connection may work, we also provide a Python script simulating the receiving part i.e. traffic controller, which connects to the FLOW device, subscribe for UDP Zone sinks data, and print the raw messages to the console. See the tutorial video and follow the steps to test it on your own.

What do you need?

  1. The latest version of FLOW insights is downloadable here. To get the FLOW Linux version please contact us at info@datafromsky.com.

  2. Python script for simulation of traffic controller receiving UDP sinks data and a Python version 3.10 or higher is installed on your computer.

    To learn more about UDP sinks and other types of data communication refer to this documentation.

The ZONE sink test

  1. Draw a zone over a single traffic lane incoming to the intersection. Click the create spatial filter button on the top left of the live view and draw a freehand shape over the area you want to monitor.

  2. Drag the zone over to the canvas and set it to NOW mode (double click it and check the tickbox).

  3. Add a category filter, select only the vehicle types you want the zone to react to, and connect the filter to the zone.

  4. Add Zone UDP sink from the Sinks programming elements tab. Name it ZONE 1 (this will be the name you will see in the UDP receiver). NOTE: In real scenarios, all sinks sending data to the same traffic controller need to have UNIQUE NAMES.

  5. Check that your setup looks similar to the one in the image below. A common mistake is not selecting the NOW mode on the zone in canvas.

  6. Prepare a folder named “FLOW UDP test” with the script and a folder named “out” inside of it

  7. Launch the Command prompt

  8. Navigate to the folder with the script in the Command prompt

  9. Once you are in the FLOW UDP test folder enter:

python3.10 simple_udp_listener.py -s 127.0.0.1 -o out

-o output directory, that must exist to receive data

-s “ip address of the FLOW Block" -

NOW the script is running and you should start getting messages similarly as in the print screen above. If the messages are super long you probably forgot to set the zone to NOW mode.

Additional Information

The UDP sinks work on Subscribe basis. This means that data is sent every time there is a change in the data monitored in FLOW. For example, in the case of the ZONE Sink with an option “IdList” in the subscription message, new data is sent whenever there is a change in the list of IDs of objects. We also support different sink types apart from the ZONE Sink such as the OBJECT LIST Sink, which sends a list of objects that have been detected, and if available it includes their location, speed data, classification, license plate, etc., and also the CATEGORY Sink which provides classified counts. Note that CATEGORY Sink differs in the communication policy, providing data only upon request. To know more about the UDP interface, check out our detailed API Guide for integrators here.

Conclusion

You have learned and tested how easily you can set up and integrate FLOW devices as real-time traffic sensors for traffic controllers using the simple and lightweight UDP data communication protocol. The FLOW device acts as a UDP server and receiving devices i.e. traffic controllers subscribe to it to receive the defined type of outputs (UDP sinks). Messages are in JSON format and are sent whenever there is a change in the data. We hope you have found this guide helpful. If you have any questions you can contact us using the live chat button on the bottom right or drop an email at info@datafromsky.com.

You can learn more about FLOW open API and UDP and REST sinks in this article.

Full API documentation can be found on this page.

Did this answer your question?