Agrarsense
|
#include <Weather.h>
Public Member Functions | |
AWeather (const FObjectInitializer &ObjectInitializer) | |
void | UpdateWeather (const FWeatherParameters &WeatherParameters, bool updateToROS) |
FString | ExportToJSON (const FString &FileName) |
void | ResetWeather () |
ESeason | GetCurrentSeason () |
ESeason | GetSeasonForMonth (const int Month) |
const FWeatherParameters & | GetCurrentWeather () const |
Public Attributes | |
FLevelEventDelegate_WeatherChanged | OnWeatherChanged |
Protected Member Functions | |
virtual void | BeginPlay () override |
virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
Private Member Functions | |
void | ROSBridgeStateChanged (EROSState ROSState) |
void | DestroyTopic () |
void | InitializeROSTopic () |
void | SendWeatherData (FWeatherParameters Parameters) |
Private Attributes | |
FWeatherParameters | CurrentWeather |
UTopic * | WeatherTopic = nullptr |
UROSIntegrationGameInstance * | RosInstance = nullptr |
bool | ROSConnected = false |
TArray< FWeatherParameters > | WeatherPresets |
TSharedPtr< ROSMessages::std_msgs::String > | Message |
const FWeatherParameters | Default = { 0.0f, 0.0f, 0.1f, 0.05f, 0.0f, 0.2f, 0.0f, 15.0f, 0.0f, 0.0f, 7, 9 } |
AWeather::AWeather | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 17 of file Weather.cpp.
|
overrideprotectedvirtual |
Definition at line 22 of file Weather.cpp.
References CurrentWeather, Default, UAgrarsenseStatics::GetROSHandle(), InitializeROSTopic(), Message, UROSHandler::OnROSStateChanged, ROSBridgeStateChanged(), ROSConnected, and RosInstance.
|
private |
Definition at line 147 of file Weather.cpp.
References WeatherTopic.
Referenced by EndPlay(), and ROSBridgeStateChanged().
|
overrideprotectedvirtual |
Definition at line 47 of file Weather.cpp.
References DestroyTopic(), UAgrarsenseStatics::GetROSHandle(), Message, UROSHandler::OnROSStateChanged, ROSBridgeStateChanged(), and RosInstance.
FString AWeather::ExportToJSON | ( | const FString & | FileName | ) |
Definition at line 115 of file Weather.cpp.
References CurrentWeather, and USimulatorJsonExporter::ExportWeatherToJSON().
Referenced by UROSCommands::HandleExportWeather().
ESeason AWeather::GetCurrentSeason | ( | ) |
Get current season based on current FWeatherParameters Month
Definition at line 68 of file Weather.cpp.
References CurrentWeather, GetSeasonForMonth(), and FWeatherParameters::Month.
|
inline |
Get current FWeatherParameters
Definition at line 76 of file Weather.h.
Referenced by AInstancedRenderer::BeginPlay(), ALidar::BeginPlay(), and USimulatorJsonParser::ChangeWeather().
ESeason AWeather::GetSeasonForMonth | ( | const int | Month | ) |
This function takes a month as input and returns the corresponding season.
Month | The month for which to determine the season. |
Definition at line 73 of file Weather.cpp.
References Autumn, Spring, Summer, and Winter.
Referenced by GetCurrentSeason().
|
private |
Definition at line 120 of file Weather.cpp.
References ROSConnected, RosInstance, and WeatherTopic.
Referenced by BeginPlay(), and ROSBridgeStateChanged().
void AWeather::ResetWeather | ( | ) |
Reset Weather to default
Definition at line 62 of file Weather.cpp.
References CurrentWeather, Default, and UpdateWeather().
|
private |
Definition at line 159 of file Weather.cpp.
References Connected, DestroyTopic(), Disconnected, InitializeROSTopic(), and ROSConnected.
Referenced by BeginPlay(), and EndPlay().
|
private |
Definition at line 138 of file Weather.cpp.
References Message, ROSConnected, FWeatherParameters::ToStringHumanReadable(), and WeatherTopic.
Referenced by UpdateWeather().
void AWeather::UpdateWeather | ( | const FWeatherParameters & | WeatherParameters, |
bool | updateToROS | ||
) |
Function that send current weather data to ROS and updates weather in scene
WeatherParameters | |
isSubscribed | = true, ONLY when subscribe message calls this function |
Definition at line 97 of file Weather.cpp.
References CurrentWeather, OnWeatherChanged, and SendWeatherData().
Referenced by USimulatorJsonParser::ChangeWeather(), and ResetWeather().
|
private |
Definition at line 104 of file Weather.h.
Referenced by BeginPlay(), ExportToJSON(), GetCurrentSeason(), ResetWeather(), and UpdateWeather().
|
private |
Definition at line 119 of file Weather.h.
Referenced by BeginPlay(), and ResetWeather().
|
private |
Definition at line 117 of file Weather.h.
Referenced by BeginPlay(), EndPlay(), and SendWeatherData().
FLevelEventDelegate_WeatherChanged AWeather::OnWeatherChanged |
On Weather changed event
Definition at line 85 of file Weather.h.
Referenced by AInstancedRenderer::BeginPlay(), ALidar::BeginPlay(), AInstancedRenderer::EndPlay(), ALidar::EndPlay(), and UpdateWeather().
|
private |
Definition at line 112 of file Weather.h.
Referenced by BeginPlay(), InitializeROSTopic(), ROSBridgeStateChanged(), and SendWeatherData().
|
private |
Definition at line 110 of file Weather.h.
Referenced by BeginPlay(), EndPlay(), and InitializeROSTopic().
|
private |
|
private |
Definition at line 107 of file Weather.h.
Referenced by DestroyTopic(), InitializeROSTopic(), and SendWeatherData().