Skip to content

Commit

Permalink
Fix for microsoft#507
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Oct 3, 2017
1 parent e371553 commit c9d45cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ void ASimHUD::setupInputBindings()
void ASimHUD::createSimMode()
{
Settings& settings = Settings::singleton();
std::string simmode_name = settings.getString("SimMode", "Quadrotor");
std::string simmode_name = settings.getString("SimMode", "");
if (simmode_name == "")
simmode_name = "Multirotor";

FActorSpawnParameters simmode_spawn_params;
simmode_spawn_params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;

if (simmode_name == "Quadrotor")
if (simmode_name == "Multirotor")
simmode_ = this->GetWorld()->SpawnActor<ASimModeWorldMultiRotor>(FVector::ZeroVector, FRotator::ZeroRotator, simmode_spawn_params);
else if (simmode_name == "Car")
simmode_ = this->GetWorld()->SpawnActor<ASimModeCar>(FVector::ZeroVector, FRotator::ZeroRotator, simmode_spawn_params);
Expand Down
13 changes: 9 additions & 4 deletions Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ void ASimModeBase::readSettings()
}

std::string simmode_name = settings.getString("SimMode", "");
if (simmode_name == "")
simmode_name = "Multirotor";

usage_scenario = settings.getString("UsageScenario", "");
default_vehicle_config = settings.getString("DefaultVehicleConfig", "");
if (default_vehicle_config == "") {
if (simmode_name == "")
if (simmode_name == "Multirotor")
default_vehicle_config = "SimpleFlight";
else
else if (simmode_name == "Car")
default_vehicle_config = "PhysXCar4x4";
else
UAirBlueprintLib::LogMessageString("SimMode is not valid: ", simmode_name, LogDebugLevel::Failure);
}

enable_rpc = settings.getBool("RpcEnabled", true);
Expand All @@ -107,7 +112,7 @@ void ASimModeBase::readSettings()
std::string view_mode_string = settings.getString("ViewMode", "");

if (view_mode_string == "") {
if (simmode_name == "")
if (simmode_name == "Multirotor")
view_mode_string = "FlyWithMe";
else
view_mode_string = "SpringArmChase";
Expand All @@ -128,7 +133,7 @@ void ASimModeBase::readSettings()

physics_engine_name = settings.getString("PhysicsEngineName", "");
if (physics_engine_name == "") {
if (simmode_name == "")
if (simmode_name == "Multirotor")
physics_engine_name = "FastPhysicsEngine";
else
physics_engine_name = "PhysX";
Expand Down
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ And for each flying drone added to the simulator there is a named block of addit

## Other Settings
#### SimMode
Currently SimMode can be set to `"Multirotor"` or `"Car"`. This determines which vehicle you would be using.
Currently SimMode can be set to `""`, `"Multirotor"` or `"Car"`. The empty string value `""` means that use the default vehicle which is `"Multirotor"`. This determines which vehicle you would be using.

#### PhysicsEngineName
For cars, we support only PhysX for now (regardless of value in this setting). For multirotors, we support `"FastPhysicsEngine"` only.
Expand Down

0 comments on commit c9d45cf

Please sign in to comment.