A python package that computes an optimal motion plan for approaching a red light

Overview

Code style: black License: AGPL v3

redlight_approach

redlight_approach is a Python package that computes an optimal motion plan during traffic light approach.

RLA_demo.mov

Given the parameters of the road and vehicle, and a probability distribution describing when the traffic light will turn green, redlight_approach finds the optimal motion plan to minimize the expected amount of time spent traversing the intersection. It enacts the motion plan in a SUMO simulation, and a standard human driver is simulated for comparison. It reports the difference in time between the vehicles. The simulation above is cherry-picked, but typical use involves running many simulations with the red light duration sampled from the probability distribution. Preliminary findings show that this traffic light approach planner will save vehicles time in realistic scenarios.

Next Steps: Baysian Updating from World State

Currently, redlight_approach uses a fixed green light event probability distribution throughout a single approach. It's clear this is naive, as there is information about the traffic light cycle available through observation of the world state. For instance, seeing a vehicle slow down that is approaching the intersection perpendicular to your approach, indicates that their traffic light is no longer green. This suggests that your light may turn green soon, depending on the traffic light cycle. There are other possible information sources, like direct observation of the light from another vehicle of a connected fleet. Updating the distribution from an observation of the world during approach would increase the performance of the system.

Formally, the goal of this part of the project is to map world state to a Baysian update of the probability distribution. Specifically, this will involve using a neural net to map an aspect of world state, like the position of other vehicles, to a likelyhood function defined over the support of the green light event. This requires a dataset which will be generated by running many simulations. This effort is currently underway in the baysian_update branch.

Requirements

  1. Linux or macOS

  2. Miniconda or Anaconda
    To install, visit Conda Installation

  3. SUMO: Installation instructions for Linux (Ubuntu) and macOS

Install SUMO (Ubuntu)

  1. Build SUMO from source (see SUMO Linux Build for more details)
sudo apt-get install git cmake python3 g++ libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev
git clone --recursive https://github.com/eclipse/sumo
export SUMO_HOME="$PWD/sumo"
mkdir sumo/build/cmake-build && cd sumo/build/cmake-build
cmake ../..
make -j$(nproc)
sudo make install

Install SUMO (macOS)

  1. Install Homebrew if you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install XQuartz with Homebrew:
brew install --cask xquartz
  1. Install SUMO with Homebrew:
brew tap dlr-ts/sumo
brew install sumo

Installation of redlight_approach

  1. Edit .bashrc or .zshrc:
  • Add these lines to your shell's config file:

    # Your .bashrc or .zshrc file
    
    export SUMO_HOME="/path/to/sumo"
    export PYTHONPATH="$PYTHONPATH:/path/to/parent/"
    
  • Replace /path/to/sumo above with your sumo location, which you can find with which sumo.

  • Replace /path/to/parent above with the directory into which you clone this repo, which you can find with pwd.

  • Load these environment variables with

    source ~/.bashrc
    # or 
    source ~/.zshrc
    
  1. Clone this repository:
git clone https://github.com/basilforlife/redlight_approach.git
  1. Change directories to the root of redlight_approach:
cd redlight_approach
  1. Create and activate conda env:
conda env create -f environment.yml
conda activate rla
  1. If you're going to contribute, add pre-commit hooks:
pre-commit install

Usage

Confirm installation was successful with the test suite:

pytest

Typical Use

Run the default scenario with the -g (graphical) option:
Note: on macOS, XQuartz must be running in order to use the graphical option. Start XQuartz from the application folder.

python simple_comparison.py -c parameter_files/original.json -g

To speed up future runs use the the -p option:

python simple_comparison.py -c parameter_files/original.json -p original.pickle

On subsequent runs, use -u to load the same configuration as before:

python simple_comparison.py -u original.pickle

To plot the result of N runs, use the -N option:

python simple_comparison.py -u original.pickle -N 100

For a complete list of options, use the -h option:

python simple_comparison.py -h

License

This work is licensed under the GNU Affero General Public License v3.0. Feel free to contact me if you have any questions about the project.

Owner
Jonathan Roy
Jonathan Roy
Unofficial Python Library to communicate with SESAME 3 series products from CANDY HOUSE, Inc.

pysesame3 Unofficial Python Library to communicate with SESAME 3 series products from CANDY HOUSE, Inc. This project aims to control SESAME 3 series d

