diff --git a/AirLib/AirLib.vcxproj b/AirLib/AirLib.vcxproj index 0e6d1b948f..118d2e3593 100644 --- a/AirLib/AirLib.vcxproj +++ b/AirLib/AirLib.vcxproj @@ -304,8 +304,8 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) include;deps\eigen3;deps\rpclib\include;$(ProjectDir)..\MavLinkCom\include - true - /w34263 /w34266 %(AdditionalOptions) + false + /utf-8 /wd4819 /wd4828 /w34263 /w34266 %(AdditionalOptions) stdcpp17 @@ -329,8 +329,8 @@ Disabled _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) include;deps\eigen3;deps\rpclib\include;$(ProjectDir)..\MavLinkCom\include - true - /w34263 /w34266 %(AdditionalOptions) + false + /utf-8 /wd4819 /wd4828 /w34263 /w34266 %(AdditionalOptions) 4100;4505;4820;4464;4514;4710;4571;%(DisableSpecificWarnings) stdcpp17 @@ -357,8 +357,8 @@ true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) include;deps\eigen3;deps\rpclib\include;$(ProjectDir)..\MavLinkCom\include - true - /w34263 /w34266 %(AdditionalOptions) + false + /utf-8 /wd4819 /wd4828 /w34263 /w34266 %(AdditionalOptions) stdcpp17 @@ -386,8 +386,8 @@ true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) include;deps\eigen3;deps\rpclib\include;$(ProjectDir)..\MavLinkCom\include - true - /w34263 /w34266 %(AdditionalOptions) + false + /utf-8 /wd4819 /wd4828 /w34263 /w34266 %(AdditionalOptions) stdcpp17 false @@ -464,8 +464,14 @@ deps\rpclib\lib\$(Platform)\$(Configuration) - - + + + + /utf-8 /wd4819 /wd4828 %(AdditionalOptions) + false + + + - \ No newline at end of file + diff --git a/AirSim.props b/AirSim.props index d4487d889c..72c66ac0d5 100644 --- a/AirSim.props +++ b/AirSim.props @@ -1,6 +1,18 @@ - $([System.String]::Copy('$(WindowsSDKVersion)').Replace('\','')) + $([System.String]::Copy('$(WindowsSDKVersion)').Replace('\\','')) $(AirSimTargetPlatformVersion) - \ No newline at end of file + + + /utf-8 /wd4819 /wd4828 %(AdditionalOptions) + false + + + + + /utf-8 /wd4819 /wd4828 /wd4127 /WX- %(AdditionalOptions) + false + + + diff --git a/DroneServer/DroneServer.vcxproj b/DroneServer/DroneServer.vcxproj index df280d4804..f7b4ef07d5 100644 --- a/DroneServer/DroneServer.vcxproj +++ b/DroneServer/DroneServer.vcxproj @@ -1,6 +1,6 @@  - - + + true @@ -277,4 +277,4 @@ - \ No newline at end of file + diff --git a/HelloSpawnedDrones/HelloSpawnedDrones.vcxproj b/HelloSpawnedDrones/HelloSpawnedDrones.vcxproj index 16caf34f0d..9e347710b1 100644 --- a/HelloSpawnedDrones/HelloSpawnedDrones.vcxproj +++ b/HelloSpawnedDrones/HelloSpawnedDrones.vcxproj @@ -1,5 +1,9 @@ - + + + + true + Debug @@ -253,4 +257,4 @@ - \ No newline at end of file + diff --git a/MavLinkCom/build_mavlinkcom.binlog b/MavLinkCom/build_mavlinkcom.binlog new file mode 100644 index 0000000000..18818c9d99 Binary files /dev/null and b/MavLinkCom/build_mavlinkcom.binlog differ diff --git a/MavLinkCom/src/impl/AdHocConnectionImpl.cpp b/MavLinkCom/src/impl/AdHocConnectionImpl.cpp index 6c68da5f0c..3817fa3bc6 100644 --- a/MavLinkCom/src/impl/AdHocConnectionImpl.cpp +++ b/MavLinkCom/src/impl/AdHocConnectionImpl.cpp @@ -1,7 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "AdHocConnectionImpl.hpp" +#include "AdHocConnectionImpl.hpp" +#if defined(_WIN32) +#include +#define AIRSIM_SLEEP_MS(ms) ::Sleep((DWORD)(ms)) +#else +#include +#include +#define AIRSIM_SLEEP_MS(ms) std::this_thread::sleep_for(std::chrono::milliseconds(ms)) +#endif #include "Utils.hpp" #include "ThreadUtils.hpp" #include "../serial_com/Port.h" @@ -184,14 +192,14 @@ void AdHocConnectionImpl::readPackets() int read = 0; if (safePort->isClosed()) { // hmmm, wait till it is opened? - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + AIRSIM_SLEEP_MS(10); continue; } int count = safePort->read(buffer, MAXBUFFER); if (count <= 0) { // error? well let's try again, but we should be careful not to spin too fast and kill the CPU - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + AIRSIM_SLEEP_MS(1); continue; } @@ -200,7 +208,7 @@ void AdHocConnectionImpl::readPackets() std::cerr << "GAH KM911 message size (" << std::to_string(count) << ") is bigger than max buffer size! Time to support frame breaks, Moffitt" << std::endl; // error? well let's try again, but we should be careful not to spin too fast and kill the CPU - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + AIRSIM_SLEEP_MS(1); continue; } diff --git a/MavLinkCom/src/impl/MavLinkConnectionImpl.cpp b/MavLinkCom/src/impl/MavLinkConnectionImpl.cpp index 61dd8cc604..ef08ec7b0d 100644 --- a/MavLinkCom/src/impl/MavLinkConnectionImpl.cpp +++ b/MavLinkCom/src/impl/MavLinkConnectionImpl.cpp @@ -1,7 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "MavLinkMessages.hpp" +#include "MavLinkMessages.hpp" +#if defined(_WIN32) +#include +#define AIRSIM_SLEEP_MS(ms) ::Sleep((DWORD)(ms)) +#else +#include +#include +#define AIRSIM_SLEEP_MS(ms) std::this_thread::sleep_for(std::chrono::milliseconds(ms)) +#endif #include "MavLinkConnectionImpl.hpp" #include "Utils.hpp" #include "ThreadUtils.hpp" @@ -417,14 +425,14 @@ void MavLinkConnectionImpl::readPackets() int read = 0; if (safePort->isClosed()) { // hmmm, wait till it is opened? - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + AIRSIM_SLEEP_MS(10); continue; } int count = safePort->read(buffer, MAXBUFFER); if (count <= 0) { // error? well let's try again, but we should be careful not to spin too fast and kill the CPU - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + AIRSIM_SLEEP_MS(1); continue; } for (int i = 0; i < count; i++) { diff --git a/MavLinkCom/src/impl/MavLinkFtpClientImpl.cpp b/MavLinkCom/src/impl/MavLinkFtpClientImpl.cpp index 6a504c247a..5ed6aadc14 100644 --- a/MavLinkCom/src/impl/MavLinkFtpClientImpl.cpp +++ b/MavLinkCom/src/impl/MavLinkFtpClientImpl.cpp @@ -1,7 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "MavLinkFtpClientImpl.hpp" +#include "MavLinkFtpClientImpl.hpp" +#if defined(_WIN32) +#include +#define AIRSIM_SLEEP_MS(ms) ::Sleep((DWORD)(ms)) +#else +#include +#include +#define AIRSIM_SLEEP_MS(ms) std::this_thread::sleep_for(std::chrono::milliseconds(ms)) +#endif #include #include "Utils.hpp" #include "FileSystem.hpp" diff --git a/MavLinkCom/src/impl/MavLinkNodeImpl.cpp b/MavLinkCom/src/impl/MavLinkNodeImpl.cpp index 488f98c818..958402c6fb 100644 --- a/MavLinkCom/src/impl/MavLinkNodeImpl.cpp +++ b/MavLinkCom/src/impl/MavLinkNodeImpl.cpp @@ -1,7 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "MavLinkNodeImpl.hpp" +#include "MavLinkNodeImpl.hpp" +#if defined(_WIN32) +#include +#define AIRSIM_SLEEP_MS(ms) ::Sleep((DWORD)(ms)) +#else +#include +#include +#define AIRSIM_SLEEP_MS(ms) std::this_thread::sleep_for(std::chrono::milliseconds(ms)) +#endif #include "Utils.hpp" #include "MavLinkMessages.hpp" #include "Semaphore.hpp" @@ -50,7 +58,7 @@ void MavLinkNodeImpl::sendHeartbeat() CurrentThread::setThreadName("MavLinkThread"); while (heartbeat_running_) { sendOneHeartbeat(); - std::this_thread::sleep_for(std::chrono::milliseconds(heartbeatMilliseconds)); + AIRSIM_SLEEP_MS(heartbeatMilliseconds); } } diff --git a/Unreal/Environments/Blocks/.vsconfig b/Unreal/Environments/Blocks/.vsconfig new file mode 100644 index 0000000000..1a9d7180be --- /dev/null +++ b/Unreal/Environments/Blocks/.vsconfig @@ -0,0 +1,13 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.Net.Component.4.6.2.TargetingPack", + "Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64", + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "Microsoft.VisualStudio.Component.Windows10SDK.22000", + "Microsoft.VisualStudio.Workload.CoreEditor", + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.VisualStudio.Workload.NativeDesktop", + "Microsoft.VisualStudio.Workload.NativeGame" + ] +} diff --git a/Unreal/Environments/Blocks/Blocks.uproject b/Unreal/Environments/Blocks/Blocks.uproject index 589d42e59d..c543481818 100644 --- a/Unreal/Environments/Blocks/Blocks.uproject +++ b/Unreal/Environments/Blocks/Blocks.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "4.27", + "EngineAssociation": "5.3", "Category": "", "Description": "", "Modules": [ diff --git a/Unreal/Environments/Blocks/Config/DefaultEngine.ini b/Unreal/Environments/Blocks/Config/DefaultEngine.ini index 7fe1348403..04ef95ac89 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=8FCD42D14CD8D84835C46FB037E7C701 +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..c68d330fdd 100644 --- a/Unreal/Environments/Blocks/Config/DefaultInput.ini +++ b/Unreal/Environments/Blocks/Config/DefaultInput.ini @@ -1,20 +1,86 @@ [/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 - diff --git a/Unreal/Environments/Blocks/Content/Flying/FlyingGameMode.uasset b/Unreal/Environments/Blocks/Content/Flying/FlyingGameMode.uasset new file mode 100644 index 0000000000..76422e283a Binary files /dev/null and b/Unreal/Environments/Blocks/Content/Flying/FlyingGameMode.uasset differ diff --git a/Unreal/Environments/Blocks/Content/FlyingCPP/Maps/FlyingExampleMap.umap b/Unreal/Environments/Blocks/Content/FlyingCPP/Maps/FlyingExampleMap.umap index 412fce6f39..04f04e4aac 100644 Binary files a/Unreal/Environments/Blocks/Content/FlyingCPP/Maps/FlyingExampleMap.umap and b/Unreal/Environments/Blocks/Content/FlyingCPP/Maps/FlyingExampleMap.umap differ diff --git a/Unreal/Plugins/AirSim/AirSim.uplugin b/Unreal/Plugins/AirSim/AirSim.uplugin index 8d0420b2b2..74c9d517e4 100644 --- a/Unreal/Plugins/AirSim/AirSim.uplugin +++ b/Unreal/Plugins/AirSim/AirSim.uplugin @@ -22,9 +22,9 @@ } ], "Plugins": [ - { - "Name": "PhysXVehicles", - "Enabled": true - } + { + "Name": "ChaosVehiclesPlugin", + "Enabled": true + } ] } diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp index cc8dcb3112..d8827c9510 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp @@ -23,8 +23,9 @@ #include #include "common/common_utils/Utils.hpp" #include "Modules/ModuleManager.h" -#include "ARFilter.h" -#include "AssetRegistryModule.h" +#include "AssetRegistry/ARFilter.h" +#include "AssetRegistry/AssetRegistryModule.h" +#include "CineCameraComponent.h" #include "DetectionComponent.h" /* diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h index 46d2a8a936..c50c8a8b7a 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h @@ -4,7 +4,7 @@ #pragma once #include "CoreMinimal.h" -#include "Runtime/AssetRegistry/Public/AssetRegistryModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "GameFramework/Actor.h" #include "Components/InputComponent.h" #include "EngineUtils.h" @@ -17,9 +17,9 @@ #include "Kismet/GameplayStatics.h" #include "Kismet/KismetStringLibrary.h" #include "Engine/World.h" -#include "Runtime/Landscape/Classes/LandscapeComponent.h" -#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h" -#include "Runtime/Core/Public/HAL/FileManager.h" +#include "Delegates/Delegate.h" +#include "LandscapeComponent.h" +#include "HAL/FileManager.h" #include "common/AirSimSettings.hpp" #include #include @@ -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 TMemFunPtrType::Type 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 TMemFunPtrType::Type 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 TMemFunPtrType::Type func) { APlayerController* controller = actor->GetWorld()->GetFirstPlayerController(); diff --git a/Unreal/Plugins/AirSim/Source/AirSim.Build.cs b/Unreal/Plugins/AirSim/Source/AirSim.Build.cs index 17024a35b6..aaa44a5dd4 100644 --- a/Unreal/Plugins/AirSim/Source/AirSim.Build.cs +++ b/Unreal/Plugins/AirSim/Source/AirSim.Build.cs @@ -40,19 +40,16 @@ private enum CompileMode private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target) { - LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom"); - switch (mode) { case CompileMode.HeaderOnlyNoRpc: PublicDefinitions.Add("AIRLIB_HEADER_ONLY=1"); PublicDefinitions.Add("AIRLIB_NO_RPC=1"); - AddLibDependency("AirLib", Path.Combine(AirLibPath, "lib"), "AirLib", Target, false); + // No static libs in header-only mode break; case CompileMode.HeaderOnlyWithRpc: PublicDefinitions.Add("AIRLIB_HEADER_ONLY=1"); - AddLibDependency("AirLib", Path.Combine(AirLibPath, "lib"), "AirLib", Target, false); LoadAirSimDependency(Target, "rpclib", "rpc"); break; @@ -62,6 +59,7 @@ private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target) break; case CompileMode.CppCompileWithRpc: + LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom"); LoadAirSimDependency(Target, "rpclib", "rpc"); break; @@ -78,8 +76,23 @@ public AirSim(ReadOnlyTargetRules Target) : base(Target) bEnableExceptions = true; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "ImageWrapper", "RenderCore", "RHI", "AssetRegistry", "PhysicsCore", "PhysXVehicles", "PhysXVehicleLib", "PhysX", "APEX", "Landscape", "CinematicCamera" }); + // UE5 uses Chaos instead of PhysX. Replace PhysX modules with Chaos equivalents. + PublicDependencyModuleNames.AddRange(new string[] { + "Core", "CoreUObject", "Engine", "InputCore", "ImageWrapper", "RenderCore", "RHI", + "AssetRegistry", "PhysicsCore", "Landscape", "CinematicCamera" + }); + + if (Target.Version.MajorVersion >= 5) + { + // Chaos vehicles for UE5 + PublicDependencyModuleNames.AddRange(new string[] { "Chaos", "ChaosVehicles" }); + } + else + { + PublicDependencyModuleNames.AddRange(new string[] { "PhysXVehicles", "PhysXVehicleLib", "PhysX", "APEX" }); + } PrivateDependencyModuleNames.AddRange(new string[] { "UMG", "Slate", "SlateCore" }); + PublicDependencyModuleNames.AddRange(new string[] { "FieldNotification" }); //suppress VC++ proprietary warnings PublicDefinitions.Add("_SCL_SECURE_NO_WARNINGS=1"); @@ -90,19 +103,20 @@ public AirSim(ReadOnlyTargetRules Target) : base(Target) PublicIncludePaths.Add(Path.Combine(AirLibPath, "deps", "eigen3")); AddOSLibDependencies(Target); - SetupCompileMode(CompileMode.HeaderOnlyWithRpc, Target); + // Build C++ with RPC to link prebuilt deps + SetupCompileMode(CompileMode.CppCompileWithRpc, Target); } private void AddOSLibDependencies(ReadOnlyTargetRules Target) { if (Target.Platform == UnrealTargetPlatform.Win64) { - // for SHGetFolderPath. - PublicAdditionalLibraries.Add("Shell32.lib"); - - //for joystick support - PublicAdditionalLibraries.Add("dinput8.lib"); - PublicAdditionalLibraries.Add("dxguid.lib"); + // System libs + PublicSystemLibraries.Add("Shell32.lib"); + PublicSystemLibraries.Add("dinput8.lib"); + PublicSystemLibraries.Add("dxguid.lib"); + // Ensure C++ stdlib import is available when linking prebuilt deps + PublicSystemLibraries.Add("msvcprt.lib"); } if (Target.Platform == UnrealTargetPlatform.Linux) diff --git a/Unreal/Plugins/AirSim/Source/DetectionComponent.h b/Unreal/Plugins/AirSim/Source/DetectionComponent.h index 6f0899af15..f926a724cf 100644 --- a/Unreal/Plugins/AirSim/Source/DetectionComponent.h +++ b/Unreal/Plugins/AirSim/Source/DetectionComponent.h @@ -12,6 +12,14 @@ struct FDetectionInfo { GENERATED_BODY() + FDetectionInfo() + : Actor(nullptr) + , Box2D(FVector2D::ZeroVector, FVector2D::ZeroVector) + , Box3D(EForceInit::ForceInit) + , RelativeTransform(FTransform::Identity) + { + } + UPROPERTY() AActor* Actor; diff --git a/Unreal/Plugins/AirSim/Source/SimMode/LoadingScreenWidget.h b/Unreal/Plugins/AirSim/Source/SimMode/LoadingScreenWidget.h index e640c980e0..1cd6a1c1d6 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/LoadingScreenWidget.h +++ b/Unreal/Plugins/AirSim/Source/SimMode/LoadingScreenWidget.h @@ -4,7 +4,6 @@ #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" -#include "Runtime/UMG/Public/Components/Image.h" #include "LoadingScreenWidget.generated.h" UCLASS() diff --git a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp index 6edb123860..1976841e79 100644 --- a/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp +++ b/Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp @@ -226,10 +226,14 @@ void ASimModeBase::initializeTimeOfDay() static const FName sun_prop_name(TEXT("Directional light actor")); auto* p = sky_sphere_class_->FindPropertyByName(sun_prop_name); -#if ENGINE_MINOR_VERSION > 24 +#if ENGINE_MAJOR_VERSION >= 5 FObjectProperty* sun_prop = CastFieldChecked(p); #else + #if ENGINE_MINOR_VERSION > 24 + FObjectProperty* sun_prop = CastFieldChecked(p); + #else UObjectProperty* sun_prop = Cast(p); + #endif #endif UObject* sun_obj = sun_prop->GetObjectPropertyValue_InContainer(sky_sphere_); diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp index db41000a1a..410e00f2c4 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.cpp @@ -4,7 +4,11 @@ #include "Components/TextRenderComponent.h" #include "Components/AudioComponent.h" #include "Sound/SoundCue.h" +#if ENGINE_MAJOR_VERSION >= 5 +#include "ChaosWheeledVehicleMovementComponent.h" +#else #include "WheeledVehicleMovementComponent4W.h" +#endif #include "CarWheelFront.h" #include "CarWheelRear.h" @@ -85,7 +89,11 @@ ACarPawn::ACarPawn() void ACarPawn::setupVehicleMovementComponent() { + #if ENGINE_MAJOR_VERSION >= 5 + UChaosWheeledVehicleMovementComponent* movement = CastChecked(getVehicleMovementComponent()); + #else UWheeledVehicleMovementComponent4W* movement = CastChecked(getVehicleMovementComponent()); + #endif check(movement->WheelSetups.Num() == 4); // Wheels/Tires @@ -107,10 +115,12 @@ void ACarPawn::setupVehicleMovementComponent() movement->WheelSetups[3].AdditionalOffset = FVector(0.f, 8.f, 0.f); // Adjust the tire loading +#if ENGINE_MAJOR_VERSION < 5 movement->MinNormalizedTireLoad = 0.0f; movement->MinNormalizedTireLoadFiltered = 0.2308f; movement->MaxNormalizedTireLoad = 2.0f; movement->MaxNormalizedTireLoadFiltered = 2.0f; +#endif // Engine // Torque setup @@ -121,22 +131,39 @@ void ACarPawn::setupVehicleMovementComponent() movement->EngineSetup.TorqueCurve.GetRichCurve()->AddKey(5730.0f, 400.0f); // Adjust the steering +#if ENGINE_MAJOR_VERSION >= 5 + movement->SteeringSetup.SteeringCurve.GetRichCurve()->Reset(); + movement->SteeringSetup.SteeringCurve.GetRichCurve()->AddKey(0.0f, 1.0f); + movement->SteeringSetup.SteeringCurve.GetRichCurve()->AddKey(40.0f, 0.7f); + movement->SteeringSetup.SteeringCurve.GetRichCurve()->AddKey(120.0f, 0.6f); +#else movement->SteeringCurve.GetRichCurve()->Reset(); movement->SteeringCurve.GetRichCurve()->AddKey(0.0f, 1.0f); movement->SteeringCurve.GetRichCurve()->AddKey(40.0f, 0.7f); movement->SteeringCurve.GetRichCurve()->AddKey(120.0f, 0.6f); +#endif - // Transmission + // Transmission / Differential // We want 4wd +#if ENGINE_MAJOR_VERSION >= 5 + movement->DifferentialSetup.DifferentialType = EVehicleDifferential::AllWheelDrive; +#else movement->DifferentialSetup.DifferentialType = EVehicleDifferential4W::LimitedSlip_4W; +#endif // Drive the front wheels a little more than the rear movement->DifferentialSetup.FrontRearSplit = 0.65; // Automatic gearbox +#if ENGINE_MAJOR_VERSION >= 5 + movement->TransmissionSetup.bUseAutomaticGears = true; + movement->TransmissionSetup.GearChangeTime = 0.15f; + // Chaos transmission doesn't expose GearAutoBoxLatency +#else movement->TransmissionSetup.bUseGearAutoBox = true; movement->TransmissionSetup.GearSwitchTime = 0.15f; movement->TransmissionSetup.GearAutoBoxLatency = 1.0f; +#endif // Disable reverse as brake, this is needed for SetBreakInput() to take effect movement->bReverseAsBrake = false; @@ -150,7 +177,9 @@ void ACarPawn::setupVehicleMovementComponent() // Set the inertia scale. This controls how the mass of the vehicle is distributed. movement->InertiaTensorScale = FVector(1.0f, 1.333f, 1.2f); +#if ENGINE_MAJOR_VERSION < 5 movement->bDeprecatedSpringOffsetMode = true; +#endif } void ACarPawn::NotifyHit(class UPrimitiveComponent* MyComp, class AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, @@ -159,10 +188,17 @@ void ACarPawn::NotifyHit(class UPrimitiveComponent* MyComp, class AActor* Other, pawn_events_.getCollisionSignal().emit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalImpulse, Hit); } +#if ENGINE_MAJOR_VERSION >= 5 +UChaosVehicleMovementComponent* ACarPawn::getVehicleMovementComponent() const +{ + return GetVehicleMovementComponent(); +} +#else UWheeledVehicleMovementComponent* ACarPawn::getVehicleMovementComponent() const { return GetVehicleMovement(); } +#endif void ACarPawn::initializeForBeginPlay(bool engine_sound) { @@ -250,8 +286,15 @@ void ACarPawn::Tick(float Delta) updateInCarHUD(); // Pass the engine RPM to the sound component +#if ENGINE_MAJOR_VERSION >= 5 + if (auto* ChaosMove = Cast(GetVehicleMovementComponent())) { + float RPMToAudioScale = 2500.0f / ChaosMove->GetEngineMaxRotationSpeed(); + engine_sound_audio_->SetFloatParameter(FName("RPM"), ChaosMove->GetEngineRotationSpeed() * RPMToAudioScale); + } +#else float RPMToAudioScale = 2500.0f / GetVehicleMovement()->GetEngineMaxRotationSpeed(); engine_sound_audio_->SetFloatParameter(FName("RPM"), GetVehicleMovement()->GetEngineRotationSpeed() * RPMToAudioScale); +#endif pawn_events_.getPawnTickSignal().emit(Delta); } @@ -285,7 +328,13 @@ void ACarPawn::updateHUDStrings() UAirBlueprintLib::LogMessage(TEXT("Speed: "), last_speed_.ToString(), LogDebugLevel::Informational); UAirBlueprintLib::LogMessage(TEXT("Gear: "), last_gear_.ToString(), LogDebugLevel::Informational); + #if ENGINE_MAJOR_VERSION >= 5 + if (auto* ChaosMove = Cast(GetVehicleMovementComponent())) { + UAirBlueprintLib::LogMessage(TEXT("RPM: "), FText::AsNumber(ChaosMove->GetEngineRotationSpeed()).ToString(), LogDebugLevel::Informational); + } + #else UAirBlueprintLib::LogMessage(TEXT("RPM: "), FText::AsNumber(GetVehicleMovement()->GetEngineRotationSpeed()).ToString(), LogDebugLevel::Informational); + #endif } void ACarPawn::updateInCarHUD() diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.h b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.h index 16f12f9c72..96cf697730 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawn.h @@ -1,7 +1,7 @@ #pragma once #include "CoreMinimal.h" -#include "WheeledVehicle.h" +#include "WheeledVehiclePawn.h" #include "Components/SkeletalMeshComponent.h" #include "PhysicalMaterials/PhysicalMaterial.h" #include "UObject/ConstructorHelpers.h" @@ -26,7 +26,7 @@ class UInputComponent; class UAudioComponent; UCLASS(config = Game) -class ACarPawn : public AWheeledVehicle +class ACarPawn : public AWheeledVehiclePawn { GENERATED_BODY() @@ -46,7 +46,11 @@ class ACarPawn : public AWheeledVehicle { return &pawn_events_; } - UWheeledVehicleMovementComponent* getVehicleMovementComponent() const; +#if ENGINE_MAJOR_VERSION >= 5 + class UChaosVehicleMovementComponent* getVehicleMovementComponent() const; +#else + class UWheeledVehicleMovementComponent* getVehicleMovementComponent() const; +#endif const msr::airlib::CarApiBase::CarControls& getKeyBoardControls() const { return keyboard_controls_; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.cpp index 3a0272d19b..7f86f03574 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.cpp @@ -1,13 +1,15 @@ #include "CarPawnApi.h" #include "AirBlueprintLib.h" +#if ENGINE_MAJOR_VERSION < 5 #include "PhysXVehicleManager.h" +#endif CarPawnApi::CarPawnApi(ACarPawn* pawn, const msr::airlib::Kinematics::State* pawn_kinematics, msr::airlib::CarApiBase* vehicle_api) : pawn_(pawn), pawn_kinematics_(pawn_kinematics), vehicle_api_(vehicle_api) { - movement_ = pawn->GetVehicleMovement(); + movement_ = pawn->GetVehicleMovementComponent(); } void CarPawnApi::updateMovement(const msr::airlib::CarApiBase::CarControls& controls) @@ -23,16 +25,27 @@ void CarPawnApi::updateMovement(const msr::airlib::CarApiBase::CarControls& cont movement_->SetSteeringInput(controls.steering); movement_->SetBrakeInput(controls.brake); movement_->SetHandbrakeInput(controls.handbrake); + #if ENGINE_MAJOR_VERSION >= 5 + movement_->SetUseAutomaticGears(!controls.is_manual_gear); + #else movement_->SetUseAutoGears(!controls.is_manual_gear); + #endif } msr::airlib::CarApiBase::CarState CarPawnApi::getCarState() const { + float rpm = 0.0f; + float rpm_max = 0.0f; +#if ENGINE_MAJOR_VERSION < 5 + rpm = movement_->GetEngineRotationSpeed(); + rpm_max = movement_->GetEngineMaxRotationSpeed(); +#endif + msr::airlib::CarApiBase::CarState state( movement_->GetForwardSpeed() / 100, //cm/s -> m/s movement_->GetCurrentGear(), - movement_->GetEngineRotationSpeed(), - movement_->GetEngineMaxRotationSpeed(), + rpm, + rpm_max, last_controls_.handbrake, *pawn_kinematics_, vehicle_api_->clock()->nowNanos()); @@ -57,6 +70,7 @@ void CarPawnApi::reset() vehicle_api_->setCarControls(msr::airlib::CarApiBase::CarControls()); updateMovement(msr::airlib::CarApiBase::CarControls()); +#if ENGINE_MAJOR_VERSION < 5 auto pv = movement_->PVehicle; if (pv) { pv->mWheelsDynData.setToRestState(); @@ -65,6 +79,7 @@ void CarPawnApi::reset() if (pvd) { pvd->mDriveDynData.setToRestState(); } +#endif }, true); diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.h b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.h index 7bb391bdbc..869377e37a 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnApi.h @@ -1,7 +1,11 @@ #pragma once #include "vehicles/car/api/CarApiBase.hpp" +#if ENGINE_MAJOR_VERSION >= 5 +#include "ChaosVehicleMovementComponent.h" +#else #include "WheeledVehicleMovementComponent4W.h" +#endif #include "physics/Kinematics.hpp" #include "CarPawn.h" @@ -23,7 +27,11 @@ class CarPawnApi virtual ~CarPawnApi(); private: +#if ENGINE_MAJOR_VERSION >= 5 + UChaosVehicleMovementComponent* movement_; +#else UWheeledVehicleMovementComponent* movement_; +#endif msr::airlib::CarApiBase::CarControls last_controls_; ACarPawn* pawn_; const msr::airlib::Kinematics::State* pawn_kinematics_; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnSimApi.h b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnSimApi.h index fe09411a69..1ff2c2eaaa 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarPawnSimApi.h @@ -1,7 +1,11 @@ #pragma once #include "CoreMinimal.h" +#if ENGINE_MAJOR_VERSION >= 5 +#include "ChaosVehicleMovementComponent.h" +#else #include "WheeledVehicleMovementComponent4W.h" +#endif #include "CarPawn.h" #include "CarPawnApi.h" diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.cpp index 72afaeea80..be6f84ec37 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.cpp @@ -1,11 +1,24 @@ // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "CarWheelFront.h" -#include "TireConfig.h" #include "UObject/ConstructorHelpers.h" UCarWheelFront::UCarWheelFront() { +#if ENGINE_MAJOR_VERSION >= 5 + WheelRadius = 18.f; + WheelWidth = 15.0f; + WheelMass = 20.0f; + bAffectedByHandbrake = false; + MaxSteerAngle = 40.f; + + SuspensionForceOffset = FVector::ZeroVector; + SuspensionMaxRaise = 10.0f; + SuspensionMaxDrop = 10.0f; + SuspensionDampingRatio = 1.05f; + + // Chaos Vehicles do not use UTireConfig; tune friction via wheel/physmat if needed +#else ShapeRadius = 18.f; ShapeWidth = 15.0f; Mass = 20.0f; @@ -20,7 +33,7 @@ UCarWheelFront::UCarWheelFront() SuspensionNaturalFrequency = 9.0f; SuspensionDampingRatio = 1.05f; - // Find the tire object and set the data for it static ConstructorHelpers::FObjectFinder TireData(TEXT("/AirSim/VehicleAdv/Vehicle/WheelData/Vehicle_FrontTireConfig.Vehicle_FrontTireConfig")); TireConfig = TireData.Object; +#endif } diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.h b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.h index fd9d088d99..44f098d114 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelFront.h @@ -3,11 +3,11 @@ #pragma once #include "CoreMinimal.h" -#include "VehicleWheel.h" +#include "ChaosVehicleWheel.h" #include "CarWheelFront.generated.h" UCLASS() -class UCarWheelFront : public UVehicleWheel +class UCarWheelFront : public UChaosVehicleWheel { GENERATED_BODY() diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.cpp index d7ce40aac5..22d325f9c0 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.cpp @@ -1,11 +1,24 @@ // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "CarWheelRear.h" -#include "TireConfig.h" #include "UObject/ConstructorHelpers.h" UCarWheelRear::UCarWheelRear() { +#if ENGINE_MAJOR_VERSION >= 5 + WheelRadius = 18.f; + WheelWidth = 15.0f; + bAffectedByHandbrake = true; + MaxSteerAngle = 0.f; + + // Setup suspension forces + SuspensionForceOffset = FVector::ZeroVector; + SuspensionMaxRaise = 10.0f; + SuspensionMaxDrop = 10.0f; + SuspensionDampingRatio = 1.05f; + + // Chaos Vehicles do not use UTireConfig +#else ShapeRadius = 18.f; ShapeWidth = 15.0f; bAffectedByHandbrake = true; @@ -18,7 +31,7 @@ UCarWheelRear::UCarWheelRear() SuspensionNaturalFrequency = 9.0f; SuspensionDampingRatio = 1.05f; - // Find the tire object and set the data for it static ConstructorHelpers::FObjectFinder TireData(TEXT("/AirSim/VehicleAdv/Vehicle/WheelData/Vehicle_BackTireConfig.Vehicle_BackTireConfig")); TireConfig = TireData.Object; +#endif } diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.h b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.h index 6bd933747c..64b5df89c1 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Car/CarWheelRear.h @@ -3,11 +3,11 @@ #pragma once #include "CoreMinimal.h" -#include "VehicleWheel.h" +#include "ChaosVehicleWheel.h" #include "CarWheelRear.generated.h" UCLASS() -class UCarWheelRear : public UVehicleWheel +class UCarWheelRear : public UChaosVehicleWheel { GENERATED_BODY() diff --git a/build.cmd b/build.cmd index a3c1f37cf5..dc758b147b 100644 --- a/build.cmd +++ b/build.cmd @@ -4,8 +4,9 @@ setlocal set ROOT_DIR=%~dp0 REM // Check command line arguments -set "noFullPolyCar=" -set "buildMode=" +set "noFullPolyCar=" +set "buildMode=" +set "skipMsbuild=" REM //check VS version if "%VisualStudioVersion%" == "" ( @@ -22,15 +23,25 @@ if "%VisualStudioVersion%" lss "17.0" ( ) if "%1"=="" goto noargs -if "%1"=="--no-full-poly-car" set "noFullPolyCar=y" +if "%1"=="--no-full-poly-car" set "noFullPolyCar=y" +if "%1"=="--skip-msbuild" set "skipMsbuild=y" if "%1"=="--Debug" set "buildMode=Debug" if "%1"=="--Release" set "buildMode=Release" if "%1"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" if "%2"=="" goto noargs -if "%2"=="--Debug" set "buildMode=Debug" -if "%2"=="--Release" set "buildMode=Release" -if "%2"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" +if "%2"=="--Debug" set "buildMode=Debug" +if "%2"=="--Release" set "buildMode=Release" +if "%2"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" +if "%2"=="--skip-msbuild" set "skipMsbuild=y" + +if NOT "%3"=="" ( + if "%3"=="--skip-msbuild" set "skipMsbuild=y" + if "%3"=="--no-full-poly-car" set "noFullPolyCar=y" + if "%3"=="--Debug" set "buildMode=Debug" + if "%3"=="--Release" set "buildMode=Release" + if "%3"=="--RelWithDebInfo" set "buildMode=RelWithDebInfo" +) :noargs @@ -62,11 +73,19 @@ if ERRORLEVEL 1 ( ) ) -REM //---------- get rpclib ---------- -IF NOT EXIST external\rpclib mkdir external\rpclib - -set RPC_VERSION_FOLDER=rpclib-2.3.0 -IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% ( +REM //---------- get rpclib ---------- +IF NOT EXIST external\rpclib mkdir external\rpclib + +set RPC_VERSION_FOLDER=rpclib-2.3.0 + +REM If rpclib deps already pre-seeded, skip download/build/copy for the requested configuration +IF "%buildMode%"=="Debug" ( + IF EXIST AirLib\deps\rpclib\include\rpc\client.h IF EXIST AirLib\deps\rpclib\lib\x64\Debug\rpc.lib GOTO skip_rpclib_all +) ELSE ( + IF EXIST AirLib\deps\rpclib\include\rpc\client.h IF EXIST AirLib\deps\rpclib\lib\x64\Release\rpc.lib GOTO skip_rpclib_all +) + +IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% ( REM //leave some blank lines because %powershell% shows download banner at top of console ECHO( ECHO( @@ -95,40 +114,70 @@ IF NOT EXIST external\rpclib\%RPC_VERSION_FOLDER% ( ) ) -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 -cmake -G"Visual Studio 17 2022" .. - -if "%buildMode%" == "" ( -cmake --build . -cmake --build . --config Release -) else ( -cmake --build . --config %buildMode% -) - -if ERRORLEVEL 1 goto :buildfailed -chdir /d %ROOT_DIR% - -REM //---------- copy rpclib binaries and include folder inside AirLib folder ---------- -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 -) else ( -robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode% -) +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 +cmake -G"Visual Studio 17 2022" -A x64 -T v143 .. +if ERRORLEVEL 1 goto :cmake_fallback_nmake + +if "%buildMode%" == "" ( + cmake --build . -- /p:TrackFileAccess=false + cmake --build . --config Release -- /p:TrackFileAccess=false +) else ( + cmake --build . --config %buildMode% -- /p:TrackFileAccess=false +) +if ERRORLEVEL 1 goto :buildfailed +goto :after_rpclib_build + +:cmake_fallback_nmake +ECHO CMake VS generator failed. Falling back to NMake Makefiles... +cd .. +rmdir /S /Q build +mkdir build +cd build +cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=%buildMode% -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl .. +if ERRORLEVEL 1 goto :buildfailed +nmake +if ERRORLEVEL 1 goto :buildfailed + +:after_rpclib_build +chdir /d %ROOT_DIR% + +REM //---------- copy rpclib binaries and include folder inside AirLib folder ---------- +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 +) else ( + if EXIST external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% ( + robocopy /MIR external\rpclib\%RPC_VERSION_FOLDER%\build\%buildMode% %RPCLIB_TARGET_LIB%\%buildMode% + ) else ( + rem Single-config (NMake) output: copy rpc.lib into expected folder + if "%buildMode%"=="Debug" ( + if EXIST external\rpclib\%RPC_VERSION_FOLDER%\build\rpc.lib copy /y external\rpclib\%RPC_VERSION_FOLDER%\build\rpc.lib %RPCLIB_TARGET_LIB%\Debug\rpc.lib + ) else ( + if EXIST external\rpclib\%RPC_VERSION_FOLDER%\build\rpc.lib copy /y external\rpclib\%RPC_VERSION_FOLDER%\build\rpc.lib %RPCLIB_TARGET_LIB%\Release\rpc.lib + ) + ) +) + +GOTO after_rpclib + +:skip_rpclib_all +ECHO Using pre-seeded rpclib includes and libs. Skipping rpclib download/build/copy. + +:after_rpclib REM //---------- get 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 ( +IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( + IF NOT DEFINED noFullPolyCar ( REM //leave some blank lines because %powershell% shows download banner at top of console ECHO( ECHO( @@ -156,10 +205,10 @@ IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV\v1.2.0 ( REM //Don't fail the build if the high-poly car is unable to be downloaded REM //Instead, just notify users that the gokart will be used. IF NOT EXIST Unreal\Plugins\AirSim\Content\VehicleAdv\SUV ECHO Unable to download high-polycount SUV. Your AirSim build will use the default vehicle. - ) else ( - ECHO Not downloading high-poly car asset. The default unreal vehicle will be used. - ) -) + ) else ( + ECHO Not downloading high-poly car asset. The default unreal vehicle will be used. + ) +) REM //---------- get Eigen library ---------- IF NOT EXIST AirLib\deps mkdir AirLib\deps @@ -180,16 +229,24 @@ IF NOT EXIST AirLib\deps\eigen3 ( IF NOT EXIST AirLib\deps\eigen3 goto :buildfailed -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 -) else ( -msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=%buildMode% AirSim.sln -if ERRORLEVEL 1 goto :buildfailed -) +REM //---------- now we have all dependencies to compile AirSim.sln which will also compile MavLinkCom ---------- +IF DEFINED skipMsbuild GOTO after_msbuild +if /I "%buildMode%"=="Debug" ( + rem Build only core libraries for Debug to avoid runtime mismatch in sample apps + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug /p:TrackFileAccess=false AirLib\AirLib.vcxproj + if ERRORLEVEL 1 goto :buildfailed + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug /p:TrackFileAccess=false MavLinkCom\MavLinkCom.vcxproj + if ERRORLEVEL 1 goto :buildfailed +) else if "%buildMode%" == "" ( + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug /p:TrackFileAccess=false AirSim.sln + if ERRORLEVEL 1 goto :buildfailed + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Release /p:TrackFileAccess=false AirSim.sln + if ERRORLEVEL 1 goto :buildfailed +) else ( + msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=%buildMode% /p:TrackFileAccess=false AirSim.sln + if ERRORLEVEL 1 goto :buildfailed +) +:after_msbuild REM //---------- copy binaries and include for MavLinkCom in deps ---------- set MAVLINK_TARGET_LIB=AirLib\deps\MavLinkCom\lib diff --git a/scripts/build_blocks.ps1 b/scripts/build_blocks.ps1 new file mode 100644 index 0000000000..96ac6d0a84 --- /dev/null +++ b/scripts/build_blocks.ps1 @@ -0,0 +1,28 @@ +param( + [string]$EngineRoot = 'D:\UE_5.3', + [string]$Config = 'Development', + [string]$Platform = 'Win64' +) + +$ErrorActionPreference = 'Stop' + +# Resolve project path relative to repo root +$repoRoot = Split-Path -Parent $PSScriptRoot +$uproject = Join-Path $repoRoot 'Unreal/Environments/Blocks/Blocks.uproject' +$uprojectPath = Resolve-Path $uproject + +Write-Host "Using EngineRoot: $EngineRoot" +Write-Host "Project: $uprojectPath" +Write-Host "Building Target: BlocksEditor $Platform $Config" + +$buildBat = Join-Path $EngineRoot 'Engine/Build/BatchFiles/Build.bat' +if (!(Test-Path $buildBat)) { + throw "Build.bat not found at $buildBat" +} + +& $buildBat 'BlocksEditor' $Platform $Config $uprojectPath '-WaitMutex' '-FromMsBuild' +if ($LASTEXITCODE -ne 0) { + throw "Build failed with exit code $LASTEXITCODE" +} + +Write-Host 'Build succeeded.' diff --git a/scripts/build_mavlinkcom.ps1 b/scripts/build_mavlinkcom.ps1 new file mode 100644 index 0000000000..6700c2621e --- /dev/null +++ b/scripts/build_mavlinkcom.ps1 @@ -0,0 +1,84 @@ +param( + [ValidateSet('Debug','Release')][string]$Configuration = 'Release', + [ValidateSet('x64','Win32')][string]$Platform = 'x64', + [string]$Toolset = 'v143', # PlatformToolset override (optional) + [string]$WindowsSDK = '', # e.g. 10.0.22621.0 (optional) + [string]$VSInstallPath = '', # VS root (optional) + [switch]$Rebuild, + [switch]$DisableTracker = $true, # helps avoid TRK0002 + [switch]$CopyToAirSim = $true # copy lib into AirSim deps after build +) + +$ErrorActionPreference = 'Stop' + +function Find-VSInstallPath { + param([string]$Preferred) + + if ($Preferred -and (Test-Path $Preferred)) { return (Resolve-Path $Preferred).Path } + + $vswhere = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' + if (Test-Path $vswhere) { + $path = & $vswhere -latest -requires Microsoft.Component.MSBuild -property installationPath 2>$null + if ($LASTEXITCODE -eq 0 -and $path) { return $path.Trim() } + } + + $candidates = @( + 'C:\Program Files\Microsoft Visual Studio\2022\Community', + 'C:\Program Files\Microsoft Visual Studio\2022\Professional', + 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise', + 'D:\VS2022\Community' + ) + foreach ($c in $candidates) { if (Test-Path $c) { return $c } } + throw 'Could not locate a Visual Studio 2022 installation. Set -VSInstallPath to override.' +} + +function Get-MSBuildPath { + param([string]$VSRoot) + $paths = @( + (Join-Path $VSRoot 'MSBuild\Current\Bin\MSBuild.exe'), + (Join-Path $VSRoot 'MSBuild\Current\Bin\amd64\MSBuild.exe') + ) + foreach ($p in $paths) { if (Test-Path $p) { return $p } } + throw "MSBuild.exe not found under '$VSRoot'" +} + +Write-Host "=== MavLinkCom build ===" -ForegroundColor Cyan +$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +$sln = Resolve-Path (Join-Path $repoRoot 'MavLinkCom\MavLinkCom.sln') +Write-Host "Repo root: $repoRoot" +Write-Host "Solution: $sln" + +$vsRoot = Find-VSInstallPath -Preferred $VSInstallPath +$msbuild = Get-MSBuildPath -VSRoot $vsRoot +Write-Host "VS Root: $vsRoot" +Write-Host "MSBuild: $msbuild" + +$props = @( + "/p:Configuration=$Configuration", + "/p:Platform=$Platform", + "/p:PlatformToolset=$Toolset" +) +if ($WindowsSDK) { $props += "/p:WindowsTargetPlatformVersion=$WindowsSDK" } +if ($DisableTracker) { $props += "/p:TrackFileAccess=false"; $props += "/p:UseMultiToolTask=false" } + +$targets = if ($Rebuild) { '/t:Rebuild' } else { '/t:Build' } +$log = Join-Path $repoRoot 'MavLinkCom\build_mavlinkcom.binlog' + +Write-Host "Building MavLinkCom ($Configuration|$Platform) ..." +& $msbuild $sln $targets '/m' '/nologo' '/v:m' "/bl:$log" @props +if ($LASTEXITCODE -ne 0) { throw "MSBuild failed with exit code $LASTEXITCODE. See $log" } + +# Verify output and optionally copy into AirSim plugin deps +$platDir = if ($Platform -eq 'x64') { 'x64' } else { 'x86' } +$outLib = Join-Path $repoRoot "MavLinkCom\lib\$platDir\$Configuration\MavLinkCom.lib" +if (!(Test-Path $outLib)) { throw "Expected output not found: $outLib" } +Write-Host "Built: $outLib" -ForegroundColor Green + +if ($CopyToAirSim) { + $dest = Join-Path $repoRoot "Unreal\Environments\Blocks\Plugins\AirSim\Source\AirLib\deps\MavLinkCom\lib\$platDir\$Configuration" + New-Item -Force -ItemType Directory -Path $dest | Out-Null + Copy-Item -Force $outLib $dest + Write-Host "Copied to: $dest" -ForegroundColor Green +} + +Write-Host "Done." -ForegroundColor Cyan diff --git a/scripts/check_suv_assets.ps1 b/scripts/check_suv_assets.ps1 new file mode 100644 index 0000000000..481a98e4fc --- /dev/null +++ b/scripts/check_suv_assets.ps1 @@ -0,0 +1,66 @@ +param( + [string]$PluginContent = 'Unreal/Plugins/AirSim/Content/VehicleAdv', + [switch]$WriteSettings, + [string]$SettingsPath = "$env:USERPROFILE/Documents/AirSim/settings.json" +) + +$ErrorActionPreference = 'Stop' + +function Test-PathSafe([string]$p){ try { Test-Path $p } catch { $false } } + +Write-Host '--- AirSim SUV assets check ---' -ForegroundColor Cyan +$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +$contentRoot = Join-Path $root $PluginContent +$suvDir = Join-Path $contentRoot 'SUV' + +Write-Host "PluginContent: $contentRoot" + +$ok = $true +if (!(Test-PathSafe $suvDir)){ + Write-Warning "SUV content directory missing: $suvDir" + $ok = $false +} else { + $uassets = Get-ChildItem -Recurse -Filter *.uasset -ErrorAction SilentlyContinue $suvDir | Select-Object -First 1 + if (-not $uassets){ + Write-Warning "SUV directory exists but contains no .uasset files: $suvDir" + $ok = $false + } else { + Write-Host "SUV assets found under: $suvDir" -ForegroundColor Green + } +} + +# Heuristics for slippery/non-slippery materials +$slippery = Get-ChildItem -Recurse -Filter *Slippery*.uasset -ErrorAction SilentlyContinue $contentRoot | Select-Object -First 1 +$nonslip = Get-ChildItem -Recurse -Filter *NonSlippery*.uasset -ErrorAction SilentlyContinue $contentRoot | Select-Object -First 1 +if (-not $slippery){ Write-Warning 'Slippery physics material not found (search *Slippery*.uasset)'; $ok=$false } else { Write-Host "Slippery material: $($slippery.FullName)" } +if (-not $nonslip){ Write-Warning 'NonSlippery physics material not found (search *NonSlippery*.uasset)'; $ok=$false } else { Write-Host "NonSlippery material: $($nonslip.FullName)" } + +if (-not $ok){ + Write-Host '' + Write-Host 'Hint: Download high-poly SUV assets (car_assets.zip) from AirSim releases and extract to:' -ForegroundColor Yellow + Write-Host " $suvDir" -ForegroundColor Yellow + Write-Host 'Reference: setup.sh (downloadHighPolySuv) in repo.' -ForegroundColor Yellow +} + +if ($WriteSettings){ + $settings = @{ + SettingsVersion = 1 + SimMode = 'Car' + PawnPaths = @{ + DefaultCar = @{ + # Use Unreal Editor: right-click asset -> Copy Reference, then paste below + slippery_mat = '/AirSim/VehicleAdv/Vehicle/Materials/Slippery.Slippery' + non_slippery_mat= '/AirSim/VehicleAdv/Vehicle/Materials/NonSlippery.NonSlippery' + } + } + Vehicles = @{ Car1 = @{ VehicleType = 'PhysXCar'; AutoCreate = $true } } + } | ConvertTo-Json -Depth 6 + + $dst = (Resolve-Path (Split-Path -Parent $SettingsPath) -ErrorAction SilentlyContinue) + if (-not $dst){ New-Item -ItemType Directory -Force (Split-Path -Parent $SettingsPath) | Out-Null } + Set-Content -Path $SettingsPath -Value $settings -Encoding UTF8 + Write-Host "Wrote settings to: $SettingsPath" -ForegroundColor Green + Write-Host 'Note: Update slippery_mat/non_slippery_mat to match your asset references.' -ForegroundColor Yellow +} + +if ($ok){ Write-Host 'SUV assets check passed.' -ForegroundColor Green } else { Write-Host 'SUV assets check incomplete.' -ForegroundColor Yellow } diff --git a/scripts/download_suv_assets.ps1 b/scripts/download_suv_assets.ps1 new file mode 100644 index 0000000000..7d275e8e9c --- /dev/null +++ b/scripts/download_suv_assets.ps1 @@ -0,0 +1,59 @@ +param( + [string]$Version = 'v1.2.0', + [string]$DestRel = 'Unreal/Plugins/AirSim/Content/VehicleAdv', + [switch]$Force +) + +$ErrorActionPreference = 'Stop' + +function Ensure-Tls12 { + try { + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + } catch {} +} + +function New-TempDir([string]$Prefix='suv_download_tmp'){ + $base = Join-Path -Path (Get-Location) -ChildPath $Prefix + if (Test-Path $base) { Remove-Item -Recurse -Force $base } + New-Item -ItemType Directory -Force -Path $base | Out-Null + return (Resolve-Path $base).Path +} + +Write-Host '--- Downloading AirSim SUV assets ---' -ForegroundColor Cyan +$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +$dest = Join-Path $repoRoot $DestRel +$suvDir = Join-Path $dest 'SUV' +$url = "https://github.com/Microsoft/AirSim/releases/download/$Version/car_assets.zip" + +Write-Host "Repo root: $repoRoot" +Write-Host "Destination: $dest" +Write-Host "URL: $url" + +if ((Test-Path $suvDir) -and -not $Force){ + Write-Host "SUV folder already exists: $suvDir (use -Force to overwrite)" -ForegroundColor Yellow + Write-Host 'Skipping download.' + exit 0 +} + +Ensure-Tls12 +$tmp = New-TempDir +$zip = Join-Path $tmp 'car_assets.zip' + +Write-Host 'Downloading...' -ForegroundColor Cyan +Invoke-WebRequest -Uri $url -OutFile $zip -UseBasicParsing + +Write-Host 'Extracting...' -ForegroundColor Cyan +if (-not (Test-Path $dest)) { New-Item -ItemType Directory -Force -Path $dest | Out-Null } +if (Test-Path $suvDir) { Remove-Item -Recurse -Force $suvDir } +Expand-Archive -Path $zip -DestinationPath $dest -Force + +Remove-Item -Recurse -Force $tmp + +if (Test-Path $suvDir){ + Write-Host "Done. Extracted to: $suvDir" -ForegroundColor Green + exit 0 +} else { + Write-Host 'Extraction finished but SUV folder not found. Please verify manually.' -ForegroundColor Yellow + exit 1 +} + diff --git a/tools/build_debug_airsim.bat b/tools/build_debug_airsim.bat new file mode 100644 index 0000000000..4b83a56257 --- /dev/null +++ b/tools/build_debug_airsim.bat @@ -0,0 +1,13 @@ +@echo off +setlocal +REM Initialize VS 2022 developer environment (x64) +call "D:\VS2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 +if ERRORLEVEL 1 ( + echo Failed to initialize VS DevCmd. >&2 + exit /b 1 +) + +cd /d E:\Project\AI\python\project\AirSimMy +call build.cmd --Debug --no-full-poly-car +exit /b %ERRORLEVEL% + diff --git a/tools/build_debug_samples.bat b/tools/build_debug_samples.bat new file mode 100644 index 0000000000..57e566ae8c --- /dev/null +++ b/tools/build_debug_samples.bat @@ -0,0 +1,25 @@ +@echo off +setlocal +call "D:\VS2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 +if ERRORLEVEL 1 ( + echo Failed to initialize VS DevCmd. >&2 + exit /b 1 +) +cd /d E:\Project\AI\python\project\AirSimMy + +set MSB=msbuild -maxcpucount:12 /p:Platform=x64 /p:Configuration=Debug /p:TrackFileAccess=false + +%MSB% HelloDrone\HelloDrone.vcxproj || goto :fail +%MSB% HelloCar\HelloCar.vcxproj || goto :fail +%MSB% DroneServer\DroneServer.vcxproj || goto :fail +%MSB% DroneShell\DroneShell.vcxproj || goto :fail +%MSB% Examples\Examples.vcxproj || goto :fail +%MSB% HelloSpawnedDrones\HelloSpawnedDrones.vcxproj || goto :fail + +echo All Debug sample projects built successfully. +exit /b 0 + +:fail +echo Sample Debug build failed. See errors above. +exit /b 1 + diff --git a/tools/build_release_airsim.bat b/tools/build_release_airsim.bat new file mode 100644 index 0000000000..4cf09bd362 --- /dev/null +++ b/tools/build_release_airsim.bat @@ -0,0 +1,13 @@ +@echo off +setlocal +REM Initialize VS 2022 developer environment (x64) +call "D:\VS2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 +if ERRORLEVEL 1 ( + echo Failed to initialize VS DevCmd. >&2 + exit /b 1 +) + +cd /d E:\Project\AI\python\project\AirSimMy +call build.cmd --Release --no-full-poly-car +exit /b %ERRORLEVEL% + diff --git a/tools/build_release_skip_msbuild.bat b/tools/build_release_skip_msbuild.bat new file mode 100644 index 0000000000..5245aa4f1a --- /dev/null +++ b/tools/build_release_skip_msbuild.bat @@ -0,0 +1,11 @@ +@echo off +setlocal +call "D:\VS2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 +if ERRORLEVEL 1 ( + echo Failed to initialize VS DevCmd. >&2 + exit /b 1 +) +cd /d E:\Project\AI\python\project\AirSimMy +call build.cmd --Release --no-full-poly-car --skip-msbuild +exit /b %ERRORLEVEL% +