Weather
AirGen allows for randomization of weather conditions as well as time of day. The following weather parameters are available for control:
Rain, Snow, Fog, Dust, Wind.
Scalar parameters such as rain, snow etc. can be controlled using simSetWeatherParameter()
. These weather parameters are only for the visuals and do not affect the drone. For example, to set rain and fog to its maximum level,
import airgen
client.simSetWeatherParameter(airgen.WeatherParameter.Rain, 1.0)
client.simSetWeatherParameter(airgen.WeatherParameter.Fog, 1.0)
On the other hand, the wind vector affects both the visuals as well as the dynamics of the drone, and can be modified through the simSetWind()
API function.
import airgen, time
# Set a 5 m/s wind in X direction for 10 seconds
client.simSetWind(airgen.Vector3r(5, 0, 0))
time.sleep(10)
client.simSetWind(airgen.Vector3r(0, 0, 0))
For setting a desired date/time in the simulation, use simSetTimeofDay()
. This will change the position of the sun and the moon in the sky, and also the lighting conditions. simSetTimeofDay()
takes a datetime string formatted as "YYYY-MM-DD HH:MM:SS". See the following example:
# Set arbitrary day
client.simSetTimeofDay(True, "2024-07-22 12:00:00")
# Set night time
client.simSetTimeofDay(True, "2024-07-22 00:00:00")