From 585fd5c5fc78d3a6185a73b7e754f881a0081f92 Mon Sep 17 00:00:00 2001 From: Michal Wieja Date: Fri, 21 Jun 2024 01:19:43 -0400 Subject: [PATCH 1/3] Unreal 5.4 support for Airsim plugin and Blocks demo environment. --- Unreal/Environments/Blocks/Blocks.uproject | 2 +- .../Blocks/Config/DefaultEditor.ini | 1 + .../Blocks/Config/DefaultEngine.ini | 13 +++ .../Blocks/Config/DefaultInput.ini | 83 ++++++++++++++++-- .../Blocks/Source/Blocks.Target.cs | 3 +- .../Blocks/Source/BlocksEditor.Target.cs | 4 +- .../Blueprints/BP_CameraDirector.uasset | Bin 12510 -> 14500 bytes .../Plugins/AirSim/Source/AirBlueprintLib.cpp | 2 +- .../Plugins/AirSim/Source/AirBlueprintLib.h | 8 +- .../{CameraDirector.cpp => CameraManager.cpp} | 62 ++++++------- .../{CameraDirector.h => CameraManager.h} | 6 +- .../AirSim/Source/DetectionComponent.h | 2 + .../AirSim/Source/SimMode/SimModeBase.cpp | 8 +- .../AirSim/Source/SimMode/SimModeBase.h | 4 +- .../Multirotor/MultirotorPawnSimApi.h | 4 +- Unreal/Plugins/AirSim/Source/WorldSimApi.cpp | 11 +-- Unreal/Plugins/AirSim/Source/WorldSimApi.h | 1 + 17 files changed, 149 insertions(+), 65 deletions(-) rename Unreal/Plugins/AirSim/Source/{CameraDirector.cpp => CameraManager.cpp} (87%) rename Unreal/Plugins/AirSim/Source/{CameraDirector.h => CameraManager.h} (96%) diff --git a/Unreal/Environments/Blocks/Blocks.uproject b/Unreal/Environments/Blocks/Blocks.uproject index 91c16a962a..7163182e59 100644 --- a/Unreal/Environments/Blocks/Blocks.uproject +++ b/Unreal/Environments/Blocks/Blocks.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.1", + "EngineAssociation": "5.4", "Category": "", "Description": "", "Modules": [ diff --git a/Unreal/Environments/Blocks/Config/DefaultEditor.ini b/Unreal/Environments/Blocks/Config/DefaultEditor.ini index d4e8232a87..f44257a4da 100644 --- a/Unreal/Environments/Blocks/Config/DefaultEditor.ini +++ b/Unreal/Environments/Blocks/Config/DefaultEditor.ini @@ -7,4 +7,5 @@ bReplaceBlueprintWithClass= true bDontLoadBlueprintOutsideEditor= true bBlueprintIsNotBlueprintType= true +[/Script/AdvancedPreviewScene.SharedProfiles] diff --git a/Unreal/Environments/Blocks/Config/DefaultEngine.ini b/Unreal/Environments/Blocks/Config/DefaultEngine.ini index 7fe1348403..d735e6e087 100644 --- a/Unreal/Environments/Blocks/Config/DefaultEngine.ini +++ b/Unreal/Environments/Blocks/Config/DefaultEngine.ini @@ -68,4 +68,17 @@ AsyncSceneSmoothingFactor=0.990000 InitialAverageFrameRate=0.016667 PhysXTreeRebuildRate=10 +[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings] +bEnablePlugin=True +bAllowNetworkConnection=True +SecurityToken=E4EBEAA64CDE3B39980008BE0CBB1C01 +bIncludeInShipping=False +bAllowExternalStartInShipping=False +bCompileAFSProject=False +bUseCompression=False +bLogFiles=False +bReportStats=False +ConnectionType=USBOnly +bUseManualIPAddress=False +ManualIPAddress= diff --git a/Unreal/Environments/Blocks/Config/DefaultInput.ini b/Unreal/Environments/Blocks/Config/DefaultInput.ini index 78803ce4f1..b66d09f721 100644 --- a/Unreal/Environments/Blocks/Config/DefaultInput.ini +++ b/Unreal/Environments/Blocks/Config/DefaultInput.ini @@ -1,20 +1,85 @@ [/Script/Engine.InputSettings] +-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) +-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) +-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) ++AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) bAltEnterTogglesFullscreen=True bF11TogglesFullscreen=True bUseMouseForTouch=False bEnableMouseSmoothing=True bEnableFOVScaling=True -FOVScale=0.011110 -DoubleClickTime=0.200000 bCaptureMouseOnLaunch=False -DefaultViewportMouseCaptureMode=NoCapture -bDefaultViewportMouseLock=False -DefaultViewportMouseLockMode=DoNotLock +bEnableLegacyInputScales=True +bEnableMotionControls=True +bFilterInputByPlatformUser=False +bEnableInputDeviceSubsystem=True +bShouldFlushPressedKeysOnViewportFocusLost=True +bEnableDynamicComponentInputBinding=True bAlwaysShowTouchInterface=False bShowConsoleOnFourFingerTap=True +bEnableGestureRecognizer=False +bUseAutocorrect=False +DefaultViewportMouseCaptureMode=NoCapture +DefaultViewportMouseLockMode=DoNotLock +FOVScale=0.011110 +DoubleClickTime=0.200000 +DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput +DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks -ConsoleKey=None -ConsoleKeys=Tilde -+ConsoleKeys=Tilde - - ++ConsoleKeys=Tilde \ No newline at end of file diff --git a/Unreal/Environments/Blocks/Source/Blocks.Target.cs b/Unreal/Environments/Blocks/Source/Blocks.Target.cs index d7c26bac5d..0fe9165a2e 100644 --- a/Unreal/Environments/Blocks/Source/Blocks.Target.cs +++ b/Unreal/Environments/Blocks/Source/Blocks.Target.cs @@ -7,7 +7,8 @@ public class BlocksTarget : TargetRules { public BlocksTarget(TargetInfo Target) : base(Target) { - Type = TargetType.Game; + DefaultBuildSettings = BuildSettingsVersion.V5; + Type = TargetType.Game; ExtraModuleNames.AddRange(new string[] { "Blocks" }); //bUseUnityBuild = false; diff --git a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs index 187daed546..317102bd7f 100644 --- a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs +++ b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs @@ -7,9 +7,9 @@ public class BlocksEditorTarget : TargetRules { public BlocksEditorTarget(TargetInfo Target) : base(Target) { - Type = TargetType.Editor; + DefaultBuildSettings = BuildSettingsVersion.V5; + Type = TargetType.Editor; ExtraModuleNames.AddRange(new string[] { "Blocks" }); - DefaultBuildSettings = BuildSettingsVersion.V2; //bUseUnityBuild = false; //bUsePCHFiles = false; } diff --git a/Unreal/Plugins/AirSim/Content/Blueprints/BP_CameraDirector.uasset b/Unreal/Plugins/AirSim/Content/Blueprints/BP_CameraDirector.uasset index d05e4ef193acf969fa6ac1f975f32bae440df0ff..bf8771b88151fd852af90003b16ab0e76bfd31d7 100644 GIT binary patch literal 14500 zcmeHOdz4hgnXks-DJT%$iZ&o`m`BeH%nYJ*Pj}CQc|RE<4tKim%rx|i?%Ojos|1yx zE+)GevgRBUO-ML;L~=+VO4eW?C!Wo^XXAs!O>ou3C|Oud)TnU-I{W?VR^5Ahrl)CP z{@HW3bh_$(-&fzOzWSpKI7ob_klX{>%?$x}~1+fT6hzi#>Fv-OJ}_l}*n z|HZqHDJux}mg6@^Ce`16iCq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ztb~N*tU&|?rINT$Zce5cBv2Kg$5%sWTw(cM1c>n*>_A{NLj;B;BPIy|QrG#}jaz&Z zG*961X&-+}qsH?p==-U1oqjfI`uaTnwd>4QTK}5uHBdS}E^?c%d#1a|rEdDJuSsGr6R2Q(BR%FHqSN+8%Kw~)SsVU?448S@p=5d;zD0ZacNm@Rosc6C{4IV%e(j#grxcx?G47JJtTUqlz|F(geD?InQ$>P7%4j-4Ae>f~3s}~90uw7#L_06x S^(I}a-@wHw`VjrkhW`PMcF>mq diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp index 46a123fde1..508b6dd2da 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp @@ -51,7 +51,7 @@ EAppReturnType::Type UAirBlueprintLib::ShowMessage(EAppMsgType::Type message_typ return FMessageDialog::Open(message_type, FText::FromString(message.c_str()), - &title_text); + title_text); } void UAirBlueprintLib::enableWorldRendering(AActor* context, bool enable) diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h index d136a67997..081e1400fe 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h @@ -58,7 +58,7 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary FName name_n = FName(*name); for (TActorIterator It(context->GetWorld(), T::StaticClass()); It; ++It) { AActor* Actor = *It; - if (!Actor->IsPendingKill() && (Actor->ActorHasTag(name_n) || Actor->GetName().Compare(name) == 0)) { + if (!Actor->IsPendingKillPending() && (Actor->ActorHasTag(name_n) || Actor->GetName().Compare(name) == 0)) { return static_cast(Actor); } } @@ -123,7 +123,7 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary template static FInputActionBinding& BindActionToKey(const FName action_name, const FKey in_key, UserClass* actor, - typename FInputActionHandlerSignature::TUObjectMethodDelegate::FMethodPtr func, bool on_press_or_release = false, + typename FInputActionHandlerSignature::TMethodPtr func, bool on_press_or_release = false, bool shift_key = false, bool control_key = false, bool alt_key = false, bool command_key = false) { FInputActionKeyMapping action(action_name, in_key, shift_key, control_key, alt_key, command_key); @@ -136,7 +136,7 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary template static FInputAxisBinding& BindAxisToKey(const FName axis_name, const FKey in_key, AActor* actor, UserClass* obj, - typename FInputAxisHandlerSignature::TUObjectMethodDelegate::FMethodPtr func) + typename FInputAxisHandlerSignature::TMethodPtr func) { FInputAxisKeyMapping axis(axis_name, in_key); @@ -145,7 +145,7 @@ class UAirBlueprintLib : public UBlueprintFunctionLibrary template static FInputAxisBinding& BindAxisToKey(const FInputAxisKeyMapping& axis, AActor* actor, UserClass* obj, - typename FInputAxisHandlerSignature::TUObjectMethodDelegate::FMethodPtr func) + typename FInputAxisHandlerSignature::TMethodPtr func) { APlayerController* controller = actor->GetWorld()->GetFirstPlayerController(); diff --git a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp b/Unreal/Plugins/AirSim/Source/CameraManager.cpp similarity index 87% rename from Unreal/Plugins/AirSim/Source/CameraDirector.cpp rename to Unreal/Plugins/AirSim/Source/CameraManager.cpp index 43f0a3f2ad..1c86a7c42c 100644 --- a/Unreal/Plugins/AirSim/Source/CameraDirector.cpp +++ b/Unreal/Plugins/AirSim/Source/CameraManager.cpp @@ -1,8 +1,8 @@ -#include "CameraDirector.h" + #include "CameraManager.h" #include "GameFramework/PlayerController.h" #include "AirBlueprintLib.h" -ACameraDirector::ACameraDirector() +ACameraManager::ACameraManager() { PrimaryActorTick.bCanEverTick = true; @@ -19,12 +19,12 @@ ACameraDirector::ACameraDirector() SpringArm->bInheritRoll = true; } -void ACameraDirector::BeginPlay() +void ACameraManager::BeginPlay() { Super::BeginPlay(); } -void ACameraDirector::Tick(float DeltaTime) +void ACameraManager::Tick(float DeltaTime) { Super::Tick(DeltaTime); @@ -42,12 +42,12 @@ void ACameraDirector::Tick(float DeltaTime) } } -ECameraDirectorMode ACameraDirector::getMode() +ECameraDirectorMode ACameraManager::getMode() { return mode_; } -void ACameraDirector::initializeForBeginPlay(ECameraDirectorMode view_mode, +void ACameraManager::initializeForBeginPlay(ECameraDirectorMode view_mode, AActor* follow_actor, APIPCamera* fpv_camera, APIPCamera* front_camera, APIPCamera* back_camera) { manual_pose_controller_ = NewObject(this, "CameraDirector_ManualPoseController"); @@ -97,7 +97,7 @@ void ACameraDirector::initializeForBeginPlay(ECameraDirectorMode view_mode, } } -void ACameraDirector::attachSpringArm(bool attach) +void ACameraManager::attachSpringArm(bool attach) { if (attach) { //If we do have actor to follow AND don't have sprint arm attached to that actor, we will attach it @@ -133,7 +133,7 @@ void ACameraDirector::attachSpringArm(bool attach) } } -void ACameraDirector::setMode(ECameraDirectorMode mode) +void ACameraManager::setMode(ECameraDirectorMode mode) { { //first remove any settings done by previous mode @@ -183,43 +183,43 @@ void ACameraDirector::setMode(ECameraDirectorMode mode) mode_ = mode; } -void ACameraDirector::setupInputBindings() +void ACameraManager::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::BindActionToKey("inputEventFpvView", EKeys::F, this, &ACameraManager::inputEventFpvView); + UAirBlueprintLib::BindActionToKey("inputEventFlyWithView", EKeys::B, this, &ACameraManager::inputEventFlyWithView); + UAirBlueprintLib::BindActionToKey("inputEventGroundView", EKeys::Backslash, this, &ACameraManager::inputEventGroundView); + UAirBlueprintLib::BindActionToKey("inputEventManualView", EKeys::M, this, &ACameraManager::inputEventManualView); + UAirBlueprintLib::BindActionToKey("inputEventSpringArmChaseView", EKeys::Slash, this, &ACameraManager::inputEventSpringArmChaseView); + UAirBlueprintLib::BindActionToKey("inputEventBackupView", EKeys::K, this, &ACameraManager::inputEventBackupView); + UAirBlueprintLib::BindActionToKey("inputEventNoDisplayView", EKeys::Hyphen, this, &ACameraManager::inputEventNoDisplayView); + UAirBlueprintLib::BindActionToKey("inputEventFrontView", EKeys::I, this, &ACameraManager::inputEventFrontView); } -void ACameraDirector::EndPlay(const EEndPlayReason::Type EndPlayReason) +void ACameraManager::EndPlay(const EEndPlayReason::Type EndPlayReason) { manual_pose_controller_ = nullptr; SpringArm = nullptr; ExternalCamera = nullptr; } -APIPCamera* ACameraDirector::getFpvCamera() const +APIPCamera* ACameraManager::getFpvCamera() const { return fpv_camera_; } -APIPCamera* ACameraDirector::getExternalCamera() const +APIPCamera* ACameraManager::getExternalCamera() const { return ExternalCamera; } -APIPCamera* ACameraDirector::getBackupCamera() const +APIPCamera* ACameraManager::getBackupCamera() const { return backup_camera_; } -void ACameraDirector::inputEventSpringArmChaseView() +void ACameraManager::inputEventSpringArmChaseView() { if (ExternalCamera) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_SPRINGARM_CHASE); @@ -232,7 +232,7 @@ void ACameraDirector::inputEventSpringArmChaseView() notifyViewModeChanged(); } -void ACameraDirector::inputEventGroundView() +void ACameraManager::inputEventGroundView() { if (ExternalCamera) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_GROUND_OBSERVER); @@ -246,7 +246,7 @@ void ACameraDirector::inputEventGroundView() notifyViewModeChanged(); } -void ACameraDirector::inputEventManualView() +void ACameraManager::inputEventManualView() { if (ExternalCamera) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_MANUAL); @@ -259,7 +259,7 @@ void ACameraDirector::inputEventManualView() notifyViewModeChanged(); } -void ACameraDirector::inputEventNoDisplayView() +void ACameraManager::inputEventNoDisplayView() { if (ExternalCamera) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_NODISPLAY); @@ -271,7 +271,7 @@ void ACameraDirector::inputEventNoDisplayView() notifyViewModeChanged(); } -void ACameraDirector::inputEventBackupView() +void ACameraManager::inputEventBackupView() { if (backup_camera_) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_BACKUP); @@ -284,7 +284,7 @@ void ACameraDirector::inputEventBackupView() notifyViewModeChanged(); } -void ACameraDirector::inputEventFrontView() +void ACameraManager::inputEventFrontView() { if (front_camera_) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_FRONT); @@ -297,7 +297,7 @@ void ACameraDirector::inputEventFrontView() notifyViewModeChanged(); } -void ACameraDirector::inputEventFlyWithView() +void ACameraManager::inputEventFlyWithView() { if (ExternalCamera) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_FLY_WITH_ME); @@ -315,7 +315,7 @@ void ACameraDirector::inputEventFlyWithView() notifyViewModeChanged(); } -void ACameraDirector::inputEventFpvView() +void ACameraManager::inputEventFpvView() { if (fpv_camera_) { setMode(ECameraDirectorMode::CAMERA_DIRECTOR_MODE_FPV); @@ -328,7 +328,7 @@ void ACameraDirector::inputEventFpvView() notifyViewModeChanged(); } -void ACameraDirector::disableCameras(bool fpv, bool backup, bool external, bool front) +void ACameraManager::disableCameras(bool fpv, bool backup, bool external, bool front) { if (fpv && fpv_camera_) fpv_camera_->disableMain(); @@ -340,7 +340,7 @@ void ACameraDirector::disableCameras(bool fpv, bool backup, bool external, bool front_camera_->disableMain(); } -void ACameraDirector::notifyViewModeChanged() +void ACameraManager::notifyViewModeChanged() { bool nodisplay = ECameraDirectorMode::CAMERA_DIRECTOR_MODE_NODISPLAY == mode_; diff --git a/Unreal/Plugins/AirSim/Source/CameraDirector.h b/Unreal/Plugins/AirSim/Source/CameraManager.h similarity index 96% rename from Unreal/Plugins/AirSim/Source/CameraDirector.h rename to Unreal/Plugins/AirSim/Source/CameraManager.h index 59f4557eda..1ac480503b 100644 --- a/Unreal/Plugins/AirSim/Source/CameraDirector.h +++ b/Unreal/Plugins/AirSim/Source/CameraManager.h @@ -7,7 +7,7 @@ #include "ManualPoseController.h" #include "common/common_utils/Utils.hpp" #include "GameFramework/SpringArmComponent.h" -#include "CameraDirector.generated.h" +#include "CameraManager.generated.h" UENUM(BlueprintType) enum class ECameraDirectorMode : uint8 @@ -23,7 +23,7 @@ enum class ECameraDirectorMode : uint8 }; UCLASS() -class AIRSIM_API ACameraDirector : public AActor +class AIRSIM_API ACameraManager : public AActor { GENERATED_BODY() @@ -46,7 +46,7 @@ class AIRSIM_API ACameraDirector : public AActor void inputEventFrontView(); public: - ACameraDirector(); + ACameraManager(); virtual void BeginPlay() override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void Tick(float DeltaSeconds) override; diff --git a/Unreal/Plugins/AirSim/Source/DetectionComponent.h b/Unreal/Plugins/AirSim/Source/DetectionComponent.h index 6f0899af15..440c5c34f6 100644 --- a/Unreal/Plugins/AirSim/Source/DetectionComponent.h +++ b/Unreal/Plugins/AirSim/Source/DetectionComponent.h @@ -2,6 +2,8 @@ #pragma once +#include + #include "CoreMinimal.h" #include "Components/SceneComponent.h" #include "ObjectFilter.h" diff --git a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp index 70018a29fb..cee8ca77e9 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp +++ b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp @@ -40,7 +40,7 @@ ASimModeBase::ASimModeBase() static ConstructorHelpers::FClassFinder external_camera_class(TEXT("Blueprint'/AirSim/Blueprints/BP_PIPCamera'")); external_camera_class_ = external_camera_class.Succeeded() ? external_camera_class.Class : nullptr; - static ConstructorHelpers::FClassFinder camera_director_class(TEXT("Blueprint'/AirSim/Blueprints/BP_CameraDirector'")); + static ConstructorHelpers::FClassFinder camera_director_class(TEXT("Blueprint'/AirSim/Blueprints/BP_CameraDirector'")); camera_director_class_ = camera_director_class.Succeeded() ? camera_director_class.Class : nullptr; static ConstructorHelpers::FObjectFinder collision_display(TEXT("ParticleSystem'/AirSim/StarterContent/Particles/P_Explosion.P_Explosion'")); @@ -446,13 +446,13 @@ const msr::airlib::AirSimSettings& ASimModeBase::getSettings() const void ASimModeBase::initializeCameraDirector(const FTransform& camera_transform, float follow_distance) { TArray camera_dirs; - UAirBlueprintLib::FindAllActor(this, camera_dirs); + UAirBlueprintLib::FindAllActor(this, camera_dirs); if (camera_dirs.Num() == 0) { //create director FActorSpawnParameters camera_spawn_params; camera_spawn_params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn; camera_spawn_params.Name = "CameraDirector"; - CameraDirector = this->GetWorld()->SpawnActor(camera_director_class_, + CameraDirector = this->GetWorld()->SpawnActor(camera_director_class_, camera_transform, camera_spawn_params); CameraDirector->setFollowDistance(follow_distance); @@ -464,7 +464,7 @@ void ASimModeBase::initializeCameraDirector(const FTransform& camera_transform, camera_spawn_params); } else { - CameraDirector = static_cast(camera_dirs[0]); + CameraDirector = static_cast(camera_dirs[0]); } } diff --git a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h index f21144a611..fe8ee6f075 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h +++ b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.h @@ -7,7 +7,7 @@ #include "ParticleDefinitions.h" #include -#include "CameraDirector.h" +#include "CameraManager.h" #include "common/AirSimSettings.hpp" #include "common/ClockFactory.hpp" #include "api/ApiServerBase.hpp" @@ -30,7 +30,7 @@ class AIRSIM_API ASimModeBase : public AActor FLevelLoaded OnLevelLoaded; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Refs") - ACameraDirector* CameraDirector; + ACameraManager* CameraDirector; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Debugging") bool EnableReport = false; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h index f7db8a8fda..fd77afb77f 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h @@ -65,7 +65,7 @@ class MultirotorPawnSimApi : public PawnSimApi std::vector rotor_actuator_info_; //show info on collision response from physics engine - CollisionResponse collision_response; + msr::airlib::CollisionResponse collision_response; MultirotorPawnEvents* pawn_events_; @@ -85,5 +85,5 @@ class MultirotorPawnSimApi : public PawnSimApi Pose last_phys_pose_; //for trace lines showing vehicle path std::vector vehicle_api_messages_; - RotorStates rotor_states_; + msr::airlib::RotorStates rotor_states_; }; diff --git a/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp b/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp index 8b8ec5223b..bfde623b70 100644 --- a/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/WorldSimApi.cpp @@ -66,7 +66,7 @@ bool WorldSimApi::destroyObject(const std::string& object_name) AActor* actor = UAirBlueprintLib::FindActor(simmode_, FString(object_name.c_str())); if (actor) { actor->Destroy(); - result = actor->IsPendingKill(); + result = actor->IsPendingKillPending(); } if (result) simmode_->scene_object_map.Remove(FString(object_name.c_str())); @@ -1037,6 +1037,7 @@ std::vector WorldSimApi::getDetections(ImageCaptureB : simmode_->getVehicleSimApi(camera_details.vehicle_name)->getNedTransform(); UAirBlueprintLib::RunCommandOnGameThread([camera, image_type, &result, &ned_transform]() { + const TArray& detections = camera->getDetectionComponent(image_type, false)->getDetections(); result.resize(detections.Num()); @@ -1045,16 +1046,16 @@ std::vector WorldSimApi::getDetections(ImageCaptureB Vector3r nedWrtOrigin = ned_transform.toGlobalNed(detections[i].Actor->GetActorLocation()); result[i].geo_point = msr::airlib::EarthUtils::nedToGeodetic(nedWrtOrigin, - AirSimSettings::singleton().origin_geopoint); + msr::airlib::AirSimSettings::singleton().origin_geopoint); - result[i].box2D.min = Vector2r(detections[i].Box2D.Min.X, detections[i].Box2D.Min.Y); - result[i].box2D.max = Vector2r(detections[i].Box2D.Max.X, detections[i].Box2D.Max.Y); + result[i].box2D.min = msr::airlib::Vector2r(detections[i].Box2D.Min.X, detections[i].Box2D.Min.Y); + result[i].box2D.max = msr::airlib::Vector2r(detections[i].Box2D.Max.X, detections[i].Box2D.Max.Y); result[i].box3D.min = ned_transform.toLocalNed(detections[i].Box3D.Min); result[i].box3D.max = ned_transform.toLocalNed(detections[i].Box3D.Max); const Vector3r& position = ned_transform.toLocalNed(detections[i].RelativeTransform.GetTranslation()); - const Quaternionr& orientation = ned_transform.toNed(detections[i].RelativeTransform.GetRotation()); + const msr::airlib::Quaternionr& orientation = ned_transform.toNed(detections[i].RelativeTransform.GetRotation()); result[i].relative_pose = Pose(position, orientation); } diff --git a/Unreal/Plugins/AirSim/Source/WorldSimApi.h b/Unreal/Plugins/AirSim/Source/WorldSimApi.h index 7bbbba3e8e..92a1fd4335 100644 --- a/Unreal/Plugins/AirSim/Source/WorldSimApi.h +++ b/Unreal/Plugins/AirSim/Source/WorldSimApi.h @@ -1,6 +1,7 @@ #pragma once #include "CoreMinimal.h" +#include "common/AirSimSettings.hpp" #include "common/CommonStructs.hpp" #include "common/GeodeticConverter.hpp" #include "api/WorldSimApiBase.hpp" From 24fa2ab1bc57ca63282bf69b571f6366124e4a75 Mon Sep 17 00:00:00 2001 From: Sacha Panic Date: Thu, 27 Jun 2024 15:51:55 -0400 Subject: [PATCH 2/3] Removed unused files, updated some scripts and patched some code files --- .gitmodules | 3 +++ ExternalRepositories/Colosseum_Eigen | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 ExternalRepositories/Colosseum_Eigen diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..4b2ff12dbe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ExternalRepositories/Colosseum_Eigen"] + path = ExternalRepositories/Colosseum_Eigen + url = https://github.com/Panics/Colosseum_Eigen.git diff --git a/ExternalRepositories/Colosseum_Eigen b/ExternalRepositories/Colosseum_Eigen new file mode 160000 index 0000000000..4a8ac63a91 --- /dev/null +++ b/ExternalRepositories/Colosseum_Eigen @@ -0,0 +1 @@ +Subproject commit 4a8ac63a9153de894666df04c2a0847c18747dfe From f5f6cc1d17237900be5e04cfe99ceb9293f1b14b Mon Sep 17 00:00:00 2001 From: Sacha Panic Date: Thu, 27 Jun 2024 15:52:08 -0400 Subject: [PATCH 3/3] More updates --- AirLib/.gitignore | 1 - AirLib/AirLib.vcxproj | 8 +- .../mavlink/MavLinkMultirotorApi.hpp | 61 ++++-- AirLib/update_mavlibkcom.bat | 3 - Unreal/Environments/Blocks/.gitignore | 23 -- .../Blocks/Config/DefaultEngine.ini | 2 +- build.cmd | 205 ++++++++++++------ clean.cmd | 64 +++++- 8 files changed, 250 insertions(+), 117 deletions(-) delete mode 100644 AirLib/.gitignore delete mode 100644 AirLib/update_mavlibkcom.bat delete mode 100644 Unreal/Environments/Blocks/.gitignore diff --git a/AirLib/.gitignore b/AirLib/.gitignore deleted file mode 100644 index 33e4bcc5dc..0000000000 --- a/AirLib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -deps/ \ No newline at end of file diff --git a/AirLib/AirLib.vcxproj b/AirLib/AirLib.vcxproj index 0e6d1b948f..5bc8b7775d 100644 --- a/AirLib/AirLib.vcxproj +++ b/AirLib/AirLib.vcxproj @@ -212,14 +212,14 @@ StaticLibrary false v143 - true + false Unicode StaticLibrary false v143 - true + false Unicode @@ -232,14 +232,14 @@ StaticLibrary false v143 - true + false Unicode StaticLibrary false v143 - true + false Unicode diff --git a/AirLib/include/vehicles/multirotor/firmwares/mavlink/MavLinkMultirotorApi.hpp b/AirLib/include/vehicles/multirotor/firmwares/mavlink/MavLinkMultirotorApi.hpp index e9b4ad5a00..9f96fc3424 100644 --- a/AirLib/include/vehicles/multirotor/firmwares/mavlink/MavLinkMultirotorApi.hpp +++ b/AirLib/include/vehicles/multirotor/firmwares/mavlink/MavLinkMultirotorApi.hpp @@ -1198,6 +1198,24 @@ namespace airlib return logviewer_proxy_ != nullptr; } + void qgcCallback(std::shared_ptr connection_val, const mavlinkcom::MavLinkMessage& msg) + { + unused(connection_val); + processQgcMessages(msg); + } + + void controlCallback(std::shared_ptr connection_val, const mavlinkcom::MavLinkMessage& msg) + { + unused(connection_val); + processControlMessages(msg); + } + + void mavCallback(std::shared_ptr connection_val, const mavlinkcom::MavLinkMessage& msg) + { + unused(connection_val); + processMavMessages(msg); + } + bool connectToQGC() { if (connection_info_.qgc_ip_address.size() > 0) { @@ -1209,10 +1227,12 @@ namespace airlib qgc_proxy_ = nullptr; } else { - connection->subscribe([=](std::shared_ptr connection_val, const mavlinkcom::MavLinkMessage& msg) { - unused(connection_val); - processQgcMessages(msg); - }); + mavlinkcom::MessageHandler handler = std::bind(&MavLinkMultirotorApi::qgcCallback, this, std::placeholders::_1, std::placeholders::_2); + connection->subscribe(handler); + //connection->subscribe([=](std::shared_ptr connection_val, const mavlinkcom::MavLinkMessage& msg) { + // unused(connection_val); + // processQgcMessages(msg); + //}); } } return qgc_proxy_ != nullptr; @@ -1314,10 +1334,13 @@ namespace airlib } // start listening to the SITL connection. - connection_->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { - unused(connection); - processMavMessages(msg); - }); + mavlinkcom::MessageHandler handler = std::bind(&MavLinkMultirotorApi::mavCallback, this, std::placeholders::_1, std::placeholders::_2); + connection_->subscribe(handler); + + //connection_->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { + // unused(connection); + // processMavMessages(msg); + //}); hil_node_ = std::make_shared(connection_info_.sim_sysid, connection_info_.sim_compid); hil_node_->connect(connection_); @@ -1428,10 +1451,13 @@ namespace airlib // listen to this UDP mavlink connection also auto mavcon = mav_vehicle_->getConnection(); if (mavcon != nullptr && mavcon != connection_) { - mavcon->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { - unused(connection); - processControlMessages(msg); - }); + mavlinkcom::MessageHandler handler = std::bind(&MavLinkMultirotorApi::controlCallback, this, std::placeholders::_1, std::placeholders::_2); + mavcon->subscribe(handler); + + //mavcon->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { + // unused(connection); + // processControlMessages(msg); + //}); } else { mav_vehicle_->connect(connection_); @@ -1497,10 +1523,13 @@ namespace airlib addStatusMessage(Utils::stringf("Connected to PX4 over serial port: %s", port_name_auto.c_str())); // start listening to the HITL connection. - connection_->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { - unused(connection); - processMavMessages(msg); - }); + mavlinkcom::MessageHandler handler = std::bind(&MavLinkMultirotorApi::mavCallback, this, std::placeholders::_1, std::placeholders::_2); + connection_->subscribe(handler); + + //connection_->subscribe([=](std::shared_ptr connection, const mavlinkcom::MavLinkMessage& msg) { + // unused(connection); + // processMavMessages(msg); + //}); mav_vehicle_ = std::make_shared(connection_info_.vehicle_sysid, connection_info_.vehicle_compid); diff --git a/AirLib/update_mavlibkcom.bat b/AirLib/update_mavlibkcom.bat deleted file mode 100644 index d4b1f23a8c..0000000000 --- a/AirLib/update_mavlibkcom.bat +++ /dev/null @@ -1,3 +0,0 @@ -robocopy /MIR ..\MavLinkCom\SDK\Includes deps\MavLinkCom\include /XD temp *. /njh /njs /ndl /np -robocopy /MIR ..\MavLinkCom\SDK\Libraries deps\MavLinkCom\lib /XD temp *. /njh /njs /ndl /np -pause \ No newline at end of file diff --git a/Unreal/Environments/Blocks/.gitignore b/Unreal/Environments/Blocks/.gitignore deleted file mode 100644 index 5dba4e3d6b..0000000000 --- a/Unreal/Environments/Blocks/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# don't check-in Plugins folder we copied from AirSim folder -Plugins/ -# Don't add packaged binaries -Packaged/ - -# don't check-in generated files -*.sln -*_BuiltData.uasset -/.kdev/ -/*.kdev4 -/*.pro -/*.workspace -/*CodeCompletionFolders.txt -/*CodeLitePreProcessor.txt -/*.pri -/CMakeLists.txt -/Makefile - -# avoid checking uproject because this is usually just version change -*.uproject - -# avoid checking in MacOS XCode assets -*.xcworkspace diff --git a/Unreal/Environments/Blocks/Config/DefaultEngine.ini b/Unreal/Environments/Blocks/Config/DefaultEngine.ini index d735e6e087..af56ed2497 100644 --- a/Unreal/Environments/Blocks/Config/DefaultEngine.ini +++ b/Unreal/Environments/Blocks/Config/DefaultEngine.ini @@ -8,7 +8,7 @@ ThreePlayerSplitscreenLayout=FavorTop GameInstanceClass=/Script/Engine.GameInstance GameDefaultMap=/Game/FlyingCPP/Maps/FlyingExampleMap ServerDefaultMap=/Engine/Maps/Entry -GlobalDefaultGameMode=/Script/Blocks.BlocksGameMode +GlobalDefaultGameMode=/Script/AirSim.AirSimGameMode GlobalDefaultServerGameMode=None [/Script/IOSRuntimeSettings.IOSRuntimeSettings] diff --git a/build.cmd b/build.cmd index cc6ca3bd0d..60d47b4423 100644 --- a/build.cmd +++ b/build.cmd @@ -1,38 +1,56 @@ @echo off + REM //---------- set up variable ---------- setlocal +call :setESC set ROOT_DIR=%~dp0 -REM // Check command line arguments -set "noFullPolyCar=" -set "buildMode=" -REM //check VS version +REM // ------------ check VS version ------------ +CALL :printHeader, "Check Visual Studio Version" +echo Visual studio version: %VisualStudioVersion% if "%VisualStudioVersion%" == "" ( - echo( - echo oh oh... You need to run this command from x64 Native Tools Command Prompt for VS 2022. + call :printError, "uh oh... You need to run this command from x64 Native Tools Command Prompt for VS 2022" goto :buildfailed_nomsg ) if "%VisualStudioVersion%" lss "17.0" ( - echo( - echo Hello there! We just upgraded AirSim to Unreal Engine 4.27 and Visual Studio 2022. - echo Here are few easy steps for upgrade so everything is new and shiny: - echo https://github.com/Microsoft/AirSim/blob/main/docs/unreal_upgrade.md + call :printError, "Hello there! We just upgraded AirSim to Unreal Engine 4.27 and Visual Studio 2022. Here are few easy steps for upgrade so everything is new and shiny: https://github.com/Microsoft/AirSim/blob/main/docs/unreal_upgrade.md" goto :buildfailed_nomsg ) +ECHO( + +REM // ------------ Parse command line arguments ------------ +CALL :printHeader, "Parse command line arguments" -if "%1"=="" goto noargs -if "%1"=="--no-full-poly-car" set "noFullPolyCar=y" -if "%1"=="--Debug" set "buildMode=Debug" -if "%1"=="--Release" set "buildMode=Release" -if "%1"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" +set noFullPolyCar="" +set buildMode="" -if "%2"=="" goto noargs -if "%2"=="--Debug" set "buildMode=Debug" -if "%2"=="--Release" set "buildMode=Release" -if "%2"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" +:loop +IF NOT "%1"=="" ( + IF "%1"=="--Debug" ( + set buildMode="Debug" + SHIFT + ) ELSE IF "%1"=="--Release" ( + set buildMode="Release" + SHIFT + ) ELSE IF "%1"=="--no-full-poly-car" ( + set noFullPolyCar="y" + SHIFT + ) ELSE IF "%1"=="--RelWithDebInfo" ( + set buildMode="RelWithDebInfo" + SHIFT + ) ELSE ( + echo Unknown command line parameter: %1 + SHIFT + ) + GOTO :loop +) +echo buildMode = %buildMode% +echo noFullPolyCar = %noFullPolyCar% +ECHO( -:noargs +REM // ------------ Check for powershell ------------ +CALL :printHeader, "Check for powershell" set powershell=powershell where powershell > nul 2>&1 @@ -44,41 +62,44 @@ where pwsh > nul 2>&1 if ERRORLEVEL 1 goto :nopwsh set PWSHV7=1 echo found pwsh && goto start + :nopwsh echo Powershell or pwsh not found, please install it. goto :eof :start +ECHO( + chdir /d %ROOT_DIR% REM //---------- Check cmake version ---------- +CALL :printHeader, "Check cmake version" CALL check_cmake.bat if ERRORLEVEL 1 ( CALL check_cmake.bat if ERRORLEVEL 1 ( - echo( echo ERROR: cmake was not installed correctly, we tried. goto :buildfailed ) ) +ECHO( REM //---------- get rpclib ---------- + IF NOT EXIST external\rpclib mkdir external\rpclib -set RPC_VERSION_FOLDER=rpclib-2.3.0 +set RPC_VERSION_FOLDER=rpclib-2.3.1 IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% ( REM //leave some blank lines because %powershell% shows download banner at top of console ECHO( ECHO( ECHO( - ECHO ***************************************************************************************** - ECHO Downloading rpclib - ECHO ***************************************************************************************** + CALL :printHeader, "Downloading rpclib" @echo on if "%PWSHV7%" == "" ( - %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile external\rpclib.zip }" + %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/WouterJansen/rpclib/archive/refs/tags/v2.3.1.zip -OutFile external\rpclib.zip }" ) else ( - %powershell% -command "iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile external\rpclib.zip" + %powershell% -command "iwr https://github.com/WouterJansen/rpclib/archive/refs/tags/v2.3.1.zip -OutFile external\rpclib.zip" ) @echo off @@ -93,39 +114,64 @@ IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% ( ECHO Unable to download rpclib, stopping build goto :buildfailed ) + + ECHO( ) REM //---------- Build rpclib ------------ -ECHO Starting cmake to build rpclib... IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER%\build mkdir external\rpclib\%RPC_VERSION_FOLDER%\build cd external\rpclib\%RPC_VERSION_FOLDER%\build +CALL :printHeader, "Configuring CMake rpclib" cmake -G"Visual Studio 17 2022" .. +ECHO( + +if %buildMode% == "" ( + CALL :printHeader, "Building rpclib - Configuration = Release" + cmake --build . --config Release + ECHO( -if "%buildMode%" == "" ( -cmake --build . -cmake --build . --config Release + CALL :printHeader, "Building rpclib - Configuration = Debug" + cmake --build . --config Debug + ECHO( + + CALL :printHeader, "Building rpclib - Configuration = RelWithDebInfo" + cmake --build . --config RelWithDebInfo + ECHO( ) else ( -cmake --build . --config %buildMode% + CALL :printHeader, "Building rpclib - Configuration = %buildMode%" + cmake --build . --config %buildMode% + ECHO( ) if ERRORLEVEL 1 goto :buildfailed chdir /d %ROOT_DIR% +ECHO( REM //---------- copy rpclib binaries and include folder inside AirLib folder ---------- +CALL :printHeader, "Copy rpclib lib and include files to AirLib folder structure" set RPCLIB_TARGET_LIB=AirLib\deps\rpclib\lib\x64 if NOT exist %RPCLIB_TARGET_LIB% mkdir %RPCLIB_TARGET_LIB% set RPCLIB_TARGET_INCLUDE=AirLib\deps\rpclib\include if NOT exist %RPCLIB_TARGET_INCLUDE% mkdir %RPCLIB_TARGET_INCLUDE% robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\include %RPCLIB_TARGET_INCLUDE% -if "%buildMode%" == "" ( -robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\Debug %RPCLIB_TARGET_LIB%\Debug -robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\Release %RPCLIB_TARGET_LIB%\Release +if %buildMode% == "" ( + @echo on + robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\Debug %RPCLIB_TARGET_LIB%\Debug + robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\Release %RPCLIB_TARGET_LIB%\Release + robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\RelWithDebInfo %RPCLIB_TARGET_LIB%\RelWithDebInfo + @echo off ) else ( -robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode% + @echo on + robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode% + @echo off ) +ECHO( + REM //---------- get High PolyCount SUV Car Model ------------ +CALL :printHeader, "Configure High Polycount SUV car model" + IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv mkdir Unreal\Plugins\AirSim\Content\VehicleAdv IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( IF NOT DEFINED noFullPolyCar ( @@ -133,11 +179,8 @@ IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( ECHO( ECHO( ECHO( - ECHO ***************************************************************************************** - ECHO Downloading high-poly car assets.... The download is ~37MB and can take some time. - ECHO To install without this assets, re-run build.cmd with the argument --no-full-poly-car - ECHO ***************************************************************************************** - + ECHO "Downloading high-poly car assets. To install without this assets, re-run build.cmd with the argument --no-full-poly-car" + IF EXIST suv_download_tmp rmdir suv_download_tmp /q /s mkdir suv_download_tmp @echo on @@ -160,51 +203,65 @@ IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( ECHO Not downloading high-poly car asset. The default unreal vehicle will be used. ) ) +ECHO( -REM //---------- get Eigen library ---------- +REM //---------- setup Eigen dependency for AirLib ---------- +CALL :printHeader, "Setup Eigen dependency for AirLib " IF NOT EXIST AirLib\deps mkdir AirLib\deps +IF NOT EXIST ExternalRepositories\Colosseum_Eigen\Eigen ( + ECHO Submodule ExternalRepositories\Colosseum_Eigen not properly initialized. Try running 'git submodule update --init' + goto :buildfailed +) IF NOT EXIST AirLib\deps\eigen3 ( - if "%PWSHV7%" == "" ( - %powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile eigen3.zip }" - ) else ( - %powershell% -command "iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile eigen3.zip" - ) - %powershell% -command "Expand-Archive -Path eigen3.zip -DestinationPath AirLib\deps" - %powershell% -command "Move-Item -Path AirLib\deps\eigen* -Destination AirLib\deps\del_eigen" - REM move AirLib\deps\eigen* AirLib\deps\del_eigen mkdir AirLib\deps\eigen3 - move AirLib\deps\del_eigen\Eigen AirLib\deps\eigen3\Eigen - rmdir /S /Q AirLib\deps\del_eigen - del eigen3.zip + robocopy /MIR ExternalRepositories\Colosseum_Eigen\Eigen AirLib\deps\eigen3\Eigen ) -IF NOT EXIST AirLib\deps\eigen3 goto :buildfailed +IF NOT EXIST AirLib\deps\eigen3 goto :buildfailed +ECHO( REM //---------- now we have all dependencies to compile AirSim.sln which will also compile MavLinkCom ---------- -if "%buildMode%" == "" ( -msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug AirSim.sln -if ERRORLEVEL 1 goto :buildfailed -msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Release AirSim.sln -if ERRORLEVEL 1 goto :buildfailed +if %buildMode% == "" ( + CALL :printHeader, "Building AirSim.sln Configuration = Debug" + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug AirSim.sln + ECHO( + if ERRORLEVEL 1 goto :buildfailed + + CALL :printHeader, "Building AirSim.sln Configuration = Release" + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Release AirSim.sln + ECHO( + if ERRORLEVEL 1 goto :buildfailed + + CALL :printHeader, "Building AirSim.sln Configuration = RelWithDebInfo" + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=RelWithDebInfo AirSim.sln + ECHO( + if ERRORLEVEL 1 goto :buildfailed ) else ( -msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=%buildMode% AirSim.sln -if ERRORLEVEL 1 goto :buildfailed + CALL :printHeader, "Building AirSim.sln Configuration = %buildMode%" + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=%buildMode% AirSim.sln + ECHO( + if ERRORLEVEL 1 goto :buildfailed ) REM //---------- copy binaries and include for MavLinkCom in deps ---------- +CALL :printHeader, "Copy MavLinkCom lib and include files into AirLib folder structure" set MAVLINK_TARGET_LIB=AirLib\deps\MavLinkCom\lib if NOT exist %MAVLINK_TARGET_LIB% mkdir %MAVLINK_TARGET_LIB% set MAVLINK_TARGET_INCLUDE=AirLib\deps\MavLinkCom\include if NOT exist %MAVLINK_TARGET_INCLUDE% mkdir %MAVLINK_TARGET_INCLUDE% robocopy /MIR MavLinkCom\include %MAVLINK_TARGET_INCLUDE% robocopy /MIR MavLinkCom\lib %MAVLINK_TARGET_LIB% +ECHO( REM //---------- all our output goes to Unreal/Plugin folder ---------- +CALL :printHeader, "Copy Airlib files into Unreal environment and plugin folder structure" if NOT exist Unreal\Plugins\AirSim\Source\AirLib mkdir Unreal\Plugins\AirSim\Source\AirLib robocopy /MIR AirLib Unreal\Plugins\AirSim\Source\AirLib /XD temp *. /njh /njs /ndl /np copy /y AirSim.props Unreal\Plugins\AirSim\Source\AirLib +ECHO( REM //---------- update all environments ---------- +CALL :printHeader, "Update all Unreal environments" FOR /D %%E IN (Unreal\Environments\*) DO ( cd %%E call .\update_from_git.bat ..\..\.. @@ -215,12 +272,34 @@ REM //---------- done building ---------- exit /b 0 :buildfailed -echo( -echo #### Build failed - see messages above. 1>&2 +CALL :printHeader, "Build failed!" +echo Build failed - see messages above. 1>&2 :buildfailed_nomsg chdir /d %ROOT_DIR% exit /b 1 +:setESC +for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( + set ESC=%%b + exit /B 0 +) +exit /B 0 +:printHeader +REM //---------- PrintHeader function ---------- +if not "%~1"=="" ( + ECHO %ESC%[33m*****************************************************************************************%ESC%[0m + ECHO %ESC%[33m%~1%ESC%%[0 + ECHO %ESC%[33m*****************************************************************************************%ESC%%[0m +) +exit /b 0 +:printError +REM //---------- PrintError function ---------- +if not "%~1"=="" ( +REM ECHO %ESC%[31m*****************************************************************************************%ESC%[0m + ECHO %ESC%[31m%~1%ESC%%[0 +REM ECHO %ESC%[31m*****************************************************************************************%ESC%%[0m +) +exit /b 0 diff --git a/clean.cmd b/clean.cmd index de777111be..d1aef4cf80 100644 --- a/clean.cmd +++ b/clean.cmd @@ -1,14 +1,66 @@ -rd /s/q AirLib\lib -rd /s/q AirLib\deps\MavLinkCom -rd /s/q AirLib\deps\rpclib -rd /s/q external\rpclib\build +@echo off +setlocal +call :setESC + +CALL :printHeader, "Removing folders" +call :removeFolder, "external" +call :removeFolder, "AirLib\deps" +call :removeFolder, "AirLib\temp" +call :removeFolder, "AirLib\lib" +ECHO( + +CALL :printHeader, "Cleaning visual studio solutions: Configuration = Debug" msbuild /p:Platform=x64 /p:Configuration=Debug AirSim.sln /t:Clean if ERRORLEVEL 1 goto :buildfailed +ECHO( + +CALL :printHeader, "Cleaning visual studio solutions: Configuration = Release" msbuild /p:Platform=x64 /p:Configuration=Release AirSim.sln /t:Clean if ERRORLEVEL 1 goto :buildfailed +ECHO( + +CALL :printHeader, "Cleaning visual studio solutions: Configuration = RelWithDebInfo" +msbuild /p:Platform=x64 /p:Configuration=RelWithDebInfo AirSim.sln /t:Clean +if ERRORLEVEL 1 goto :buildfailed +ECHO( + +CALL :printHeader, "Cleaning git" +git clean -ffdx +ECHO( + +CALL :printHeader, "Pulling latest in git" +git pull +ECHO( + +CALL :printHeader, "Clean completed successfully" goto :eof :buildfailed -echo #### Build failed -goto :eof \ No newline at end of file +CALL :printHeader, "Clean failed" +goto :eof + +:setESC +for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( + set ESC=%%b + exit /B 0 +) +exit /B 0 + +:removeFolder + IF EXIST %~1 ( + ECHO Removing folder: %~1 + rd /s/q %~1 + ) ELSE ( + ECHO folder "%~1" does not exist! + ) +exit /b 0 + +:printHeader +REM //---------- PrintHeader function ---------- +if not "%~1"=="" ( + ECHO %ESC%[33m*****************************************************************************************%ESC%[0m + ECHO %ESC%[33m%~1%ESC%%[0 + ECHO %ESC%[33m*****************************************************************************************%ESC%%[0m +) +exit /b 0 \ No newline at end of file