Skip to content

Commit

Permalink
numpy example, docs update PythonClient->AirSimClient rename, reset API
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Oct 4, 2017
1 parent 9935ae5 commit 3f92d09
Show file tree
Hide file tree
Showing 26 changed files with 944 additions and 605 deletions.
2 changes: 1 addition & 1 deletion AirLib/AirLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<ClInclude Include="include\common\VectorMath.hpp" />
<ClInclude Include="include\common\common_utils\AsyncTasker.hpp" />
<ClInclude Include="include\controllers\VehicleCameraBase.hpp" />
<ClInclude Include="include\vehicles\car\controllers\CarControllerBase.hpp" />
<ClInclude Include="include\vehicles\car\api\CarApiBase.hpp" />
<ClInclude Include="include\vehicles\multirotor\api\MultirotorRpcLibAdapators.hpp" />
<ClInclude Include="include\vehicles\multirotor\api\MultirotorRpcLibClient.hpp" />
<ClInclude Include="include\vehicles\multirotor\api\MultirotorRpcLibServer.hpp" />
Expand Down
5 changes: 1 addition & 4 deletions AirLib/AirLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
<ClInclude Include="include\api\RpcLibAdapatorsBase.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\vehicles\car\controllers\CarControllerBase.hpp">
<ClInclude Include="include\vehicles\car\api\CarApiBase.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
Expand All @@ -473,9 +473,6 @@
<ClCompile Include="src\vehicles\car\api\CarRpcLibServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicles\multirotor\controllers\DroneControllerBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vehicles\multirotor\api\MultirotorRpcLibClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#ifndef air_CarControllerBase_hpp
#define air_CarControllerBase_hpp
#ifndef air_CarApiBase_hpp
#define air_CarApiBase_hpp

#include "controllers/VehicleCameraBase.hpp"
#include "common/VectorMath.hpp"
#include "common/CommonStructs.hpp"

