Skip to content

Instantly share code, notes, and snippets.

@Kensuke-Mitsuzawa
Last active September 1, 2021 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kensuke-Mitsuzawa/f20f405f03aebf6110a65a0d786ef15e to your computer and use it in GitHub Desktop.
Save Kensuke-Mitsuzawa/f20f405f03aebf6110a65a0d786ef15e to your computer and use it in GitHub Desktop.
Running SUMO traffic simulator on Google Colab

Using SUMO in Goolge Colab

Possible to use SUMO in Google Colab.

Procedure

  1. bash install_sumo.sh
  2. import your scenario data (either from google drive or upload directly)
  3. edit run_sumo.sh
  4. bash run_sumo.sh
apt update
apt-get install -y software-properties-common
add-apt-repository -y ppa:sumo/stable
apt update
apt-get install -y sumo sumo-tools sumo-doc
#!/bin/sh
N_RUN_SUMO=20
PATH_DIR_SCENARIO=''
PATH_OUTPUT=''
CONFIG_NAME_SUMO=''
# no need to edit normally
SUMO_COMMAND='sumo'
SUMO_HOME='/usr/share/sumo'
mkdir ${PATH_OUTPUT}
for ((i=1;i<=${N_RUN_SUMO};i++)); do
echo "running ${i}th iteration..."
cp -r ${PATH_DIR_SCENARIO} ${PATH_OUTPUT}/${i}
sumo -c "${PATH_OUTPUT}/${i}/${CONFIG_NAME_SUMO}" &> ${PATH_OUTPUT}/${i}/sumo.log
echo "done ${i}th iteration"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment