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
python3 scrip for case conversion of source code files writen in fixed form fortran

convert_FORTRAN_case python3 scrip for case conversion of source code files writen in fixed form fortran python3 scrip for case conversion of source c

7 Sep 20, 2022
Solutions to the language assignment for Internship in JALA Technologies.

Python Assignment Solutions (JALA Technologies) Solutions to the language assignment for Internship in JALA Technologies. Features Properly formatted

Samyak Jain 2 Jan 17, 2022
1000+ ready code templates to kickstart your next AI experiment

AI Seed Projects Start with ready code for your next AI experiment. Choose from 1000+ code templates, across a wide variety of use cases. All examples

BlobCity, Inc 98 Jan 03, 2023
Projects using the Tkinter module in Python!

Tkinter projects This repository includes some Tkinter projects made by me. All of these are simple to understand. I create apps with good functionali

Amey 0 Sep 24, 2021
This python module allows to extract data from the RAW-file-format produces by devices from Thermo Fisher Scientific.

fisher_py This Python module allows access to Thermo Orbitrap raw mass spectrometer files. Using this library makes it possible to automate the analys

8 Oct 14, 2022
A project to explore and provide useful code for Mango Markets

🥭 Mango Explorer A project to explore and provide useful code for Mango Markets

Blockworks Foundation 160 Dec 19, 2022
A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme tool

Oppo/Realme Flash .OFP File on Bootloader A tool to flash .ofp files in bootloader mode without needing MSM Tool, an alternative to official realme to

Italo Almeida 70 Jan 02, 2023
A weekly dive into commonly used modules in the Rust ecosystem, with story flavor!

The goal of this project is to bring the same concept as PyMOTW to the Rust world. PyMOTW was an invaluable resource for me when I was learning Python years ago, and I hope that I can help someone in

Scott Lyons 20 Aug 26, 2022
GCP Scripts and API Client Toolss

GCP Scripts and API Client Toolss Script Authentication The scripts and CLI assume GCP Application Default Credentials are set. Credentials can be set

3 Feb 21, 2022
E5 自动续期

请选择跳转 新版本系统 (2021-2-9采用): 以后更新都在AutoApi,采用v0.0版本号覆盖式更新 AutoApi : 最新版 保留1到2个稳定的简易版,防止萌新大范围报错 AutoApi'X' : 稳定版1 ( 即本版AutpApiP ) AutoApiP ( 即v5.0,稳定版 ) —

95 Feb 15, 2021
Performance data for WASM SIMD instructions.

WASM SIMD Data This repository contains code and data which can be used to generate a JSON file containing information about the WASM SIMD proposal. F

Evan Nemerson 5 Jul 24, 2022
Python flexible slugify function

Python flexible slugify function

Dmitry Voronin 471 Dec 20, 2022
El Niño - Southern Oscillation analysis compared to minimum flow rates of rivers in northeast Brazil

ENSO (El Niño - Southern Oscillation) analysis in northeast Brazil É comprovada a influência dos fenômenos El Niño e La Niña nas secas no nordesde bra

Weyder Freire 1 Jan 13, 2022
To attract customers, the hotel chain has added to its website the ability to book a room without prepayment

To attract customers, the hotel chain has added to its website the ability to book a room without prepayment. We need to predict whether the customer is going to reject the booking or not. Since in c

Taychinov Evgeniy 0 Aug 04, 2022
Python bindings for the Plex API.

Python-PlexAPI Overview Unofficial Python bindings for the Plex API. Our goal is to match all capabilities of the official Plex Web Client. A few of t

Michael Shepanski 931 Jan 07, 2023
Hack CMU Go Local Project

GoLocal A submission for the annual HackCMU Hackathon. We built a website which connects shopper with local businesses. The goal is to drive consumers

2 Oct 02, 2021
An example project which contains the Unity components necessary to complete Navigation2's SLAM tutorial with a Turtlebot3, using a custom Unity environment in place of Gazebo.

Navigation 2 SLAM Example This example provides a Unity Project and a colcon workspace that, when used together, allows a user to substitute Unity as

Unity Technologies 183 Jan 04, 2023
DOP-Tuning(Domain-Oriented Prefix-tuning model)

DOP-Tuning DOP-Tuning(Domain-Oriented Prefix-tuning model)代码基于Prefix-Tuning改进. Files ├── seq2seq # Code for encoder-decoder arch

Andrew Zeng 5 Nov 02, 2022
Is a polybar module that will show you your progress in Hack The Box

HTB-Status for Polybar Is a polybar module that will show you your progress in Hack The Box indicating your current rank, global rank, points and resp

bitc0de 8 Jan 14, 2022
Birthday program - A program that lookups a birthday txt file and compares to the current date to check for birthdays

Birthday Program This is a program that lookups a birthday txt file and compares

Daquiver 4 Feb 02, 2022