namespace msr { namespace airlib {

class CarControllerBase {
class CarApiBase {
public:
struct CarControls {
float throttle = 0; /* 1 to -1 */
Expand Down Expand Up @@ -67,8 +67,9 @@ class CarControllerBase {
virtual GeoPoint getHomeGeoPoint() = 0;
virtual void enableApiControl(bool is_enabled) = 0;
virtual bool isApiControlEnabled() = 0;
virtual void reset() = 0;

virtual ~CarControllerBase() = default;
virtual ~CarApiBase() = default;
};


Expand Down
14 changes: 7 additions & 7 deletions AirLib/include/vehicles/car/api/CarRpcLibAdapators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "common/CommonStructs.hpp"
#include "api/RpcLibAdapatorsBase.hpp"
#include "controllers/VehicleCameraBase.hpp"
#include "vehicles/car/controllers/CarControllerBase.hpp"
#include "vehicles/car/api/CarApiBase.hpp"
#include "rpc/msgpack.hpp"


Expand All @@ -30,7 +30,7 @@ class CarRpcLibAdapators : public RpcLibAdapatorsBase {
CarControls()
{}

CarControls(const msr::airlib::CarControllerBase::CarControls& s)
CarControls(const msr::airlib::CarApiBase::CarControls& s)
{
throttle = s.throttle;
steering = s.steering;
Expand All @@ -40,9 +40,9 @@ class CarRpcLibAdapators : public RpcLibAdapatorsBase {
manual_gear = s.manual_gear;
gear_immediate = s.gear_immediate;
}
msr::airlib::CarControllerBase::CarControls to() const
msr::airlib::CarApiBase::CarControls to() const
{
return msr::airlib::CarControllerBase::CarControls(throttle, steering, brake, handbrake,
return msr::airlib::CarApiBase::CarControls(throttle, steering, brake, handbrake,
is_manual_gear, manual_gear, gear_immediate);
}
};
Expand All @@ -59,17 +59,17 @@ class CarRpcLibAdapators : public RpcLibAdapatorsBase {
CarState()
{}

CarState(const msr::airlib::CarControllerBase::CarState& s)
CarState(const msr::airlib::CarApiBase::CarState& s)
{
speed = s.speed;
gear = s.gear;
position = s.position;
velocity = s.velocity;
orientation = s.orientation;
}
msr::airlib::CarControllerBase::CarState to() const
msr::airlib::CarApiBase::CarState to() const
{
return msr::airlib::CarControllerBase::CarState(
return msr::airlib::CarApiBase::CarState(
speed, gear, position.to(), velocity.to(), orientation.to());
}
};
Expand Down
6 changes: 3 additions & 3 deletions AirLib/include/vehicles/car/api/CarRpcLibClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "common/Common.hpp"
#include <functional>
#include "common/CommonStructs.hpp"
#include "vehicles/car/controllers/CarControllerBase.hpp"
#include "vehicles/car/api/CarApiBase.hpp"
#include "controllers/VehicleCameraBase.hpp"


Expand All @@ -25,8 +25,8 @@ class CarRpcLibClient {

vector<VehicleCameraBase::ImageResponse> simGetImages(vector<VehicleCameraBase::ImageRequest> request);
vector<uint8_t> simGetImage(int camera_id, VehicleCameraBase::ImageType type);
void setCarControls(const CarControllerBase::CarControls& controls);
CarControllerBase::CarState getCarState();
void setCarControls(const CarApiBase::CarControls& controls);
CarApiBase::CarState getCarState();
msr::airlib::GeoPoint getHomeGeoPoint();

void confirmConnection();
Expand Down
6 changes: 3 additions & 3 deletions AirLib/include/vehicles/car/api/CarRpcLibServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
#include "common/Common.hpp"
#include <functional>
#include "api/ControlServerBase.hpp"
#include "vehicles/car/controllers/CarControllerBase.hpp"
#include "vehicles/car/api/CarApiBase.hpp"

namespace msr { namespace airlib {

class CarRpcLibServer : public ControlServerBase {
public:
CarRpcLibServer(CarControllerBase* vehicle, string server_address, uint16_t port = 42451);
CarRpcLibServer(CarApiBase* vehicle, string server_address, uint16_t port = 42451);
virtual void start(bool block = false) override;
virtual void stop() override;
virtual ~CarRpcLibServer() override;
private:
CarControllerBase* vehicle_;
CarApiBase* vehicle_;
struct impl;
std::unique_ptr<impl> pimpl_;
};
Expand Down
4 changes: 2 additions & 2 deletions AirLib/src/vehicles/car/api/CarRpcLibClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ vector<uint8_t> CarRpcLibClient::simGetImage(int camera_id, VehicleCameraBase::I
return result;
}

void CarRpcLibClient::setCarControls(const CarControllerBase::CarControls& controls)
void CarRpcLibClient::setCarControls(const CarApiBase::CarControls& controls)
{
pimpl_->client.call("setCarControls", CarRpcLibAdapators::CarControls(controls));
}

CarControllerBase::CarState CarRpcLibClient::getCarState()
CarApiBase::CarState CarRpcLibClient::getCarState()
{
return pimpl_->client.call("getCarState").as<CarRpcLibAdapators::CarState>().to();

Expand Down
2 changes: 1 addition & 1 deletion AirLib/src/vehicles/car/api/CarRpcLibServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct CarRpcLibServer::impl {

typedef msr::airlib_rpclib::CarRpcLibAdapators CarRpcLibAdapators;

CarRpcLibServer::CarRpcLibServer(CarControllerBase* vehicle, string server_address, uint16_t port)
CarRpcLibServer::CarRpcLibServer(CarApiBase* vehicle, string server_address, uint16_t port)
: vehicle_(vehicle)
{
if (server_address == "")
Expand Down
106 changes: 8 additions & 98 deletions AirSim.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unreal", "Unreal", "{04B515C0-07BC-4CE8-8A16-F0D70E86C7C9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{A3E13CC1-566C-46BD-B46C-45FC31CF12CF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AirSim", "AirSim", "{6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC}"
ProjectSection(SolutionItems) = preProject
Unreal\Plugins\AirSim\Source\AirBlueprintLib.cpp = Unreal\Plugins\AirSim\Source\AirBlueprintLib.cpp
Unreal\Plugins\AirSim\Source\AirBlueprintLib.h = Unreal\Plugins\AirSim\Source\AirBlueprintLib.h
Unreal\Plugins\AirSim\Source\AirSim.Build.cs = Unreal\Plugins\AirSim\Source\AirSim.Build.cs
Unreal\Plugins\AirSim\Source\AirSim.cpp = Unreal\Plugins\AirSim\Source\AirSim.cpp
Unreal\Plugins\AirSim\Source\AirSim.h = Unreal\Plugins\AirSim\Source\AirSim.h
Unreal\Plugins\AirSim\AirSim.uplugin = Unreal\Plugins\AirSim\AirSim.uplugin
Unreal\Plugins\AirSim\Source\AirSimGameMode.cpp = Unreal\Plugins\AirSim\Source\AirSimGameMode.cpp
Unreal\Plugins\AirSim\Source\AirSimGameMode.h = Unreal\Plugins\AirSim\Source\AirSimGameMode.h
Unreal\Plugins\AirSim\Source\CameraDirector.cpp = Unreal\Plugins\AirSim\Source\CameraDirector.cpp
Unreal\Plugins\AirSim\Source\CameraDirector.h = Unreal\Plugins\AirSim\Source\CameraDirector.h
Unreal\Plugins\AirSim\Source\FlyingPawn.cpp = Unreal\Plugins\AirSim\Source\FlyingPawn.cpp
Unreal\Plugins\AirSim\Source\FlyingPawn.h = Unreal\Plugins\AirSim\Source\FlyingPawn.h
Unreal\Plugins\AirSim\Source\ManualPoseController.cpp = Unreal\Plugins\AirSim\Source\ManualPoseController.cpp
Unreal\Plugins\AirSim\Source\ManualPoseController.h = Unreal\Plugins\AirSim\Source\ManualPoseController.h
Unreal\Plugins\AirSim\Source\MultiRotorConnector.cpp = Unreal\Plugins\AirSim\Source\MultiRotorConnector.cpp
Unreal\Plugins\AirSim\Source\MultiRotorConnector.h = Unreal\Plugins\AirSim\Source\MultiRotorConnector.h
Unreal\Plugins\AirSim\Source\NedTransform.cpp = Unreal\Plugins\AirSim\Source\NedTransform.cpp
Unreal\Plugins\AirSim\Source\NedTransform.h = Unreal\Plugins\AirSim\Source\NedTransform.h
Unreal\Plugins\AirSim\Source\PIPCamera.cpp = Unreal\Plugins\AirSim\Source\PIPCamera.cpp
Unreal\Plugins\AirSim\Source\PIPCamera.h = Unreal\Plugins\AirSim\Source\PIPCamera.h
Unreal\Plugins\AirSim\Source\RenderRequest.cpp = Unreal\Plugins\AirSim\Source\RenderRequest.cpp
Unreal\Plugins\AirSim\Source\RenderRequest.h = Unreal\Plugins\AirSim\Source\RenderRequest.h
Unreal\Plugins\AirSim\Source\VehicleCameraConnector.cpp = Unreal\Plugins\AirSim\Source\VehicleCameraConnector.cpp
Unreal\Plugins\AirSim\Source\VehicleCameraConnector.h = Unreal\Plugins\AirSim\Source\VehicleCameraConnector.h
Unreal\Plugins\AirSim\Source\VehicleConnectorBase.cpp = Unreal\Plugins\AirSim\Source\VehicleConnectorBase.cpp
Unreal\Plugins\AirSim\Source\VehicleConnectorBase.h = Unreal\Plugins\AirSim\Source\VehicleConnectorBase.h
Unreal\Plugins\AirSim\Source\VehiclePawnBase.cpp = Unreal\Plugins\AirSim\Source\VehiclePawnBase.cpp
Unreal\Plugins\AirSim\Source\VehiclePawnBase.h = Unreal\Plugins\AirSim\Source\VehiclePawnBase.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimJoystick", "SimJoystick", "{275DB4C1-B933-4D75-85B3-18D3F93439F3}"
ProjectSection(SolutionItems) = preProject
Unreal\Plugins\AirSim\Source\SimJoyStick\SimJoyStick.cpp = Unreal\Plugins\AirSim\Source\SimJoyStick\SimJoyStick.cpp
Unreal\Plugins\AirSim\Source\SimJoyStick\SimJoyStick.h = Unreal\Plugins\AirSim\Source\SimJoyStick\SimJoyStick.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimHUD", "SimHUD", "{95E2FEEF-3F34-4255-BB56-EF77466EFE7C}"
ProjectSection(SolutionItems) = preProject
Unreal\Plugins\AirSim\Source\SimHUD\SimHUD.cpp = Unreal\Plugins\AirSim\Source\SimHUD\SimHUD.cpp
Unreal\Plugins\AirSim\Source\SimHUD\SimHUD.h = Unreal\Plugins\AirSim\Source\SimHUD\SimHUD.h
Unreal\Plugins\AirSim\Source\SimHUD\SimHUDWidget.cpp = Unreal\Plugins\AirSim\Source\SimHUD\SimHUDWidget.cpp
Unreal\Plugins\AirSim\Source\SimHUD\SimHUDWidget.h = Unreal\Plugins\AirSim\Source\SimHUD\SimHUDWidget.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimMode", "SimMode", "{6175579D-2920-406D-A36B-2A0A56AA7892}"
ProjectSection(SolutionItems) = preProject
Unreal\Plugins\AirSim\Source\SimMode\SimModeBase.cpp = Unreal\Plugins\AirSim\Source\SimMode\SimModeBase.cpp
Unreal\Plugins\AirSim\Source\SimMode\SimModeBase.h = Unreal\Plugins\AirSim\Source\SimMode\SimModeBase.h
Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldBase.cpp = Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldBase.cpp
Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldBase.h = Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldBase.h
Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldMultiRotor.cpp = Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldMultiRotor.cpp
Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldMultiRotor.h = Unreal\Plugins\AirSim\Source\SimMode\SimModeWorldMultiRotor.h
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Recording", "Recording", "{66DAD5E7-6925-4266-8E04-91F19052623A}"
ProjectSection(SolutionItems) = preProject
Unreal\Plugins\AirSim\Source\Recording\RecordingFile.cpp = Unreal\Plugins\AirSim\Source\Recording\RecordingFile.cpp
Unreal\Plugins\AirSim\Source\Recording\RecordingFile.h = Unreal\Plugins\AirSim\Source\Recording\RecordingFile.h
Unreal\Plugins\AirSim\Source\Recording\RecordingThread.cpp = Unreal\Plugins\AirSim\Source\Recording\RecordingThread.cpp
Unreal\Plugins\AirSim\Source\Recording\RecordingThread.h = Unreal\Plugins\AirSim\Source\Recording\RecordingThread.h
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DroneShell", "DroneShell\DroneShell.vcxproj", "{9FE9234B-373A-4D5A-AD6B-FB0B593312DD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AirLib", "AirLib\AirLib.vcxproj", "{4BFB7231-077A-4671-BD21-D3ADE3EA36E7}"
Expand Down Expand Up @@ -103,27 +35,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
setup.sh = setup.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Environments", "Environments", "{00D55ED5-8214-4EC6-8828-5146D757BE46}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Blocks", "Blocks", "{C7F74F18-FD02-4044-98AB-F771DF882A2F}"
ProjectSection(SolutionItems) = preProject
Unreal\Environments\Blocks\.gitignore = Unreal\Environments\Blocks\.gitignore
Unreal\Environments\Blocks\Blocks.uproject = Unreal\Environments\Blocks\Blocks.uproject
Unreal\Environments\Blocks\clean.bat = Unreal\Environments\Blocks\clean.bat
Unreal\Environments\Blocks\clean.sh = Unreal\Environments\Blocks\clean.sh
Unreal\Environments\Blocks\update_from_git.bat = Unreal\Environments\Blocks\update_from_git.bat
Unreal\Environments\Blocks\update_from_git.sh = Unreal\Environments\Blocks\update_from_git.sh
Unreal\Environments\Blocks\update_to_git.bat = Unreal\Environments\Blocks\update_to_git.bat
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{7F07A6E9-396C-47F7-A18D-DE1A3A84BC8E}"
ProjectSection(SolutionItems) = preProject
Unreal\Environments\Blocks\Source\Blocks.Target.cs = Unreal\Environments\Blocks\Source\Blocks.Target.cs
Unreal\Environments\Blocks\Source\BlocksEditor.Target.cs = Unreal\Environments\Blocks\Source\BlocksEditor.Target.cs
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCar", "HelloCar\HelloCar.vcxproj", "{4358ED90-CCA1-47A8-8D68-A260F212931E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealPluginFiles", "UnrealPluginFiles.vcxproj", "{39683523-C864-4D47-8350-33FC3EC0F00F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -230,19 +145,14 @@ Global
{4358ED90-CCA1-47A8-8D68-A260F212931E}.Release|x64.Build.0 = Release|x64
{4358ED90-CCA1-47A8-8D68-A260F212931E}.Release|x86.ActiveCfg = Release|Win32
{4358ED90-CCA1-47A8-8D68-A260F212931E}.Release|x86.Build.0 = Release|Win32
{39683523-C864-4D47-8350-33FC3EC0F00F}.Debug|Any CPU.ActiveCfg = Debug|Win32
{39683523-C864-4D47-8350-33FC3EC0F00F}.Debug|x64.ActiveCfg = Debug|x64
{39683523-C864-4D47-8350-33FC3EC0F00F}.Debug|x86.ActiveCfg = Debug|Win32
{39683523-C864-4D47-8350-33FC3EC0F00F}.Release|Any CPU.ActiveCfg = Release|Win32
{39683523-C864-4D47-8350-33FC3EC0F00F}.Release|x64.ActiveCfg = Release|x64
{39683523-C864-4D47-8350-33FC3EC0F00F}.Release|x86.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A3E13CC1-566C-46BD-B46C-45FC31CF12CF} = {04B515C0-07BC-4CE8-8A16-F0D70E86C7C9}
{6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC} = {A3E13CC1-566C-46BD-B46C-45FC31CF12CF}
{275DB4C1-B933-4D75-85B3-18D3F93439F3} = {6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC}
{95E2FEEF-3F34-4255-BB56-EF77466EFE7C} = {6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC}
{6175579D-2920-406D-A36B-2A0A56AA7892} = {6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC}
{66DAD5E7-6925-4266-8E04-91F19052623A} = {6B69410D-51EA-4DD2-94EF-4EB4CEB67CEC}
{00D55ED5-8214-4EC6-8828-5146D757BE46} = {04B515C0-07BC-4CE8-8A16-F0D70E86C7C9}
{C7F74F18-FD02-4044-98AB-F771DF882A2F} = {00D55ED5-8214-4EC6-8828-5146D757BE46}
{7F07A6E9-396C-47F7-A18D-DE1A3A84BC8E} = {C7F74F18-FD02-4044-98AB-F771DF882A2F}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions HelloCar/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main()

//enable API control
client.enableApiControl(true);
CarControllerBase::CarControls controls;
CarApiBase::CarControls controls;

std::cout << "Press enter to drive forward" << std::endl; std::cin.get();
controls.throttle = 0.5f;
Expand All @@ -84,7 +84,7 @@ int main()
client.setCarControls(controls);

std::cout << "Press Enter to stop" << std::endl; std::cin.get();
client.setCarControls(CarControllerBase::CarControls());
client.setCarControls(CarApiBase::CarControls());
}
catch (rpc::rpc_error& e) {
std::string msg = e.get_error().as<std::string>();
Expand Down
Loading

0 comments on commit 3f92d09

Please sign in to comment.