Skip to content

Commit

Permalink
fix compile error, add reset
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Sep 28, 2017
1 parent ac311da commit 0a78c78
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 14 deletions.
11 changes: 10 additions & 1 deletion AirLib/src/common/common_utils/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@

#include "common/common_utils/FileSystem.hpp"

#include "common/common_utils/FileSystem.hpp"
#include "common/common_utils/Utils.hpp"
#include <codecvt>
#include <fstream>
#include <cstdio>
#include <string>

#if defined _WIN32 || defined _WIN64
#include "common/common_utils/MinWinDefines.hpp"

#undef NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
#undef NOCTLMGR // Control and Dialog routines
#undef NOGDI // All GDI #undefs and routines
#undef NOKERNEL // All KERNEL #undefs and routines
#undef NOUSER // All USER #undefs and routines
#undef NOMSG // typedef MSG and associated routines

#include <Shlobj.h>
#include <direct.h>
#include <stdlib.h>
#include <direct.h>

#else
#include <unistd.h>
#include <sys/param.h> // MAXPATHLEN definition
Expand Down
2 changes: 1 addition & 1 deletion Unreal/Environments/Blocks/Blocks.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "{1D3B760A-2107-0115-0013-02AF1DCEC6C8}",
"EngineAssociation": "4.16",
"Category": "",
"Description": "",
"Modules": [
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <exception>
#include "common/common_utils/Utils.hpp"
#include "Components/StaticMeshComponent.h"
#include "Engine/Engine.h"

/*
//TODO: change naming conventions to same as other files?
Expand Down
6 changes: 3 additions & 3 deletions Unreal/Plugins/AirSim/Source/AirSimGameMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "SimHUD/SimHUD.h"
#include "common/Common.hpp"
#include "AirBlueprintLib.h"
#include "GameFramework/GameUserSettings.h"
#include "controllers/Settings.hpp"


Expand Down Expand Up @@ -69,7 +68,8 @@ void AAirSimGameMode::StartPlay()
{
Super::StartPlay();

UGameUserSettings* game_settings = GetGameUserSettings();
game_settings->SetFullscreenMode(EWindowMode::Fullscreen);
//UGameUserSettings* game_settings = GetGameUserSettings();
//game_settings->SetFullscreenMode(EWindowMode::WindowedFullscreen);
//game_settings->ApplySettings(true);
}

1 change: 1 addition & 0 deletions Unreal/Plugins/AirSim/Source/AirSimGameMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "GameFramework/GameUserSettings.h"
#include "AirSimGameMode.generated.h"

/**
Expand Down
16 changes: 16 additions & 0 deletions Unreal/Plugins/AirSim/Source/Car/SimModeCar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,21 @@ void ASimModeCar::createVehicles(std::vector<VehiclePtr>& vehicles)
setupVehiclesAndCamera(vehicles);
}

void ASimModeCar::reset()
{
//find all vehicle pawns
{
TArray<AActor*> pawns;
UAirBlueprintLib::FindAllActor<TVehiclePawn>(this, pawns);

//set up vehicle pawns
for (AActor* pawn : pawns)
{
//initialize each vehicle pawn we found
TVehiclePawn* vehicle_pawn = static_cast<TVehiclePawn*>(pawn);
vehicle_pawn->getVehiclePawnWrapper()->reset();
}
}

Super::reset();
}
1 change: 1 addition & 0 deletions Unreal/Plugins/AirSim/Source/Car/SimModeCar.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AIRSIM_API ASimModeCar : public ASimModeBase
virtual VehiclePawnWrapper* getFpvVehiclePawnWrapper() override;

void createVehicles(std::vector<VehiclePtr>& vehicles);
virtual void reset() override;

private:
void setupVehiclesAndCamera(std::vector<VehiclePtr>& vehicles);
Expand Down
2 changes: 2 additions & 0 deletions Unreal/Plugins/AirSim/Source/SimMode/SimModeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ std::string ASimModeBase::getReport()
void ASimModeBase::setupInputBindings()
{
UAirBlueprintLib::EnableInput(this);

UAirBlueprintLib::BindActionToKey("InputEventResetAll", EKeys::BackSpace, this, &ASimModeBase::reset);
}

bool ASimModeBase::isRecording()
Expand Down
6 changes: 0 additions & 6 deletions Unreal/Plugins/AirSim/Source/SimMode/SimModeWorldBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,3 @@ void ASimModeWorldBase::createVehicles(std::vector<VehiclePtr>& vehicles)
//Unreal doesn't allow pure abstract methods in actors
}

void ASimModeWorldBase::setupInputBindings()
{
Super::setupInputBindings();

UAirBlueprintLib::BindActionToKey("InputEventResetAll", EKeys::BackSpace, this, &ASimModeWorldBase::reset);
}
1 change: 0 additions & 1 deletion Unreal/Plugins/AirSim/Source/SimMode/SimModeWorldBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class AIRSIM_API ASimModeWorldBase : public ASimModeBase

virtual void reset() override;
virtual std::string getReport() override;
virtual void setupInputBindings() override;

protected:
typedef std::shared_ptr<VehicleConnectorBase> VehiclePtr;
Expand Down
1 change: 1 addition & 0 deletions docs/image_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ To active this mode, edit [settings.json](settings.json) that you can find in yo

```
{
"SettingdVersion": 1.0,
"UsageScenario": "ComputerVision"
}
```
Expand Down
1 change: 1 addition & 0 deletions docs/px4_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For this you will need one of the supported device listed above. For manual flig
8. In [AirSim settings](settings.md) file, specify PX4 for your vehicle config like this:
```
{
"SettingdVersion": 1.0,
"DefaultVehicleConfig": "Pixhawk"
}
```
Expand Down
3 changes: 1 addition & 2 deletions docs/using_car.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ By default vehicle type used in AirSim is multirotor. If you want to use car ins
Now when you restart AirSim, you should see the car spawned automatically.

## Manual Driving

Please use the keyboard arrow keys to drive manually. Spacebar for the handgreak. In manual drive mode, gears are set in "auto".
Please use the keyboard arrow keys to drive manually. Spacebar for the handbreak. In manual drive mode, gears are set in "auto".

## Using APIs
You can control the car, get state and images by calling APIs in variety of client languages including C++ and Python. Please see [APIs doc](apis.md) for more details.
Expand Down

0 comments on commit 0a78c78

Please sign in to comment.