Skip to content

Hyeongseok-Jeon/SUMO-to-MORAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SUMO-to-MORAI

This repository is to interlock SUMO simulator to MORAI simulator Traffic flow generated from SUMO simulator is visualized in MORAI Simulator via ROS communication

Overall repository is based on Unbuntu 18.04.6 LTS and ROS Melodic

Table of Contents

SUMO-Install

sudo add-apt-repository ppa:sumo/stable
sudo apt-get update
sudo apt-get install sumo sumo-tools sumo-doc

for setting environment variable SUMO_HOME=/usr/share/sumo, refer SUMO Environment Setting

SUMO Version 1.10.0 is used

ROS-Install

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo rosdep init
rosdep update

More detailed description, please refer to ROS

SUMO-simulation-configuration

This repository is tested only for the openDRIVE based map format.

In order to get test_map.xodr files for the map, please contect MORAI

If you already have test_map.xodr files, you need to move test_map.xodr files to sumo2morai/sumo/xodrs

Then test_map.xodr file has to be converted to SUMO net file with following command

netconvert --opendrive sumo2morai/sumo/xodrs/test_map.xodr -o sumo2morai/sumo/nets/test_map.net.xml

Using the SUMO net file, random trips can be generated in route file as belows.

python /usr/share/sumo/tools/randomTrips.py -n sumo2morai/sumo/nets/suburb_02.net.xml -e 3600 -r sumo2morai/sumo/routes/suburb_02.rou.xml --period 2 --binomial 2 --trip-attributes 'departLane="0" departSpeed="max" departPos="0"' --weights-prefix sumo2morai/sumo/weights/suburb_02 --random

More detail information on the random trip of SUMO simulator, please refer SUMO-randomTrips.py

Finally, in sumo2morai/sumo/sumocfgs/, please make test_map.sumocfg file with text editor.

<configuration>

<input>
<net-file value="../nets/test_map.net.xml"/>
<route-files value="../routes/test_map.rou.xml"/>
</input>
<time>
<begin value="0"/>
<end value="3600"/>
</time>

</configuration>

Building-ROS-Package

For specifying the map and trips generated in SUMO simulation configuration,

find Line 123 in test.py in src/npc_ghost_test/scrips which is follows.

traci.start([sumoBinary, "-c", "sumo/sumocfgs/test_map.sumocfg","--step-length", "0.01"])

you need to modify above command with your custom map name as

traci.start([sumoBinary, "-c", "sumo/sumocfgs/KAIST_Munji_Campus.sumocfg","--step-length", "0.01"])

In sumo2morai/,

catkin_make
source devel/setup.bash

Running-the-Simulations

  1. Run MORAI Simulator and select test_map
  2. In new terminal
roscore
  1. In new terminal,
cd <repository_root>/sumo2morai
source devel/setup.bash
roslaunch rosbridge_server rosbridge_websocket.launch
  1. In MORAI simulator, PlayMode -> Ghost -> NPC Ghost Mode -> Apply
  2. In new terminal,
cd <repository_root>/sumo2morai
source devel/setup.bash
rosrun npc_ghost_test test.py
  1. In SUMO simulator, make Delay(ms) as 1000
  2. run the SUMO simulator

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published