Create a C#.Net version of the Barrier Control App
In this lecture you will see how to create the barrier control app in C#.Net. You will learn how to create functions for moving the robot (e.g.: functions to raise or lower the barrier or shoot), you will learn how to store license plate data in a generic list, and how to use this data to make decisions.
A SNAP version of a barrier control app can be found on the following page: Car license plate recognition in SNAP
Setup a License Plate Recognizer connection!
In this lecture you will see how to develop a barrier control application. Before you start coding, there are some prerequisite you need to perform. The first task is to add a new License Plate Recognizer connection under the control panel of the Ozeki 10.
Connect your barrier robot!
The next step is to pair a Lego Robot with your windows PC and add it as a connection in Ozeki 10.
Create a function for sending and receiving messages!
To be able to receive messages from your Lego robot, you need to subscribe to its events. In the next video you can see how to write the AppOut function that will be responsible for sending out messages from this app to other connections (such as a Lego robot or a Camera). You will also see how to override the In method on which the messages will be arriving from other connections.
Subscribe for camera events
The following video will demonstrate how to override the StartApp method. It will run after you start your Ozeki 10 software. In the beginning of the method you need to subscribe to the events of previously installed license plate recognizer connection to be notified whether a license plate number is detected.
Create robot control functions for raising and lowering the barrier and for shooting!
To open and close your barrier and shoot with it, you need to call the previously written AppOut method to send messages to your system. The first parameter is the name of the connection and the second parameter is the command to move the robot motor.
Create the NumberPlateDetected function that will decide what to do if a car approaches!
To notify our BarrierControl app about messages coming from other connections, we need to have an EventHandler to which the BarrierControl app can subscribe. In the following video we define the NumberPlateDetected EventHandler. If the In method occurs, it means a message is arriving from other connections (in this case from the license plate recognizer), so we need to raise the NumberPlateDetected eventhandler.
We also need to subscribe to this NumberPlateDetected event. If it occurs, we need to verify if the detected license can be found in a previously defined list or not. If it is in the list, open the barrier and close it 5 seconds later. If it is not in the list, use the shoot() method for shooting the car.
- Become a Robot Master
- Build your first App in C#.Net
- Send messages from your C#.Net App to your Lego robot
- Receive messages from your robot and handle events
- Convert a SNAP app into C#
- Build a user interface for multiple robots
- Build a responsive user interface for various screen sizes
- Create a data class
- Learn to use an item manager
- Automatically generated grids and forms