V2X Communication- SmartTraffic Light Controller System

Communication Technologies of Autonomous Vehicles (VIHIM008)

EIT Digital - Digital Media Technology

Authors: Norbert Varga, LászlóBokor PhD.

Department of Networked Systems and Services (HIT)

MediaNetsLaboratory, 2017

Name / NEPTUN

Task 0 – Check the requirements

The following devices are required during the measurement:

-CommsigniaV2X device (RSU or OBU according the configuration)

-UTP cable

-Power adapter

-USB – RJ45console cable

Connect the V2X device’s Console port and the MAC’s USB port with the USB-RJ45 cable. Plug the RSU device into the router using the UTP cable. Connect the MAC wirelessly to the network advertisedby the router.

Task 1 – Test the communication between the OBU device and the MAC

Check the device’s IP address with „eth ip” command.

Take a screenshot about the command’s output and insert here!

Result:

Check the MAC device’s IP address with theifconfigcommand.

Capture a screenshot about the command’s output and insert here!

Result:

The MAC and the RSU device have to be connected to each other through the same network. The RSU device is plugged into the router with UTP cable, while the MAC connects wirelessly to the Wi-Fi network of the router.

Task 2– SPAT/MAP logging

Switch on the MAP and SPAT messages’ logging module with the appropriate “stp-set KEY VALUE” command in the “ate” terminal. The logging modules’ value can be Y (=yes) and N (=no).

Capture a screenshot about the new logging module settings!

Result:

Task 3– Createa Java project

In the following tasks we will create a java application, which is able to get information about the current phase and timing settings of the traffic light through SPAT messages. The traffic light is controlled by a PC or and embedded device (like Raspberry PI). In the current setup a Windows-based PC plays the role of the traffic light controller. The controller generates SPAT message in every phase of the traffic light. Our java application will capture these messages using ITSEventListener.

The Java-based V2X application development requires the following software components:

-JAVA developer environment (Netbeans/Eclipse/IDEA) – the MAC devices are installed with Eclipse IDE

-3rd party java libraries (e.g. Commsignia JAVA API, RX Java, slf4j,etc.)

-Code snippets

Open the Eclipse IDE. Select the File -> New Project -> New Java Project menu.

Figure 1 – create new java project

The project’s name is „V2X_Lab”, select the JRE 8 runtime environment. To be able to control the RSU device from a java application, the Commsignia’s Java-based developer API and its dependencies have to be added to the project. Click on the project with right click, select the Properties -> Java Build Path -> Libraries submenuand add the following external JAR files to the project:

  • jsr305-3.0.0
  • rxjava-1.0.8
  • slf4j-api-1.7.7
  • slf4j-simple-1.7.7
  • v2x-client-1.13.0-SNAPSHOT

Figure 2 – Add external dependencies

Click on the“Order and Export”menuand select all the external JAR files, then click on Apply and OK buttons!

Task 4–Create a main controller class

Right click on the project and select the “New -> Class” submenu. Create a new class named „MainController”, and set up the package name to „v2x”.

Override the content of the MainControllerclass with the content of MainController.txt file.

The attached code snippet contains lines marked with “TODO”. Replace these lines with the appropriate Java code to make the application runnable!

Task 5–Connect to the OBU device

Right click on the project and selectthe “New -> Class”submenu. Create a new class named „IntersectionManager”, and set up the package name to „v2x”.

Override the content of the IntersectionManagerclass with the content of IntersectionManager_part1.txt file.

The attached code snippet contains lines marked with “TODO”. Replace these lines with the appropriate Java code to make the application runnable!

Task 6–Create Eventlistener thread

Create a new thread responsible for the event listening. In this thread we can catch SPAT and MAP events provided by the OBU device. Insert the content of the IntersectionManager_part2.txt after the previously created “IntersectionManager” class’s “//EventlistenerThread” comment.

The attached code snippet contains lines marked with “TODO”. Replace these lines with the appropriate Java code to make the application runnable!

Task 7–Subscription for MAP and SPAT events

Subscript for the SPAT and MAP events provided by the OBU device’s LDM. We can get notifications from both SPAT and MAP messages through the ITSEventListener’sonLdmNotifiationReceived function.Insert the content of the IntersectionManager_part3.txt after the previously created “IntersectionManager” class’s “//Subscription for MAP/SPAT” comment.

The attached code snippet contains lines marked with “TODO”. Replace these lines with the appropriate Java code to make the application runnable!

Task 8–Traffic light’s phase and timing settings

Print out the traffic light’s current phase and timing parameters using the onLdmNotification’sldmObject.The ldmObject contains the current SPAT message. The SPAT message’s structure is shown on the following figure.

Using the ldmObject’s getter methods to print the appropriate values of the SPAT message.

The attached code snippet contains lines marked with “TODO”. Replace these lines with the appropriate Java code to make the application runnable!

Take a screenshot about the Java console output!

Result: