Skip to content

Commit a852ffb

Browse files
stefaniapedrazziomichelygoumaz
authored
Remove SUMO from Webots package (cyberbotics#6245)
* Remove sumo from Webots package * Update documentation * Update the instructions * Update instructions for macOS and Windows * Remove code related to bundled sumo * update sumo installation directory path * Update the documentation * Remove last occurrences of Webots sumo folder * Remove references to deleted Makefile * Update sumo-interface.md * Update sumo_supervisor.py * Update sumo-interface.md --------- Co-authored-by: Olivier Michel <Olivier.Michel@cyberbotics.com> Co-authored-by: Yannick Goumaz <61198661+ygoumaz@users.noreply.github.com>
1 parent b86165b commit a852ffb

16 files changed

Lines changed: 79 additions & 161 deletions

File tree

docs/automobile/city-traffic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
This world is an extension of the `city` world.
1010
The road network was extended and some extra trees and buildings were added.
1111
Like in the `city` world, a vehicle is driving autonomously using the on-board camera to follow the central line of the road.
12-
In addition, sumo is used to generate some traffic on the road network.
12+
In addition, SUMO is used to generate some traffic on the road network.

docs/automobile/scenario-creation-tutorial.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
This small tutorial explains step-by-step how to create a scenario inspired from a real world map and then add traffic using SUMO.
44
This tutorial was written for `linux` and `macOS`, but the same can be achieved on `Windows` converting the following commands to `DOS`.
55

6+
Please refer to [these instructions](sumo-interface.md#dependencies) to install SUMO.
7+
68
### Creation of the Webots Project Directory
79

810
```sh
@@ -67,7 +69,7 @@ Finally, you may add a [Fog](../reference/fog.md) node to make your world look n
6769
On Linux, the path to the SUMO binaries and to the Webots libraries directories should be added in your LD\_LIBRARY\_PATH environment variable in order to run the SUMO binaries:
6870

6971
```sh
70-
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WEBOTS_HOME/projects/default/resources/sumo/bin:$WEBOTS_HOME/lib
72+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SUMO_HOME/bin:$WEBOTS_HOME/lib
7173
```
7274

7375
We can also use the previously generated Webots world to generate the SUMO network file.
@@ -80,7 +82,7 @@ You need to use the [netconvert](http://sumo.dlr.de/wiki/NETCONVERT) utility for
8082
```sh
8183
cd $WEBOTS_HOME/resources/sumo_exporter
8284
python exporter.py --input=$WBT_PROJECT_PATH/worlds/myMap.wbt --output=$WBT_PROJECT_PATH/worlds/myMap_net
83-
$WEBOTS_HOME/projects/default/resources/sumo/bin/netconvert --node-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.nod.xml --edge-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.edg.xml --output-file=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
85+
$SUMO_HOME/bin/netconvert --node-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.nod.xml --edge-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.edg.xml --output-file=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
8486
```
8587

8688
%tab-end
@@ -90,7 +92,7 @@ $WEBOTS_HOME/projects/default/resources/sumo/bin/netconvert --node-files=$WBT_PR
9092
```sh
9193
cd $WEBOTS_HOME/Contents/Resources/sumo_exporter
9294
python exporter.py --input=$WBT_PROJECT_PATH/worlds/myMap.wbt --output=$WBT_PROJECT_PATH/worlds/myMap_net
93-
$WEBOTS_HOME/Contents/projects/default/resources/sumo/bin/netconvert --node-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.nod.xml --edge-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.edg.xml --output-file=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
95+
$SUMO_HOME/bin/netconvert --node-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.nod.xml --edge-files=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.edg.xml --output-file=$WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
9496
```
9597

9698
%tab-end
@@ -107,15 +109,15 @@ To do this, open the `sumo.net.xml` file in SUMO `netedit`:
107109
%tab "Linux"
108110

109111
```sh
110-
$WEBOTS_HOME/projects/default/resources/sumo/bin/netedit $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
112+
$SUMO_HOME/netedit $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
111113
```
112114

113115
%tab-end
114116

115117
%tab "macOS"
116118

117119
```sh
118-
$WEBOTS_HOME/Contents/projects/default/resources/sumo/bin/netedit $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
120+
$SUMO_HOME/bin/netedit $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml
119121
```
120122

121123
%tab-end
@@ -142,17 +144,17 @@ Here are the commands to do so:
142144
%tab "Linux"
143145

144146
```sh
145-
python $WEBOTS_HOME/projects/default/resources/sumo/tools/randomTrips.py -n $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml -o $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml
146-
$WEBOTS_HOME/projects/default/resources/sumo/bin/duarouter --trip-files $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml --ignore-errors true
147+
python $SUMO_HOME/tools/randomTrips.py -n $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml -o $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml
148+
$SUMO_HOME/bin/duarouter --trip-files $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml --ignore-errors true
147149
```
148150

149151
%tab-end
150152

151153
%tab "macOS"
152154

153155
```sh
154-
python $WEBOTS_HOME/Contents/projects/default/resources/sumo/tools/randomTrips.py -n $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml -o $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml
155-
$WEBOTS_HOME/Contents/projects/default/resources/sumo/bin/duarouter --trip-files $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml --ignore-errors true
156+
python $SUMO_HOME/tools/randomTrips.py -n $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml -o $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml
157+
$SUMO_HOME/bin/duarouter --trip-files $WBT_PROJECT_PATH/worlds/myMap_net/sumo.trip.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml --ignore-errors true
156158
```
157159

158160
%tab-end
@@ -173,15 +175,15 @@ Then use `SUMO duarouter` to create the target SUMO route file, like this:
173175
%tab "Linux"
174176

175177
```sh
176-
$WEBOTS_HOME/projects/default/resources/sumo/bin/duarouter --flows $WBT_PROJECT_PATH/worlds/myMap_net/sumo.flow.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml
178+
$SUMO_HOME/bin/duarouter --flows $WBT_PROJECT_PATH/worlds/myMap_net/sumo.flow.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml
177179
```
178180

179181
%tab-end
180182

181183
%tab "macOS"
182184

183185
```sh
184-
$WEBOTS_HOME/Contents/projects/default/resources/sumo/bin/duarouter --flows $WBT_PROJECT_PATH/worlds/myMap_net/sumo.flow.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml
186+
$SUMO_HOME/bin/duarouter --flows $WBT_PROJECT_PATH/worlds/myMap_net/sumo.flow.xml --net-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.net.xml --output-file $WBT_PROJECT_PATH/worlds/myMap_net/sumo.rou.xml
185187
```
186188

187189
%tab-end

docs/automobile/sumo-exporter.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# SUMO Exporter
22

3-
In order to be able to simulate traffic in your simulation, it is required to have a SUMO network file (`sumo.net.xml`).
3+
In order to be able to simulate traffic in your simulation, it is required to have the SUMO package installed on the system and a SUMO network file (`sumo.net.xml`).
44
The SUMO exporter can create SUMO network files from a Webots simulation.
55

66
## Dependencies
77

8-
The SUMO exporter is using the `shapely` Python module.
8+
Please refer to [these instructions](sumo-interface.md#dependencies) to install SUMO.
9+
10+
The SUMO exporter is also using the `shapely` Python module.
911
Please refer to [these instructions](openstreetmap-importer.md#dependencies) to install it.
1012

1113
## Expectations on the Webots Simulation
@@ -28,7 +30,7 @@ These files can be used by SUMO `netconvert` to generate the `sumo.net.xml` file
2830
cd $WEBOTS_HOME/resources/sumo_exporter
2931
mkdir myMap_net
3032
python exporter.py --input=myMap.wbt --output=myMap_net
31-
$WEBOTS_HOME/projects/default/resources/sumo/bin/netconvert --node-files=myMap_net/sumo.nod.xml --edge-files=myMap_net/sumo.edg.xml --output-file=myMap_net/sumo.net.xml
33+
$SUMO_HOME/bin/netconvert --node-files=myMap_net/sumo.nod.xml --edge-files=myMap_net/sumo.edg.xml --output-file=myMap_net/sumo.net.xml
3234
```
3335

3436
%tab-end
@@ -39,7 +41,7 @@ $WEBOTS_HOME/projects/default/resources/sumo/bin/netconvert --node-files=myMap_n
3941
cd $WEBOTS_HOME/Contents/Resources/sumo_exporter
4042
mkdir myMap_net
4143
python exporter.py --input=myMap.wbt --output=myMap_net
42-
$WEBOTS_HOME/Contents/projects/default/resources/sumo/bin/netconvert --node-files=myMap_net/sumo.nod.xml --edge-files=myMap_net/sumo.edg.xml --output-file=myMap_net/sumo.net.xml
44+
$SUMO_HOME/bin/netconvert --node-files=myMap_net/sumo.nod.xml --edge-files=myMap_net/sumo.edg.xml --output-file=myMap_net/sumo.net.xml
4345
```
4446

4547
%tab-end

docs/automobile/sumo-interface-example.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ When a priority vehicle arrives from the `vertical` road, it will be detected fr
1313

1414
One of the vehicles moved by SUMO has a [Lidar](../reference/lidar.md) sensor on the front and displays the measured point cloud.
1515
This vehicle showcases the possibility of collecting sensor data for vehicles controlled by SUMO.
16+
17+
> **Note**: SUMO should be installed on the system and the `SUMO_HOME` environment variable should be defined and point to the SUMO installation path.

docs/automobile/sumo-interface.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,44 @@ This interface is written in Python in a [Supervisor](../reference/supervisor.md
88

99
![youtube video](https://www.youtube.com/watch?v=Mnwmo5ivGL0)
1010

11+
### Dependencies
12+
13+
In order to use the SUMO Interface, you have to install the SUMO package on your system.
14+
Please refer to the official [SUMO User Documentation](https://sumo.dlr.de/docs/Installing/index.html) for the complete installation instructions.
15+
16+
#### Debian or Ubuntu
17+
18+
```sh
19+
sudo apt install sumo sumo-tools sumo-doc
20+
```
21+
22+
`SUMO_HOME` environment variable will be automatically set during the installation, but it may be necessary to logout and login, or even reboot, after the installation to correctly run the SUMO Interface.
23+
24+
#### macOS
25+
26+
Using [Homebrew](https://brew.sh), first install [XQuartz](https://www.xquartz.org) for the SUMO interface, that relies on X11, to work:
27+
```sh
28+
brew install --cask xquartz
29+
```
30+
31+
It may be necessary to logout and login or even reboot to activate the XQuartz.
32+
Then, install the lastest stable version of SUMO:
33+
```sh
34+
brew tap dlr-ts/sumo
35+
brew install sumo
36+
```
37+
38+
Finally, setup the `SUMO_HOME` environment variable to point to the directory of your SUMO installation by adding the following line at the end of the `~/.bashrc` file:
39+
```sh
40+
export SUMO_HOME=/your/path/to/sumo
41+
```
42+
43+
The default installation directory is `/opt/homebrew/opt/sumo/share/sumo`.
44+
45+
#### Windows
46+
47+
Download and run the latest installer from the [SUMO documentation](https://sumo.dlr.de/docs/Installing/index.html#windows).
48+
1149
### How to Include the Interface
1250

1351
In order to use this interface, a `SumoInterface` PROTO node should to be added to the world.
@@ -16,15 +54,12 @@ This folder should contain the usual files defining a network in SUMO (.edg.xml,
1654
The configuration files called `sumo.netccfg` and `sumo.sumocfg` will be loaded by default.
1755
If those configuration files do not exist, the interface will look for a configuration file with any other name (it is not recommended to have several configuration files for SUMO or NETCONVERT in the same folder as you don't know which one is going to be used).
1856

19-
> **Note**: Currently version 0.30 of SUMO is distributed with Webots, but if the `SUMO_HOME` environment variable is defined, Webots will use the version of SUMO specified in this variable.
57+
> **Note**: SUMO should be installed on the system and the `SUMO_HOME` environment variable should be defined and point to the SUMO installation path.
2058
2159
The interface will automatically start SUMO and run it in synchronization with Webots time.
2260
Each time a new vehicle enters the SUMO simulation, it will be created in Webots too and its position and orientation will be continually updated.
2361
The vehicle DEF name is set to `SUMO_VEHICLEX`, with `X` being the vehicle number (starting from 0).
2462

25-
> **Note** [macOS]: On macOS, SUMO relies on X11.
26-
You need therefore to install [XQuartz](https://www.xquartz.org) (version 2.7.8 or later) for the interface to work.
27-
2863
### Use Vehicles Already Present in the World
2964

3065
If some vehicles whose DEF name is `SUMO_VEHICLEX` are already present in the world at the simulation start, then the interface will automatically use them before creating new vehicles, this can be useful to avoid real-time addition of vehicles (which can make the simulation speed drop for a very short time).
@@ -158,9 +193,3 @@ The first function is called at initialization of the interface, the arguments a
158193
The second one is called at each SUMO step and the argument is the time step.
159194

160195
Such a plugin can be used for example to change traffic light state in SUMO.
161-
162-
### Using the SUMO Executables Distributed with Webots
163-
164-
SUMO is distributed with Webots, it is located in `WEBOTS_HOME/projects/default/resources/sumo`, you can find all the executables in the `bin` folder.
165-
To be able to use these executables you need first to add `WEBOTS_HOME/projects/default/resources/sumo/bin` to your PATH.
166-
You will then for example be able to use `netedit` to edit your network files.

docs/guide/installation-procedure.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ Execute the following command to install *ffmpeg* with *x264* support:
123123
```bash
124124
conda install x264 ffmpeg -c conda-forge
125125
```
126-
For SUMO, you will need to install libxerces-c-devel, libproj-devel, libgdal-devel, and fox16-devel.
127-
Execute the following commands to enable SUMO on Debian / Ubuntu based distributions:
128-
```bash
129-
sudo apt-get install libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev
130-
```
131126

132127
#### Installing the Snap Package
133128

docs/reference/changelog-r2023.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Released on June 27th, 2023.
3939
- Added a model of suction cup ([#6165](https://github.com/cyberbotics/webots/pull/6165)).
4040
- Cleanup
4141
- Deprecated the C and MATLAB API functions `wb_supervisor_node_enable/disable_contact_point_tracking` in favor of `wb_supervisor_node_enable/disable_contact_points_tracking` to be more consistent with other APIs ([#5633](https://github.com/cyberbotics/webots/pull/5633)).
42+
- Remove SUMO dependency from Webots package ([#6245](https://github.com/cyberbotics/webots/pull/6245)).
4243
- Bug Fixes
4344
- Fixed random crashes while creating [Skin](skin.md) and [Mesh](mesh.md) nodes ([#6218](https://github.com/cyberbotics/webots/pull/6218)).
4445
- Windows: fixed compilation of controller programs located in paths with non-ASCII characters ([#6235](https://github.com/cyberbotics/webots/pull/6235)).
@@ -100,7 +101,6 @@ Released on June 27th, 2023.
100101
- Fixed crash when deleting a [Group](group.md) or a [Pose](pose.md) in a [Led](led.md) or [Charger](charger.md) ([#6226](https://github.com/cyberbotics/webots/pull/6226)).
101102
- Fixed duplicate [Lidar](lidar.md) rotatingHead when exporting to URDF ([#6233](https://github.com/cyberbotics/webots/pull/6233)).
102103
- Dependency Updates
103-
- Change the Windows version of SUMO to 1.13 to match the one used on Linux and macOS and avoid a potiental Log4J vulnerability ([#6010](https://github.com/cyberbotics/webots/pull/6010)).
104104
- Upgraded to Qt6.4.3 on Ubuntu ([#6065](https://github.com/cyberbotics/webots/pull/6065)) and macOS ([#6157](https://github.com/cyberbotics/webots/pull/6157)).
105105
- Cleanup
106106
- Deprecated the C and MATLAB API functions `wb_supervisor_node_enable/disable_contact_point_tracking` in favor of `wb_supervisor_node_enable/disable_contact_points_tracking` to be more consistent with other APIs ([#5633](https://github.com/cyberbotics/webots/pull/5633)).

projects/default/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ include $(WEBOTS_HOME_PATH)/resources/Makefile.os.include
1818

1919
.PHONY: release debug profile clean
2020

21-
TARGETS = controllers/braitenberg.Makefile libraries/vehicle.Makefile resources.Makefile
21+
TARGETS = controllers/braitenberg.Makefile libraries/vehicle.Makefile
2222

2323
ifeq ($(OSTYPE),linux)
2424
TARGETS += controllers/ros.Makefile
@@ -35,8 +35,3 @@ clean: $(TARGETS)
3535
controllers/%.Makefile libraries/%.Makefile:
3636
+@echo "# make" $(MAKECMDGOALS) $(@:.Makefile=)
3737
+@make -s -C $(@:.Makefile=) $(MAKECMDGOALS)
38-
39-
40-
resources.Makefile:
41-
@echo "#"; echo "# *** resources ***"
42-
+@make -s -C resources $(MAKECMDGOALS)

projects/default/controllers/sumo_supervisor/sumo_supervisor.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,28 @@
2424
import sys
2525
import tempfile
2626

27+
28+
def sumoImportError():
29+
sys.stderr.write("SUMO not found.\n")
30+
if sys.platform.startswith('linux'):
31+
sys.stderr.write("Please install it with `sudo apt install sumo sumo-tools` and reboot.\n")
32+
else:
33+
sys.stderr.write("Please install it following the instructions at https://sumo.dlr.de/docs/Installing/.\n")
34+
pass
35+
sys.exit("Or check that the SUMO_HOME environment variable points to the directory of your SUMO installation.")
36+
37+
2738
# we need to import python modules from the $SUMO_HOME/tools directory
2839
try:
2940
WEBOTS_HOME = os.path.normpath(os.environ.get('WEBOTS_HOME'))
3041
if 'SUMO_HOME' in os.environ:
3142
sumoPath = os.environ['SUMO_HOME']
3243
print('Using SUMO from %s' % sumoPath)
33-
print('This might cause version conflicts, unset the "SUMO_HOME" environment variable to use the one from Webots')
3444
else:
35-
sumoPath = WEBOTS_HOME
36-
if sys.platform.startswith('darwin'):
37-
sumoPath = os.path.join(sumoPath, 'Contents')
38-
sumoPath = os.path.join(sumoPath, 'projects', 'default', 'resources', 'sumo')
39-
os.putenv("SUMO_HOME", sumoPath)
45+
sumoImportError()
46+
4047
if sys.platform.startswith('darwin'):
4148
libraryVariablePath = 'DYLD_LIBRARY_PATH'
42-
43-
# Fix the following error (shown on "El Capitan"):
44-
# ./projects/default/resources/sumo/sumo-gui
45-
# Fontconfig error: Cannot load default config file
46-
# Quitting (on unknown error).
47-
if os.path.exists('/opt/local/etc/fonts/fonts.conf'):
48-
os.putenv('FONTCONFIG_PATH', '/opt/local/etc/fonts/')
49-
elif os.path.exists('/opt/X11/lib/X11/fontconfig/fonts.conf'):
50-
os.putenv('FONTCONFIG_PATH', '/opt/X11/lib/X11/fontconfig/')
51-
5249
elif sys.platform.startswith('linux'):
5350
libraryVariablePath = 'LD_LIBRARY_PATH'
5451
else:
@@ -65,7 +62,7 @@
6562
import traci
6663
import sumolib
6764
except ImportError:
68-
sys.exit("Can't find SUMO.")
65+
sumoImportError()
6966

7067

7168
def get_options():

projects/default/resources/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)