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/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/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 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/Blocks.uproject b/Unreal/Environments/Blocks/Blocks.uproject index 6d803f0f0c..fa31cae13d 100644 --- a/Unreal/Environments/Blocks/Blocks.uproject +++ b/Unreal/Environments/Blocks/Blocks.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.3", + "EngineAssociation": "5.4", "Category": "", "Description": "", "Modules": [ diff --git a/Unreal/Environments/Blocks/Config/DefaultEngine.ini b/Unreal/Environments/Blocks/Config/DefaultEngine.ini index bb71e75c2c..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] @@ -71,7 +71,7 @@ PhysXTreeRebuildRate=10 [/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings] bEnablePlugin=True bAllowNetworkConnection=True -SecurityToken=811F8F1C4E41692A119A55BE04E6DB61 +SecurityToken=E4EBEAA64CDE3B39980008BE0CBB1C01 bIncludeInShipping=False bAllowExternalStartInShipping=False bCompileAFSProject=False diff --git a/Unreal/Environments/Blocks/Config/DefaultInput.ini b/Unreal/Environments/Blocks/Config/DefaultInput.ini index c68d330fdd..214b9ff8c5 100644 --- a/Unreal/Environments/Blocks/Config/DefaultInput.ini +++ b/Unreal/Environments/Blocks/Config/DefaultInput.ini @@ -83,4 +83,3 @@ DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks -ConsoleKeys=Tilde +ConsoleKeys=Tilde - diff --git a/Unreal/Environments/Blocks/Source/Blocks.Target.cs b/Unreal/Environments/Blocks/Source/Blocks.Target.cs index 2a0f084779..f4e33166dc 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" }); DefaultBuildSettings = BuildSettingsVersion.V4; //bUseUnityBuild = false; diff --git a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs index a6e65043ae..e603d09fa3 100644 --- a/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs +++ b/Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs @@ -7,9 +7,13 @@ public class BlocksEditorTarget : TargetRules { public BlocksEditorTarget(TargetInfo Target) : base(Target) { - Type = TargetType.Editor; + DefaultBuildSettings = BuildSettingsVersion.V5; + Type = TargetType.Editor; ExtraModuleNames.AddRange(new string[] { "Blocks" }); +<<<<<<< HEAD DefaultBuildSettings = BuildSettingsVersion.V4; +======= +>>>>>>> f5f6cc1d17237900be5e04cfe99ceb9293f1b14b //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 d05e4ef193..bf8771b881 100644 Binary files a/Unreal/Plugins/AirSim/Content/Blueprints/BP_CameraDirector.uasset and b/Unreal/Plugins/AirSim/Content/Blueprints/BP_CameraDirector.uasset differ diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.h index 53df307c7f..afdbb74d89 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 (IsValid(Actor) && (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); } } diff --git a/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp b/Unreal/Plugins/AirSim/Source/CameraManager.cpp similarity index 87% rename from Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp rename to Unreal/Plugins/AirSim/Source/CameraManager.cpp index 9cc9626692..74f68a2fa4 100644 --- a/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.cpp +++ b/Unreal/Plugins/AirSim/Source/CameraManager.cpp @@ -1,8 +1,8 @@ -#include "AirSimCameraDirector.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/AirSimCameraDirector.h b/Unreal/Plugins/AirSim/Source/CameraManager.h similarity index 96% rename from Unreal/Plugins/AirSim/Source/AirSimCameraDirector.h rename to Unreal/Plugins/AirSim/Source/CameraManager.h index 6440e0f9de..0e6031f945 100644 --- a/Unreal/Plugins/AirSim/Source/AirSimCameraDirector.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 "AirSimCameraDirector.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 3e3e972bb1..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 "AirSimCameraDirector.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 be836905c2..52ed3b829b 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 = !IsValid(actor); + result = actor->IsPendingKillPending(); } if (result) simmode_->scene_object_map.Remove(FString(object_name.c_str())); @@ -1047,6 +1047,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()); @@ -1055,16 +1056,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 ce7e12647d..65235e2aed 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" 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