Masaki Tagawa 18 Dec 12, 2022
A Python tool to check ASS subtitles for common mistakes and errors.

A Python tool to check ASS subtitles for common mistakes and errors.

1 Dec 18, 2021
A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output.

quera_testcase_checker A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output. proper way to u

k3y1 1 Nov 15, 2021
Sodium is a general purpose programming language which is instruction-oriented (a new programming concept that we are developing and devising) [Still developing...]

Sodium Programming Language Sodium is a general purpose programming language which is instruction-oriented (a new programming concept that we are deve

Instruction Oriented Programming 22 Jan 11, 2022
Backups made easy, automated, monitored and SECURED with an audited encryption

Backup Controller Backups made easy, automated, monitored and SECURED with an audited encryption. Schedules backup tasks executed by Backup Maker, upl

RiotKit 1 Jan 30, 2022
App to decide weekly winners in H2H 1 Win (9 Cat)

Fantasy Weekly Winner for H2H 1 Win (9 Cat) Yahoo Fantasy API Read

Sai Atmakuri 1 Dec 31, 2021
Simple project to learn more about Bézier curves

Python Quadratic Bézier Simple project to learn more about Bézier curves. On this project i used some api's to graphics and gui pygame thorpy in theor

Kenned Ferreira 2 Mar 06, 2022
🤖🤖 Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... 🤖🤖

Jarvis 🤖 🤖 Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... 🤖 🤖 Developer : su

1 Nov 08, 2021
msgqywx 使用企业微信的应用消息推送实时信息

msgqywx 使用企业微信的应用消息推送实时信息

Demon Finch 8 Dec 18, 2022
NUM Alert - A work focus aid created for the Hack the Job hackathon

Contributors: Uladzislau Kaparykha, Amanda Hahn, Nicholas Waller Hackathon Team Name: N.U.M General Purpose: The general purpose of this program is to

Amanda Hahn 1 Jan 10, 2022
The blancmange curve can be visually built up out of triangle wave functions if the infinite sum is approximated by finite sums of the first few terms.

Blancmange-curve The blancmange curve can be visually built up out of triangle wave functions if the infinite sum is approximated by finite sums of th

Shankar Mahadevan L 1 Nov 30, 2021
MeepoBenchmark - This project aims at providing the scripts, logs, and analytic results for Meepo Blockchain

MeepoBenchmark - This project aims at providing the scripts, logs, and analytic results for Meepo Blockchain

Peilin Zheng 3 Aug 16, 2022
A tutorial presents several practical examples of how to build DAGs in Apache Airflow

Apache Airflow - Python Brasil 2021 Este tutorial apresenta vários exemplos práticos de como construir DAGs no Apache Airflow. Background Apache Airfl

Jusbrasil 14 Jun 03, 2022
Team10 backend - A service which accepts a VRM (Vehicle Registration Mark)

GreenShip - API A service which accepts a VRM (Vehicle Registration Mark) and re

3D Hack 1 Jan 21, 2022
Check is a integer is even

Is Even Check if interger is even using isevenapi. https://isevenapi.xyz/ Main features: cache memoization api retry handler hide ads Install pip inst

Rosiney Gomes Pereira 45 Dec 19, 2022
An Airdrop alternative for cross-platform users only for desktop with Python

PyDrop An Airdrop alternative for cross-platform users only for desktop with Python, -version 1.0 with less effort, just as a practice. ##############

Bernardo Olisan 6 Mar 25, 2022
Python DSL for writing PDDL

PDDL in Python – Python DSL for writing a PDDL A minimal implementation of a DSL which allows people to write PDDL in python. Based on parsing python’

International Business Machines 21 Nov 22, 2022
Data-driven Computer Science UoB

COMS20011_2021 Data-driven Computer Science UoB Staff Laurence Aitchison [ 6 May 16, 2022

SDX: Software Defined Internet Exchange

Installation steps: Download and import the Internet2-SDX virtual machine (VM) image, below, in VirtualBox and you are all set :) $ wget http://sites.

Software Defined Internet Exchange Point 15 Nov 21, 2021
Paxos in Python, tested with Jepsen

Python implementation of Multi-Paxos with a stable leader and reconfiguration, roughly following "Paxos Made Moderately Complex". Run python3 paxos/st

A. Jesse Jiryu Davis 25 Dec 15, 2022