-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcarla_weather.py
41 lines (30 loc) · 901 Bytes
/
carla_weather.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import sys, os, glob, time
try:
sys.path.append(glob.glob('carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
import carla
from carla import VehicleLightState as vls
def main():
# Client creation
client = carla.Client('localhost', 2000)
client.set_timeout(10.0)
# World connection
world = client.get_world()
# Set weather (this does not affect physics. It only changes the visual captured by the camera sensors)
weather = carla.WeatherParameters(
cloudiness=80.0,
precipitation=30.0,
sun_altitude_angle=70.0)
world.set_weather(weather)
print(world.get_weather())
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
finally:
print('\ndone.')