CARLA
 
载入中...
搜索中...
未找到
LibCarla/source/carla/rpc/WeatherParameters.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7// 该指令确保头文件只会被编译器包含一次,防止重复包含导致的编译错误。
8#pragma once
9
10// 引入MsgPack库头文件,用于序列化和反序列化数据。
11#include "carla/MsgPack.h"
12
13#ifdef LIBCARLA_INCLUDED_FROM_UE4
17// 在 Unreal Engine 4 (UE4) 环境中编译时,
18// 包含FWeatherParameters相关头文件,启用和禁用UE4宏。
19#endif // LIBCARLA_INCLUDED_FROM_UE4
20
21namespace carla {
22namespace rpc {
23
25 public:
26
27 /// @name Weather presets
28 /// @{
29 // 一组静态预设值,表示不同的天气条件。
30 static WeatherParameters Default;// 默认天气
31 static WeatherParameters ClearNoon;// 晴朗的中午
32 static WeatherParameters CloudyNoon;// 多云的中午
33 static WeatherParameters WetNoon;///< 湿润的中午
34 static WeatherParameters WetCloudyNoon;// 湿润多云的中午
35 static WeatherParameters MidRainyNoon;// 小雨的中午
36 static WeatherParameters HardRainNoon;// 大雨的中午
37 static WeatherParameters SoftRainNoon;// 柔和的小雨中午
38 static WeatherParameters ClearSunset;// 晴朗的日落
39 static WeatherParameters CloudySunset;// 多云的日落
40 static WeatherParameters WetSunset;// 湿润的日落
41 static WeatherParameters WetCloudySunset;// 湿润多云的日落
42 static WeatherParameters MidRainSunset;// 小雨的日落
43 static WeatherParameters HardRainSunset;// 大雨的日落
44 static WeatherParameters SoftRainSunset;// 柔和的小雨日落
45 static WeatherParameters ClearNight;// 晴朗的夜晚
46 static WeatherParameters CloudyNight;// 多云的夜晚
47 static WeatherParameters WetNight;// 湿润的夜晚
48 static WeatherParameters WetCloudyNight;// 湿润多云的夜晚
49 static WeatherParameters SoftRainNight;// 小雨的夜晚
50 static WeatherParameters MidRainyNight;// 中等强度的雨夜
51 static WeatherParameters HardRainNight;// 大雨的夜晚
52 static WeatherParameters DustStorm;// 尘暴天气
53
54 /// @}
55
56 //默认构造函数,所有参数初始化为默认值0。
57 WeatherParameters() = default;
58
59 //带参数的构造函数,用于初始化天气参数。
61 float in_cloudiness,
62 float in_precipitation,
63 float in_precipitation_deposits,
64 float in_wind_intensity,
65 float in_sun_azimuth_angle,
66 float in_sun_altitude_angle,
67 float in_fog_density,
68 float in_fog_distance,
69 float in_fog_falloff,
70 float in_wetness,
71 float in_scattering_intensity,
72 float in_mie_scattering_scale,
73 float in_rayleigh_scattering_scale,
74 float in_dust_storm)
75 : cloudiness(in_cloudiness),
76 precipitation(in_precipitation),
77 precipitation_deposits(in_precipitation_deposits),
78 wind_intensity(in_wind_intensity),
79 sun_azimuth_angle(in_sun_azimuth_angle),
80 sun_altitude_angle(in_sun_altitude_angle),
81 fog_density(in_fog_density),
82 fog_distance(in_fog_distance),
83 fog_falloff(in_fog_falloff),
84 wetness(in_wetness),
85 scattering_intensity(in_scattering_intensity),
86 mie_scattering_scale(in_mie_scattering_scale),
87 rayleigh_scattering_scale(in_rayleigh_scattering_scale),
88 dust_storm(in_dust_storm) {}
89
90 float cloudiness = 0.0f;// 云量
91 float precipitation = 0.0f;// 降水量
92 float precipitation_deposits = 0.0f;// 降水残留物的积累程度
93 float wind_intensity = 0.0f;// 风力强度
94 float sun_azimuth_angle = 0.0f;// 太阳方位角度
95 float sun_altitude_angle = 0.0f;// 太阳仰角
96 float fog_density = 0.0f;// 雾的密度
97 float fog_distance = 0.0f;// 雾的能见度距离
98 float fog_falloff = 0.0f;// 雾的衰减程度
99 float wetness = 0.0f;// 湿润度
100 float scattering_intensity = 0.0f;//光散射强度
101 float mie_scattering_scale = 0.0f;//Mie散射缩放
102 float rayleigh_scattering_scale = 0.0331f;//Rayleigh散射缩放
103 float dust_storm = 0.0f;//尘暴强度
104
105#ifdef LIBCARLA_INCLUDED_FROM_UE4
106
107 //构造函数:从UE4的FWeatherParameters初始化WeatherParameters
108 //Weather传入的FWeatherParameters对象,用于设置当前对象的属性。
110 : cloudiness(Weather.Cloudiness),
111 precipitation(Weather.Precipitation),
112 precipitation_deposits(Weather.PrecipitationDeposits),
113 wind_intensity(Weather.WindIntensity),
114 sun_azimuth_angle(Weather.SunAzimuthAngle),
115 sun_altitude_angle(Weather.SunAltitudeAngle),
116 fog_density(Weather.FogDensity),
117 fog_distance(Weather.FogDistance),
118 fog_falloff(Weather.FogFalloff),
119 wetness(Weather.Wetness),
120 scattering_intensity(Weather.ScatteringIntensity),
121 mie_scattering_scale(Weather.MieScatteringScale),
122 rayleigh_scattering_scale(Weather.RayleighScatteringScale),
123 dust_storm(Weather.DustStorm) {}
124
125 operator FWeatherParameters() const {
126 FWeatherParameters Weather;
127 Weather.Cloudiness = cloudiness;
133 Weather.FogDensity = fog_density;
134 Weather.FogDistance = fog_distance;
135 Weather.FogFalloff = fog_falloff;
136 Weather.Wetness = wetness;
140 Weather.DustStorm = dust_storm;
141 return Weather;
142 }
143
144#endif // LIBCARLA_INCLUDED_FROM_UE4
145
146 //检查两个WeatherParameters对象是否不相等,如果两个对象的任意属性不同,则返回 true,否则返回 false。
164
165 bool operator==(const WeatherParameters &rhs) const {
166 return !(*this != rhs);
167 }
168
169 //定义 WeatherParameters对象的序列化顺序,便于打包和解包
180 wetness,
184 dust_storm);
185 };
186
187} // namespace rpc
188} // namespace carla
MSGPACK_DEFINE_ARRAY(cloudiness, precipitation, precipitation_deposits, wind_intensity, sun_azimuth_angle, sun_altitude_angle, fog_density, fog_distance, fog_falloff, wetness, scattering_intensity, mie_scattering_scale, rayleigh_scattering_scale, dust_storm)
static WeatherParameters WetNoon
湿润的中午
bool operator==(const WeatherParameters &rhs) const
bool operator!=(const WeatherParameters &rhs) const
WeatherParameters(float in_cloudiness, float in_precipitation, float in_precipitation_deposits, float in_wind_intensity, float in_sun_azimuth_angle, float in_sun_altitude_angle, float in_fog_density, float in_fog_distance, float in_fog_falloff, float in_wetness, float in_scattering_intensity, float in_mie_scattering_scale, float in_rayleigh_scattering_scale, float in_dust_storm)
CARLA模拟器的主命名空间。
Definition Carla.cpp:139