sunil3590 / TIM

TIM - Traffic Intersection Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TIM

Autonomous traffic management for autonomous vehicles.

Components include:

Wolfbot

Beaglebone Black based bot with 4 wheels and a bunch of sensors. We mainly use an IR sensor and a color sensor along with WiFi adapter for network connectivity. https://research.ece.ncsu.edu/aros/project/wolfbot/

TIM (Traffic Intersection Manager)

Software that handles traffic at junctions. It's goal is to avoid collisions and optimally control traffic.

Dependencies

Install Mosquitto server

sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt-get install mosquitto

Install MQTT client for Python

sudo pip install paho-mqtt

Code

Wolfbot Classes

This code is to be installed and run on each Wolfbot.

ir_ain.py

Sensor class that intatiates an ADC object for easily reading the IR analog ouputs, and uses a threshold to determine if sensor is detecting white (or conversly, black).

ISL29125_const.py

Defined constants of registers and values for use by the ISL29125 color sensor.

red_config.txt & write_red_config.py

Output file generated by write_red_config.py, red_config.txt holds the bot's latest color calibrated numbers for red and white RGB values.

color_sensor_ISL29125.py

Sensor class that intatiates an I2C object for easy setup and usage of a ISL29125 color sensor. Provides the api for using red_config.txt to determine if sensor color more closely matches white or red.

sensor.py

This code instantiates the color sensor and the left ir sensor for easy access. It also adds api for is_Black (is the ir sensor reading black) and is_Red (is the color sensor over red).

calibrate_all.py

This code is as simple user operated test of all the sensors and the bot battery voltage, to ensure all are working correctly. It also demonstrates the api.

motion.py

This code instantiates the wolfbot class (see ARoS documentation https://github.ncsu.edu/aros/wolfbot ), operates the line following algorithm, handles the hard-coded intersection turns, and in general controls all bot movement through the mock interesection.

bot.py

Needs: Bot ID, Type (civiliam or ems), Source, Destination, Server IP, (optional) Port

python bot.py 1 civilian 2 3 192.168.23.3

This code is responsible for moving the bot from source lane to destination lane, using the sensor class to navigate the mock intersection, using motion class to achieve line following and turning, and interacting with TIM to safely cross the intersection.

TIM Classes

This code runs on user's PC.

tim.py

Needs: Algorithm type, mosquitto server ip, (optional) port ip

python tim.py PQ 192.168.23.3

This code manages recieving requests from bots to cross, prioritizing requests and sending GO commands accordingly, and receiving completed notification from bots to proceed with next request

traffic_generator.py

Needs: number of vehicles to simulate, log file name for output

python traffic_generator.py 100 log1.txt

This code has one thread per lane which launches multiple bot threads at certain intervals. Each bot thread simulates a physical bot by sending requests and notifications. Logs time stamps of various events to help further analysis

About

TIM - Traffic Intersection Manager

License:MIT License


Languages

Language:Python 90.7%Language:C++ 9.3%