Pedestrian Crossing Controller Example - RopleyIT/GLRParser GitHub Wiki
This example implements a traffic light controlled pedestrian crossing. The user interface is implemented as a Blazor web application, and displays a traffic light, and a pedestrian control. When the pedestrian presses the button, the traffic light sequences to Red via Yellow, then indicates to the pedestrian that it is safe to cross. After a crossing period, the pedestrian indicator switches to an indication that it is no longer safe to cross, then after a safety interval the light sequences back to green to allow vehicles to move again.
This sample demonstrates the use of an inline state machine, with actions written into the user's state machine class, but called from the transitions in the grammar description.
The sample code for the application is divided into two projects.
PedXDemo
contains the Blazor-based Web UI, and
PedXController
contains the implementation of the finite state
machine, built using the grammar-generated state machines of the ParseLR
toolkit.
The source code and grammar files for the projects in this
example will be found in the TrafficLightControllerExample
folder.