diff --git a/README.md b/README.md index fc2cb6286e..b93cdbea91 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Yet another way to use AirSim is the so-called "Computer Vision" mode. In this m ### Weather Effects -Press F10 to see various options available for weather effects. You can also control the weather using [APIs](https://microsoft.github.io/AirSim/apis#weather-apis). Press F1 to see other options available. +Press F10 to see various options available for weather effects. You can also control the weather using [APIs](https://microsoft.github.io/AirSim/apis#weather-apis). Press F9 to see other options available. ![record screenshot](docs/images/weather_menu.png) diff --git a/Unreal/Environments/Blocks/Config/DefaultInput.ini b/Unreal/Environments/Blocks/Config/DefaultInput.ini index 78803ce4f1..9a79443647 100644 --- a/Unreal/Environments/Blocks/Config/DefaultInput.ini +++ b/Unreal/Environments/Blocks/Config/DefaultInput.ini @@ -12,6 +12,49 @@ bDefaultViewportMouseLock=False DefaultViewportMouseLockMode=DoNotLock bAlwaysShowTouchInterface=False bShowConsoleOnFourFingerTap=True ++ActionMappings=(ActionName="inputEventToggleRecording",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R) ++ActionMappings=(ActionName="InputEventToggleReport",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Semicolon) ++ActionMappings=(ActionName="InputEventToggleHelp",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=F9) ++ActionMappings=(ActionName="InputEventToggleTrace",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=T) ++ActionMappings=(ActionName="InputEventToggleSubwindow0",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=One) ++ActionMappings=(ActionName="InputEventToggleSubwindow1",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two) ++ActionMappings=(ActionName="InputEventToggleSubwindow2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Three) ++ActionMappings=(ActionName="InputEventToggleAll",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Zero) ++ActionMappings=(ActionName="inputEventFpvView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=F) ++ActionMappings=(ActionName="inputEventFlyWithView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=B) ++ActionMappings=(ActionName="inputEventGroundView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Backslash) ++ActionMappings=(ActionName="inputEventManualView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=M) ++ActionMappings=(ActionName="inputEventSpringArmChaseView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Slash) ++ActionMappings=(ActionName="inputEventBackupView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=K) ++ActionMappings=(ActionName="inputEventNoDisplayView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Hyphen) ++ActionMappings=(ActionName="inputEventFrontView",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=I) ++ActionMappings=(ActionName="InputEventResetVehicles",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=BackSpace) ++ActionMappings=(ActionName="inputEventToggleWeather",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=F10) ++ActionMappings=(ActionName="Handbrake",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=End) ++ActionMappings=(ActionName="Handbrake",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Right) ++AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Up) ++AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=Down) ++AxisMappings=(AxisName="MoveRight",Scale=-0.500000,Key=Left) ++AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Gamepad_RightTriggerAxis) ++AxisMappings=(AxisName="Footbrake",Scale=1.000000,Key=SpaceBar) ++AxisMappings=(AxisName="Footbrake",Scale=1.000000,Key=Gamepad_LeftShoulder) ++AxisMappings=(AxisName="inputManualForward",Scale=1.000000,Key=Up) ++AxisMappings=(AxisName="inputManualArrowUp",Scale=1.000000,Key=PageUp) ++AxisMappings=(AxisName="inputManualUpPitch",Scale=1.000000,Key=W) ++AxisMappings=(AxisName="inputManualSpeedIncrease",Scale=1.000000,Key=LeftShift) ++AxisMappings=(AxisName="inputManualForward",Scale=-1.000000,Key=Down) ++AxisMappings=(AxisName="inputManualArrowUp",Scale=-1.000000,Key=PageDown) ++AxisMappings=(AxisName="inputManualRightYaw",Scale=-1.000000,Key=A) ++AxisMappings=(AxisName="inputManualRightRoll",Scale=-1.000000,Key=Q) ++AxisMappings=(AxisName="inputManualUpPitch",Scale=-1.000000,Key=S) ++AxisMappings=(AxisName="inputManualSpeedIncrease",Scale=-1.000000,Key=LeftControl) ++AxisMappings=(AxisName="MoveRight",Scale=0.500000,Key=Right) ++AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=Gamepad_LeftX) ++AxisMappings=(AxisName="inputManualRightYaw",Scale=1.000000,Key=D) ++AxisMappings=(AxisName="inputManualRightRoll",Scale=1.000000,Key=E) ++AxisMappings=(AxisName="inputManualArrowRight",Scale=-1.000000,Key=Left) ++AxisMappings=(AxisName="inputManualArrowRight",Scale=1.000000,Key=Right) ++AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=Gamepad_LeftTriggerAxis) DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks ConsoleKey=None -ConsoleKeys=Tilde diff --git a/Unreal/Plugins/AirSim/Content/Blueprints/BP_SimHUDWidget.uasset b/Unreal/Plugins/AirSim/Content/Blueprints/BP_SimHUDWidget.uasset index 43adf255fd..805a9a1ea6 100644 Binary files a/Unreal/Plugins/AirSim/Content/Blueprints/BP_SimHUDWidget.uasset and b/Unreal/Plugins/AirSim/Content/Blueprints/BP_SimHUDWidget.uasset differ diff --git a/Unreal/Plugins/AirSim/Content/HUDAssets/OptionsMenu.uasset b/Unreal/Plugins/AirSim/Content/HUDAssets/OptionsMenu.uasset index b4f4eb682c..bd86ca669c 100644 Binary files a/Unreal/Plugins/AirSim/Content/HUDAssets/OptionsMenu.uasset and b/Unreal/Plugins/AirSim/Content/HUDAssets/OptionsMenu.uasset differ diff --git a/Unreal/Plugins/AirSim/Content/Weather/UI/MenuActor.uasset b/Unreal/Plugins/AirSim/Content/Weather/UI/MenuActor.uasset index 681bd854ce..e645b377ae 100644 Binary files a/Unreal/Plugins/AirSim/Content/Weather/UI/MenuActor.uasset and b/Unreal/Plugins/AirSim/Content/Weather/UI/MenuActor.uasset differ diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp index e7289d6998..5f2221e313 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp @@ -712,6 +712,29 @@ int UAirBlueprintLib::RemoveAxisBinding(const FInputAxisKeyMapping& axis, FInput return -1; } +int UAirBlueprintLib::RemoveAxisBinding(FInputAxisBinding* axis_binding, AActor* actorForWorldContext) +{ + if (axis_binding == nullptr && actorForWorldContext == nullptr) { + return -1; + } + + APlayerController* controller = actorForWorldContext->GetWorld()->GetFirstPlayerController(); + //removing binding + int found_binding_index = -1, cur_binding_index = -1; + for (const auto& axisBindingArrayEntry : controller->InputComponent->AxisBindings) { + ++cur_binding_index; + if (axisBindingArrayEntry.AxisName == axis_binding->AxisName) { + found_binding_index = cur_binding_index; + break; + } + } + if (found_binding_index >= 0) { + controller->InputComponent->AxisBindings.RemoveAt(found_binding_index); + } + + return found_binding_index; +} + float UAirBlueprintLib::GetDisplayGamma() { return GEngine->DisplayGamma; @@ -722,6 +745,11 @@ void UAirBlueprintLib::EnableInput(AActor* actor) actor->EnableInput(actor->GetWorld()->GetFirstPlayerController()); } +void UAirBlueprintLib::DisableInput(AActor* actor) +{ + actor->DisableInput(actor->GetWorld()->GetFirstPlayerController()); +} + UObject* UAirBlueprintLib::LoadObject(const std::string& name) { FString str(name.c_str()); diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h index 86bc8b21d9..afb38f9538 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h @@ -139,6 +139,15 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary return controller->InputComponent->BindAction(action_name, on_press_or_release ? IE_Pressed : IE_Released, actor, func); } + // BindAction helper function to allow utilization of Unreal's Input mapping from Project Settings. + template <class UserClass> + static FInputActionBinding& BindAction(const FName action_name, AActor* actorForWorldContext, UserClass* obj, + typename FInputActionHandlerSignature::TUObjectMethodDelegate<UserClass>::FMethodPtr func, bool on_press_or_release = false) + { + APlayerController* controller = actorForWorldContext->GetWorld()->GetFirstPlayerController(); + return controller->InputComponent->BindAction(action_name, on_press_or_release ? IE_Pressed : IE_Released, obj, func); + } + template <class UserClass> static FInputAxisBinding& BindAxisToKey(const FName axis_name, const FKey in_key, AActor* actor, UserClass* obj, typename FInputAxisHandlerSignature::TUObjectMethodDelegate<UserClass>::FMethodPtr func) @@ -158,9 +167,20 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary return controller->InputComponent->BindAxis(axis.AxisName, obj, func); } + // BindAxis helper function to allow utilization of Unreal's Input mapping from Project Settings. + template <class UserClass> + static FInputAxisBinding& BindAxis(const FName axis_name, AActor* actorForWorldContext, UserClass* obj, + typename FInputAxisHandlerSignature::TUObjectMethodDelegate<UserClass>::FMethodPtr func) + { + APlayerController* controller = actorForWorldContext->GetWorld()->GetFirstPlayerController(); + return controller->InputComponent->BindAxis(axis_name, obj, func); + } + static int RemoveAxisBinding(const FInputAxisKeyMapping& axis, FInputAxisBinding* axis_binding, AActor* actor); + static int RemoveAxisBinding(FInputAxisBinding* axis_binding, AActor* actorForWorldContext); static void EnableInput(AActor* actor); + static void DisableInput(AActor* actor); static void RunCommandOnGameThread(TFunction<void()> InFunction, bool wait = false, const TStatId InStatId = TStatId()); diff --git a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp b/Unreal/Plugins/AirSim/Source/CameraDirector.cpp index 43f0a3f2ad..3f3b373ffb 100644 --- a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp +++ b/Unreal/Plugins/AirSim/Source/CameraDirector.cpp @@ -187,14 +187,14 @@ void ACameraDirector::setupInputBindings() { UAirBlueprintLib::EnableInput(this); - UAirBlueprintLib::BindActionToKey("inputEventFpvView", EKeys::F, this, &ACameraDirector::inputEventFpvView); - UAirBlueprintLib::BindActionToKey("inputEventFlyWithView", EKeys::B, this, &ACameraDirector::inputEventFlyWithView); - UAirBlueprintLib::BindActionToKey("inputEventGroundView", EKeys::Backslash, this, &ACameraDirector::inputEventGroundView); - UAirBlueprintLib::BindActionToKey("inputEventManualView", EKeys::M, this, &ACameraDirector::inputEventManualView); - UAirBlueprintLib::BindActionToKey("inputEventSpringArmChaseView", EKeys::Slash, this, &ACameraDirector::inputEventSpringArmChaseView); - UAirBlueprintLib::BindActionToKey("inputEventBackupView", EKeys::K, this, &ACameraDirector::inputEventBackupView); - UAirBlueprintLib::BindActionToKey("inputEventNoDisplayView", EKeys::Hyphen, this, &ACameraDirector::inputEventNoDisplayView); - UAirBlueprintLib::BindActionToKey("inputEventFrontView", EKeys::I, this, &ACameraDirector::inputEventFrontView); + UAirBlueprintLib::BindAction("inputEventFpvView", this, this, &ACameraDirector::inputEventFpvView); + UAirBlueprintLib::BindAction("inputEventFlyWithView", this, this, &ACameraDirector::inputEventFlyWithView); + UAirBlueprintLib::BindAction("inputEventGroundView", this, this, &ACameraDirector::inputEventGroundView); + UAirBlueprintLib::BindAction("inputEventManualView", this, this, &ACameraDirector::inputEventManualView); + UAirBlueprintLib::BindAction("inputEventSpringArmChaseView", this, this, &ACameraDirector::inputEventSpringArmChaseView); + UAirBlueprintLib::BindAction("inputEventBackupView", this, this, &ACameraDirector::inputEventBackupView); + UAirBlueprintLib::BindAction("inputEventNoDisplayView", this, this, &ACameraDirector::inputEventNoDisplayView); + UAirBlueprintLib::BindAction("inputEventFrontView", this, this, &ACameraDirector::inputEventFrontView); } void ACameraDirector::EndPlay(const EEndPlayReason::Type EndPlayReason) @@ -292,7 +292,7 @@ void ACameraDirector::inputEventFrontView() disableCameras(true, true, true, false); } else - UAirBlueprintLib::LogMessageString("Camera is not available: ", "backup_camera", LogDebugLevel::Failure); + UAirBlueprintLib::LogMessageString("Camera is not available: ", "front_camera", LogDebugLevel::Failure); notifyViewModeChanged(); } diff --git a/Unreal/Plugins/AirSim/Source/ManualPoseController.cpp b/Unreal/Plugins/AirSim/Source/ManualPoseController.cpp index 87cf0bacd0..6a258ae18d 100644 --- a/Unreal/Plugins/AirSim/Source/ManualPoseController.cpp +++ b/Unreal/Plugins/AirSim/Source/ManualPoseController.cpp @@ -6,21 +6,7 @@ void UManualPoseController::initializeForPlay() actor_ = nullptr; clearBindings(); - left_mapping_ = FInputAxisKeyMapping("inputManualArrowLeft", EKeys::Left); - right_mapping_ = FInputAxisKeyMapping("inputManualArrowRight", EKeys::Right); - forward_mapping_ = FInputAxisKeyMapping("inputManualForward", EKeys::Up); - backward_mapping_ = FInputAxisKeyMapping("inputManualBackward", EKeys::Down); - up_mapping_ = FInputAxisKeyMapping("inputManualArrowUp", EKeys::PageUp); - down_mapping_ = FInputAxisKeyMapping("inputManualArrowDown", EKeys::PageDown); - left_yaw_mapping_ = FInputAxisKeyMapping("inputManualLeftYaw", EKeys::A); - right_yaw_mapping_ = FInputAxisKeyMapping("inputManualRightYaw", EKeys::D); - left_roll_mapping_ = FInputAxisKeyMapping("inputManualLefRoll", EKeys::Q); - right_roll_mapping_ = FInputAxisKeyMapping("inputManualRightRoll", EKeys::E); - up_pitch_mapping_ = FInputAxisKeyMapping("inputManualUpPitch", EKeys::W); - down_pitch_mapping_ = FInputAxisKeyMapping("inputManualDownPitch", EKeys::S); - inc_speed_mapping_ = FInputAxisKeyMapping("inputManualSpeedIncrease", EKeys::LeftShift); - dec_speed_mapping_ = FInputAxisKeyMapping("inputManualSpeedDecrease", EKeys::LeftControl); - input_positive_ = inpute_negative_ = last_velocity_ = FVector::ZeroVector; + input_ = last_velocity_ = FVector::ZeroVector; } void UManualPoseController::clearBindings() @@ -80,61 +66,25 @@ void UManualPoseController::resetDelta() void UManualPoseController::removeInputBindings() { - if (left_binding_) - UAirBlueprintLib::RemoveAxisBinding(left_mapping_, left_binding_, actor_); - if (right_binding_) - UAirBlueprintLib::RemoveAxisBinding(right_mapping_, right_binding_, actor_); - if (forward_binding_) - UAirBlueprintLib::RemoveAxisBinding(forward_mapping_, forward_binding_, actor_); - if (backward_binding_) - UAirBlueprintLib::RemoveAxisBinding(backward_mapping_, backward_binding_, actor_); - if (up_binding_) - UAirBlueprintLib::RemoveAxisBinding(up_mapping_, up_binding_, actor_); - if (down_binding_) - UAirBlueprintLib::RemoveAxisBinding(down_mapping_, down_binding_, actor_); - if (left_yaw_binding_) - UAirBlueprintLib::RemoveAxisBinding(left_yaw_mapping_, left_yaw_binding_, actor_); - if (right_yaw_binding_) - UAirBlueprintLib::RemoveAxisBinding(right_yaw_mapping_, right_yaw_binding_, actor_); - if (left_roll_binding_) - UAirBlueprintLib::RemoveAxisBinding(left_roll_mapping_, left_roll_binding_, actor_); - if (right_roll_binding_) - UAirBlueprintLib::RemoveAxisBinding(right_roll_mapping_, right_roll_binding_, actor_); - if (up_pitch_binding_) - UAirBlueprintLib::RemoveAxisBinding(up_pitch_mapping_, up_pitch_binding_, actor_); - if (down_pitch_binding_) - UAirBlueprintLib::RemoveAxisBinding(down_pitch_mapping_, down_pitch_binding_, actor_); - if (inc_speed_binding_) - UAirBlueprintLib::RemoveAxisBinding(inc_speed_mapping_, inc_speed_binding_, actor_); - if (dec_speed_binding_) - UAirBlueprintLib::RemoveAxisBinding(dec_speed_mapping_, dec_speed_binding_, actor_); - - clearBindings(); + UAirBlueprintLib::DisableInput(actor_); } void UManualPoseController::setupInputBindings() { UAirBlueprintLib::EnableInput(actor_); - left_binding_ = &UAirBlueprintLib::BindAxisToKey(left_mapping_, actor_, this, &UManualPoseController::inputManualLeft); - right_binding_ = &UAirBlueprintLib::BindAxisToKey(right_mapping_, actor_, this, &UManualPoseController::inputManualRight); - forward_binding_ = &UAirBlueprintLib::BindAxisToKey(forward_mapping_, actor_, this, &UManualPoseController::inputManualForward); - backward_binding_ = &UAirBlueprintLib::BindAxisToKey(backward_mapping_, actor_, this, &UManualPoseController::inputManualBackward); - up_binding_ = &UAirBlueprintLib::BindAxisToKey(up_mapping_, actor_, this, &UManualPoseController::inputManualMoveUp); - down_binding_ = &UAirBlueprintLib::BindAxisToKey(down_mapping_, actor_, this, &UManualPoseController::inputManualDown); - left_yaw_binding_ = &UAirBlueprintLib::BindAxisToKey(left_yaw_mapping_, actor_, this, &UManualPoseController::inputManualLeftYaw); - right_yaw_binding_ = &UAirBlueprintLib::BindAxisToKey(right_yaw_mapping_, actor_, this, &UManualPoseController::inputManualRightYaw); - left_roll_binding_ = &UAirBlueprintLib::BindAxisToKey(left_roll_mapping_, actor_, this, &UManualPoseController::inputManualLeftRoll); - right_roll_binding_ = &UAirBlueprintLib::BindAxisToKey(right_roll_mapping_, actor_, this, &UManualPoseController::inputManualRightRoll); - up_pitch_binding_ = &UAirBlueprintLib::BindAxisToKey(up_pitch_mapping_, actor_, this, &UManualPoseController::inputManualUpPitch); - down_pitch_binding_ = &UAirBlueprintLib::BindAxisToKey(down_pitch_mapping_, actor_, this, &UManualPoseController::inputManualDownPitch); - inc_speed_binding_ = &UAirBlueprintLib::BindAxisToKey(inc_speed_mapping_, actor_, this, &UManualPoseController::inputManualSpeedIncrease); - dec_speed_binding_ = &UAirBlueprintLib::BindAxisToKey(dec_speed_mapping_, actor_, this, &UManualPoseController::inputManualSpeedDecrease); + UAirBlueprintLib::BindAxis("inputManualArrowRight", getActor(), this, &UManualPoseController::inputManualMoveRight); + UAirBlueprintLib::BindAxis("inputManualForward", getActor(), this, &UManualPoseController::inputManualMoveForward); + UAirBlueprintLib::BindAxis("inputManualArrowUp", getActor(), this, &UManualPoseController::inputManualMoveUp); + UAirBlueprintLib::BindAxis("inputManualRightYaw", getActor(), this, &UManualPoseController::inputManualYaw); + UAirBlueprintLib::BindAxis("inputManualRightRoll", getActor(), this, &UManualPoseController::inputManualRoll); + UAirBlueprintLib::BindAxis("inputManualUpPitch", getActor(), this, &UManualPoseController::inputManualPitch); + UAirBlueprintLib::BindAxis("inputManualSpeedIncrease", getActor(), this, &UManualPoseController::inputManualSpeedChange); } void UManualPoseController::updateDeltaPosition(float dt) { - FVector input = input_positive_ - inpute_negative_; + FVector input = input_; if (!FMath::IsNearlyZero(input.SizeSquared())) { if (FMath::IsNearlyZero(acceleration_)) last_velocity_ = input * speed_scaler_; @@ -147,71 +97,40 @@ void UManualPoseController::updateDeltaPosition(float dt) } } -void UManualPoseController::inputManualSpeedIncrease(float val) +void UManualPoseController::inputManualSpeedChange(float val) { if (!FMath::IsNearlyEqual(val, 0.f)) speed_scaler_ += val * 20; -} -void UManualPoseController::inputManualSpeedDecrease(float val) -{ - if (!FMath::IsNearlyEqual(val, 0.f)) - speed_scaler_ -= val * 20; if (speed_scaler_ <= 0.0) speed_scaler_ = 20.0; } -void UManualPoseController::inputManualLeft(float val) +void UManualPoseController::inputManualMoveRight(float val) { - inpute_negative_.Y = val; + input_.Y = val; } -void UManualPoseController::inputManualRight(float val) +void UManualPoseController::inputManualMoveForward(float val) { - input_positive_.Y = val; -} -void UManualPoseController::inputManualForward(float val) -{ - input_positive_.X = val; -} -void UManualPoseController::inputManualBackward(float val) -{ - inpute_negative_.X = val; + input_.X = val; } void UManualPoseController::inputManualMoveUp(float val) { - input_positive_.Z = val; -} -void UManualPoseController::inputManualDown(float val) -{ - inpute_negative_.Z = val; + input_.Z = val; } -void UManualPoseController::inputManualLeftYaw(float val) -{ - if (!FMath::IsNearlyEqual(val, 0.f)) - delta_rotation_.Add(0, -val, 0); -} -void UManualPoseController::inputManualRightYaw(float val) + +void UManualPoseController::inputManualYaw(float val) { if (!FMath::IsNearlyEqual(val, 0.f)) delta_rotation_.Add(0, val, 0); } -void UManualPoseController::inputManualLeftRoll(float val) -{ - if (!FMath::IsNearlyEqual(val, 0.f)) - delta_rotation_.Add(0, 0, -val); -} -void UManualPoseController::inputManualRightRoll(float val) +void UManualPoseController::inputManualRoll(float val) { if (!FMath::IsNearlyEqual(val, 0.f)) delta_rotation_.Add(0, 0, val); } -void UManualPoseController::inputManualUpPitch(float val) +void UManualPoseController::inputManualPitch(float val) { if (!FMath::IsNearlyEqual(val, 0.f)) delta_rotation_.Add(val, 0, 0); } -void UManualPoseController::inputManualDownPitch(float val) -{ - if (!FMath::IsNearlyEqual(val, 0.f)) - delta_rotation_.Add(-val, 0, 0); -} diff --git a/Unreal/Plugins/AirSim/Source/ManualPoseController.h b/Unreal/Plugins/AirSim/Source/ManualPoseController.h index 5a4b5aa85a..678c69bd2a 100644 --- a/Unreal/Plugins/AirSim/Source/ManualPoseController.h +++ b/Unreal/Plugins/AirSim/Source/ManualPoseController.h @@ -21,20 +21,13 @@ class AIRSIM_API UManualPoseController : public UObject void updateDeltaPosition(float dt); private: - void inputManualLeft(float val); - void inputManualRight(float val); - void inputManualForward(float val); - void inputManualBackward(float val); + void inputManualMoveForward(float val); + void inputManualMoveRight(float val); void inputManualMoveUp(float val); - void inputManualDown(float val); - void inputManualLeftYaw(float val); - void inputManualRightYaw(float val); - void inputManualLeftRoll(float val); - void inputManualRightRoll(float val); - void inputManualUpPitch(float val); - void inputManualDownPitch(float val); - void inputManualSpeedIncrease(float val); - void inputManualSpeedDecrease(float val); + void inputManualYaw(float val); + void inputManualRoll(float val); + void inputManualPitch(float val); + void inputManualSpeedChange(float val); void setupInputBindings(); void removeInputBindings(); @@ -57,6 +50,6 @@ class AIRSIM_API UManualPoseController : public UObject AActor* actor_; float acceleration_ = 0, speed_scaler_ = 1000; - FVector input_positive_, inpute_negative_; + FVector input_; FVector last_velocity_; }; \ No newline at end of file diff --git a/Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp b/Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp index 283109e398..4427534410 100644 --- a/Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp +++ b/Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp @@ -202,15 +202,15 @@ void ASimHUD::setupInputBindings() { UAirBlueprintLib::EnableInput(this); - UAirBlueprintLib::BindActionToKey("inputEventToggleRecording", EKeys::R, this, &ASimHUD::inputEventToggleRecording); - UAirBlueprintLib::BindActionToKey("InputEventToggleReport", EKeys::Semicolon, this, &ASimHUD::inputEventToggleReport); - UAirBlueprintLib::BindActionToKey("InputEventToggleHelp", EKeys::F1, this, &ASimHUD::inputEventToggleHelp); - UAirBlueprintLib::BindActionToKey("InputEventToggleTrace", EKeys::T, this, &ASimHUD::inputEventToggleTrace); - - UAirBlueprintLib::BindActionToKey("InputEventToggleSubwindow0", EKeys::One, this, &ASimHUD::inputEventToggleSubwindow0); - UAirBlueprintLib::BindActionToKey("InputEventToggleSubwindow1", EKeys::Two, this, &ASimHUD::inputEventToggleSubwindow1); - UAirBlueprintLib::BindActionToKey("InputEventToggleSubwindow2", EKeys::Three, this, &ASimHUD::inputEventToggleSubwindow2); - UAirBlueprintLib::BindActionToKey("InputEventToggleAll", EKeys::Zero, this, &ASimHUD::inputEventToggleAll); + UAirBlueprintLib::BindAction("inputEventToggleRecording", this, this, &ASimHUD::inputEventToggleRecording); + UAirBlueprintLib::BindAction("InputEventToggleReport", this, this, &ASimHUD::inputEventToggleReport); + UAirBlueprintLib::BindAction("InputEventToggleHelp", this, this, &ASimHUD::inputEventToggleHelp); + UAirBlueprintLib::BindAction("InputEventToggleTrace", this, this, &ASimHUD::inputEventToggleTrace); + + UAirBlueprintLib::BindAction("InputEventToggleSubwindow0", this, this, &ASimHUD::inputEventToggleSubwindow0); + UAirBlueprintLib::BindAction("InputEventToggleSubwindow1", this, this, &ASimHUD::inputEventToggleSubwindow1); + UAirBlueprintLib::BindAction("InputEventToggleSubwindow2", this, this, &ASimHUD::inputEventToggleSubwindow2); + UAirBlueprintLib::BindAction("InputEventToggleAll", this, this, &ASimHUD::inputEventToggleAll); } void ASimHUD::initializeSettings() diff --git a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp index 6edb123860..861a4cb8ad 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp +++ b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp @@ -138,7 +138,7 @@ void ASimModeBase::BeginPlay() AirSimSettings::TimeOfDaySetting tod_setting = getSettings().tod_setting; setTimeOfDay(tod_setting.enabled, tod_setting.start_datetime, tod_setting.is_start_datetime_dst, tod_setting.celestial_clock_speed, tod_setting.update_interval_secs, tod_setting.move_sun); - UAirBlueprintLib::LogMessage(TEXT("Press F1 to see help"), TEXT(""), LogDebugLevel::Informational); + UAirBlueprintLib::LogMessage(FString::Printf(TEXT("Press %s to see help"), *UWeatherLib::GetInputMapKeysString("InputEventToggleHelp", EInputTypes::EKeyboardAndGamepad)), TEXT(""), LogDebugLevel::Informational); setupVehiclesAndCamera(); FRecordingThread::init(); @@ -423,7 +423,7 @@ void ASimModeBase::setupInputBindings() { UAirBlueprintLib::EnableInput(this); - UAirBlueprintLib::BindActionToKey("InputEventResetAll", EKeys::BackSpace, this, &ASimModeBase::reset); + UAirBlueprintLib::BindAction("InputEventResetVehicles", this, this, &ASimModeBase::reset); } ECameraDirectorMode ASimModeBase::getInitialViewMode() const @@ -737,7 +737,7 @@ void ASimModeBase::setupVehiclesAndCamera() if (getApiProvider()->hasDefaultVehicle()) { //TODO: better handle no FPV vehicles scenario getVehicleSimApi()->possess(); - CameraDirector->initializeForBeginPlay(getInitialViewMode(), getVehicleSimApi()->getPawn(), getVehicleSimApi()->getCamera("fpv"), getVehicleSimApi()->getCamera("back_center"), nullptr); + CameraDirector->initializeForBeginPlay(getInitialViewMode(), getVehicleSimApi()->getPawn(), getVehicleSimApi()->getCamera("fpv"), nullptr, getVehicleSimApi()->getCamera("back_center")); } else CameraDirector->initializeForBeginPlay(getInitialViewMode(), nullptr, nullptr, nullptr, nullptr); diff --git a/Unreal/Plugins/AirSim/Source/TextureShuffleActor.h b/Unreal/Plugins/AirSim/Source/TextureShuffleActor.h index 0467fa45d5..04053460fb 100644 --- a/Unreal/Plugins/AirSim/Source/TextureShuffleActor.h +++ b/Unreal/Plugins/AirSim/Source/TextureShuffleActor.h @@ -5,6 +5,8 @@ #include "common/common_utils/Utils.hpp" #include "common/AirSimSettings.hpp" #include "Engine/StaticMeshActor.h" +#include "Components/StaticMeshComponent.h" +#include "Materials/MaterialInstanceDynamic.h" #include "TextureShuffleActor.generated.h" UCLASS() @@ -29,4 +31,4 @@ class AIRSIM_API ATextureShuffleActor : public AStaticMeshActor UPROPERTY() TArray<UMaterialInstanceDynamic*> DynamicMaterialInstances; -}; \ No newline at end of file +}; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp index db41000a1a..617688ae6e 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp @@ -325,28 +325,12 @@ void ACarPawn::setupInputBindings() { UAirBlueprintLib::EnableInput(this); - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveForward", EKeys::Up, 1), this, this, &ACarPawn::onMoveForward); + UAirBlueprintLib::BindAxis("MoveForward", this, this, &ACarPawn::onMoveForward); + UAirBlueprintLib::BindAxis("MoveRight", this, this, &ACarPawn::onMoveRight); + UAirBlueprintLib::BindAxis("Footbrake", this, this, &ACarPawn::onFootBrake); - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveForward", EKeys::Down, -1), this, this, &ACarPawn::onMoveForward); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveRight", EKeys::Right, 0.5), this, this, &ACarPawn::onMoveRight); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveRight", EKeys::Left, -0.5), this, this, &ACarPawn::onMoveRight); - - UAirBlueprintLib::BindActionToKey("Handbrake", EKeys::End, this, &ACarPawn::onHandbrakePressed, true); - UAirBlueprintLib::BindActionToKey("Handbrake", EKeys::End, this, &ACarPawn::onHandbrakeReleased, false); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("Footbrake", EKeys::SpaceBar, 1), this, this, &ACarPawn::onFootBrake); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveRight", EKeys::Gamepad_LeftX, 1), this, this, &ACarPawn::onMoveRight); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("MoveForward", EKeys::Gamepad_RightTriggerAxis, 1), this, this, &ACarPawn::onMoveForward); - - UAirBlueprintLib::BindAxisToKey(FInputAxisKeyMapping("Footbrake", EKeys::Gamepad_LeftTriggerAxis, 1), this, this, &ACarPawn::onFootBrake); - - //below is not needed - //UAirBlueprintLib::BindActionToKey("Reverse", EKeys::Down, this, &ACarPawn::onReversePressed, true); - //UAirBlueprintLib::BindActionToKey("Reverse", EKeys::Down, this, &ACarPawn::onReverseReleased, false); + UAirBlueprintLib::BindAction("Handbrake", this, this, &ACarPawn::onHandbrakePressed, true); + UAirBlueprintLib::BindAction("Handbrake", this, this, &ACarPawn::onHandbrakeReleased, false); } void ACarPawn::onMoveForward(float Val) diff --git a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp index a9f1f130a5..d5b06b3750 100644 --- a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp +++ b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.cpp @@ -262,4 +262,153 @@ UWorld* UWeatherLib::actorGetWorld(AActor* Actor) void UWeatherLib::setWeatherFog(AExponentialHeightFog* fog) { weather_fog_ = fog; -} \ No newline at end of file +} + +FText UWeatherLib::GetKeyboardShortcutsText() +{ + FString KeyboardShortcutsString; + + KeyboardShortcutsString += TEXT("Welcome to AirSim!"); + KeyboardShortcutsString += TEXT("\n\n"); + + KeyboardShortcutsString += TEXT("HUD Toggles:\n"); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleHelp"), TEXT("Show Help Text"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleWeather"), TEXT("Show Weather Options"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventToggleRecording"), TEXT("Recording"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleReport"), TEXT("Debug Report"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleTrace"), TEXT("Trace Line"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleAll"), TEXT("All Sub-Windows"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleSubwindow0"), TEXT("Depth Window"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleSubwindow1"), TEXT("Segmentation Window"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventToggleSubwindow2"), TEXT("Scene Window"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("InputEventResetAll"), TEXT("Reset Vehicles"), EInputTypes::EKeyboard); + KeyboardShortcutsString += TEXT("\n"); + + KeyboardShortcutsString += TEXT("Camera Controls:\n"); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventFpvView"), TEXT("FPV View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventFlyWithView"), TEXT("\"Fly With Me\" View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventGroundView"), TEXT("Ground Observer View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventManualView"), TEXT("Manual Camera View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventSpringArmChaseView"), TEXT("Spring Arm View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventFrontView"), TEXT("Front View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventBackupView"), TEXT("Backup View"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputEventNoDisplayView"), TEXT("No Display"), EInputTypes::EKeyboard); + KeyboardShortcutsString += TEXT("\n"); + + KeyboardShortcutsString += TEXT("Manual Camera Controls:\n"); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualForward"), TEXT("Fly Forward & Back"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualArrowRight"), TEXT("Fly Left & Right"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualArrowUp"), TEXT("Fly Up & Down"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualRightYaw"), TEXT("Yaw"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualUpPitch"), TEXT("Pitch"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("inputManualRightRoll"), TEXT("Roll"), EInputTypes::EKeyboard); + KeyboardShortcutsString += TEXT("\n"); + + KeyboardShortcutsString += TEXT("Car Controls:\n"); + KeyboardShortcutsString += MakeInputString(TEXT("MoveForward"), TEXT("Drive & Reverse"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("MoveRight"), TEXT("Turn Right & Left"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("Footbrake"), TEXT("Footbrake"), EInputTypes::EKeyboard); + KeyboardShortcutsString += MakeInputString(TEXT("Handbrake"), TEXT("Handbrake"), EInputTypes::EKeyboard); + KeyboardShortcutsString += TEXT("\n"); + + return FText::FromString(KeyboardShortcutsString); +} + +FString UWeatherLib::MakeInputString(const FName InputName, const FString Descriptor, EInputTypes InputTypes, int WhitespacePadding) +{ + const FString InputKeys = GetInputMapKeysString(InputName, InputTypes); + FString WhitespaceString; + + WhitespaceString = WhitespaceString.RightPad(WhitespacePadding); + WhitespaceString = WhitespaceString.LeftChop(InputKeys.Len()); + + return InputKeys + WhitespaceString + Descriptor + TEXT("\n"); +} +FString UWeatherLib::GetInputMapKeysString(FName InputName, EInputTypes InputTypes) +{ + const UInputSettings* InputSettings = UInputSettings::GetInputSettings(); + + TArray<FInputActionKeyMapping> ActionKeyMapping; + InputSettings->GetActionMappingByName(InputName, ActionKeyMapping); + + TArray<FInputAxisKeyMapping> AxisKeyMapping; + InputSettings->GetAxisMappingByName(InputName, AxisKeyMapping); + + FString JoinedStr = FString(TEXT("")); + + // Remove Keys that don't match type InputType + for (int i = ActionKeyMapping.Num() - 1; i >= 0; i--) { + if (InputTypes == EInputTypes::EKeyboard && ActionKeyMapping[i].Key.IsGamepadKey()) { + ActionKeyMapping.RemoveAt(i); + } + if (InputTypes == EInputTypes::EGamepad && !ActionKeyMapping[i].Key.IsGamepadKey()) { + ActionKeyMapping.RemoveAt(i); + } + } + for (int i = AxisKeyMapping.Num() - 1; i >= 0; i--) { + if (InputTypes == EInputTypes::EKeyboard && AxisKeyMapping[i].Key.IsGamepadKey()) { + AxisKeyMapping.RemoveAt(i); + } + if (InputTypes == EInputTypes::EGamepad && !AxisKeyMapping[i].Key.IsGamepadKey()) { + AxisKeyMapping.RemoveAt(i); + } + } + + // Get Action Map Keys + JoinedStr += GetInputActionMapString(ActionKeyMapping); + JoinedStr += GetInputAxisMapString(AxisKeyMapping); + + // Shorten Gamepad Terms + JoinedStr = JoinedStr.Replace(TEXT("Gamepad "), TEXT("")); + JoinedStr = JoinedStr.Replace(TEXT("Right "), TEXT("R-")); + JoinedStr = JoinedStr.Replace(TEXT("Left "), TEXT("L-")); + JoinedStr = JoinedStr.Replace(TEXT("Thumbstick"), TEXT("Stick")); + JoinedStr = JoinedStr.Replace(TEXT(" Axis"), TEXT("")); + + return JoinedStr; +} + +FString UWeatherLib::GetInputActionMapString(TArray<FInputActionKeyMapping> ActionKeyMapping, bool bReverseOrder) +{ + FString JoinedStr; + + if (bReverseOrder) { + for (int Index = 0; Index < ActionKeyMapping.Num(); Index++) { + JoinedStr += ActionKeyMapping[Index].Key.GetDisplayName(false).ToString(); + if (Index + 1 < ActionKeyMapping.Num()) { + JoinedStr += TEXT(", "); + } + } + } + else { + for (int Index = ActionKeyMapping.Num() - 1; Index >= 0; Index--) { + JoinedStr += ActionKeyMapping[Index].Key.GetDisplayName(false).ToString(); + if (Index - 1 >= 0) { + JoinedStr += TEXT(", "); + } + } + } + return JoinedStr; +} + +FString UWeatherLib::GetInputAxisMapString(TArray<FInputAxisKeyMapping> AxisKeyMapping, bool bReverseOrder) +{ + FString JoinedStr; + if (bReverseOrder) { + for (int Index = 0; Index < AxisKeyMapping.Num(); Index++) { + JoinedStr += AxisKeyMapping[Index].Key.GetDisplayName(false).ToString(); + if (Index + 1 < AxisKeyMapping.Num()) { + JoinedStr += TEXT(", "); + } + } + } + else { + for (int Index = AxisKeyMapping.Num() - 1; Index >= 0; Index--) { + JoinedStr += AxisKeyMapping[Index].Key.GetDisplayName(false).ToString(); + if (Index - 1 >= 0) { + JoinedStr += TEXT(", "); + } + } + } + return JoinedStr; +} diff --git a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.h b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.h index fe1fb59c1b..30b8eba7ec 100644 --- a/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.h +++ b/Unreal/Plugins/AirSim/Source/Weather/WeatherLib.h @@ -6,6 +6,7 @@ #include "Runtime/Engine/Classes/Engine/ExponentialHeightFog.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Materials/MaterialParameterCollectionInstance.h" +#include "GameFramework/InputSettings.h" #include "WeatherLib.generated.h" @@ -32,6 +33,14 @@ enum class EWeatherParamVector : uint8 WEATHER_PARAM_VECTOR_WIND = 0 UMETA(DisplayName = "Wind"), WEATHER_PARAM_VECTOR_MAX = 1 UMETA(DisplayName = "MAX") }; + +UENUM(BlueprintType) +enum class EInputTypes : uint8 +{ + EKeyboard UMETA(DisplayName = "Keyboard"), + EGamepad UMETA(DisplayName = "Gamepad"), + EKeyboardAndGamepad UMETA(DisplayName = "Keyboard & Gamepad"), +}; /** * */ @@ -176,6 +185,16 @@ class AIRSIM_API UWeatherLib : public UBlueprintFunctionLibrary UFUNCTION(BlueprintCallable, Category = Weather) static void setWeatherFog(AExponentialHeightFog* fog); + UFUNCTION(BlueprintPure, Category = UI) + static FText GetKeyboardShortcutsText(); + + UFUNCTION(BlueprintPure, Category = UI) + static FString MakeInputString(const FName InputName, const FString Descriptor, EInputTypes InputTypes, int WhitespacePadding = 15); + + static FString GetInputMapKeysString(FName InputName, EInputTypes InputTypes); + static FString GetInputActionMapString(TArray<FInputActionKeyMapping> ActionKeyMapping, bool bReverseOrder = false); + static FString GetInputAxisMapString(TArray<FInputAxisKeyMapping> AxisKeyMapping, bool bReverseOrder = false); + private: static AExponentialHeightFog* weather_fog_; }; diff --git a/docs/camera_views.md b/docs/camera_views.md index 55e358e7fd..cb1642a086 100644 --- a/docs/camera_views.md +++ b/docs/camera_views.md @@ -8,7 +8,7 @@ From left to right is the depth view, segmentation view and the FPV view. See [I ## Turning ON/OFF Views -Press F1 key to see keyboard shortcuts for turning on/off any or all views. You can also select various view modes there, such as "Fly with Me" mode, FPV mode and "Ground View" mode. +Press F9 key to see keyboard shortcuts for turning on/off any or all views. You can also select various view modes there, such as "Fly with Me" mode, FPV mode and "Ground View" mode. ## Controlling Manual Camera diff --git a/docs/image_apis.md b/docs/image_apis.md index 963f24702e..8ba6c68800 100644 --- a/docs/image_apis.md +++ b/docs/image_apis.md @@ -148,7 +148,7 @@ Before AirSim v1.2, cameras were accessed using ID numbers instead of names. For ## "Computer Vision" Mode -You can use AirSim in so-called "Computer Vision" mode. In this mode, physics engine is disabled and there is no vehicle, just cameras (If you want to have the vehicle but without its kinematics, you can use the Multirotor mode with the Physics Engine [ExternalPhysicsEngine](settings.md##physicsenginename)). You can move around using keyboard (use F1 to see help on keys). You can press Record button to continuously generate images. Or you can call APIs to move cameras around and take images. +You can use AirSim in so-called "Computer Vision" mode. In this mode, physics engine is disabled and there is no vehicle, just cameras (If you want to have the vehicle but without its kinematics, you can use the Multirotor mode with the Physics Engine [ExternalPhysicsEngine](settings.md##physicsenginename)). You can move around using keyboard (use F9 to see help on keys). You can press Record button to continuously generate images. Or you can call APIs to move cameras around and take images. To active this mode, edit [settings.json](settings.md) that you can find in your `Documents\AirSim` folder (or `~/Documents/AirSim` on Linux) and make sure following values exist at root level: diff --git a/docs/using_car.md b/docs/using_car.md index 800a66f9c1..30d2959f17 100644 --- a/docs/using_car.md +++ b/docs/using_car.md @@ -18,7 +18,7 @@ Please use the keyboard arrow keys to drive manually. Spacebar for the handbrake You can control the car, get state and images by calling APIs in variety of client languages including C++ and Python. Please see [APIs doc](apis.md) for more details. ## Changing Views -By default camera will chase the car from the back. You can get the FPV view by pressing `F` key and switch back to chasing from back view by pressing `/` key. More keyboard shortcuts can be seen by pressing F1. +By default camera will chase the car from the back. You can get the FPV view by pressing `F` key and switch back to chasing from back view by pressing `/` key. More keyboard shortcuts can be seen by pressing `F9`. ## Cameras By default car is installed with 5 cameras: center, left and right, driver and reverse. You can chose the images from these camera by specifying [the name](image_apis.md#available_cameras).