Skip to content

Commit

Permalink
docs update complete
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Jun 19, 2018
1 parent 3e51cf5 commit a5f162b
Show file tree
Hide file tree
Showing 26 changed files with 506 additions and 329 deletions.
20 changes: 19 additions & 1 deletion AirLib/include/common/AirSimSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ struct AirSimSettings {
//these settings_json are expected in same section, not in another child
auto vehicle_setting = std::unique_ptr<PX4VehicleSetting>(new PX4VehicleSetting());

//TODO: we should be selecting remote if available else keyboard
//currently keyboard is not supported so use rc as default
vehicle_setting->rc.remote_control_id = 0;

MavLinkConnectionInfo &connection_info = vehicle_setting->connection_info;
connection_info.sim_sysid = static_cast<uint8_t>(settings_json.getInt("SimSysID", connection_info.sim_sysid));
connection_info.sim_compid = settings_json.getInt("SimCompID", connection_info.sim_compid);
Expand Down Expand Up @@ -620,8 +624,15 @@ struct AirSimSettings {
std::unique_ptr<VehicleSetting> vehicle_setting;
if (vehicle_type == kVehicleTypePX4)
vehicle_setting = createPX4VehicleSetting(settings_json);
else //for everything else we don't need derived class yet
//for everything else we don't need derived class yet
else {
vehicle_setting = std::unique_ptr<VehicleSetting>(new VehicleSetting());
if (vehicle_type == kVehicleTypeSimpleFlight) {
//TODO: we should be selecting remote if available else keyboard
//currently keyboard is not supported so use rc as default
vehicle_setting->rc.remote_control_id = 0;
}
}
vehicle_setting->vehicle_name = vehicle_name;

//required settings_json
Expand Down Expand Up @@ -660,6 +671,9 @@ struct AirSimSettings {
{
vehicles.clear();

//NOTE: Do not set defaults for vehicle type here. If you do then make sure
//to sync code in createVehicleSetting() as well.

//create simple flight as default multirotor
auto simple_flight_setting = std::unique_ptr<VehicleSetting>(new VehicleSetting());
simple_flight_setting->vehicle_name = "SimpleFlight";
Expand Down Expand Up @@ -692,6 +706,10 @@ struct AirSimSettings {
std::vector<std::string> keys;
vehicles_child.getChildNames(keys);

//remove default vehicles, if values are specified in settings
if (keys.size())
vehicles.clear();

for (const auto& key : keys) {
msr::airlib::Settings child;
vehicles_child.getChild(key, child);
Expand Down
25 changes: 8 additions & 17 deletions PythonClient/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
# Python API Examples for AirSim
# Python API for AirSim

This folder contains Python package and examples for [AirSim](https://github.com/microsoft/airsim).
This package contains Python APIs for [AirSim](https://github.com/microsoft/airsim).

## Pre-requisites
Please make sure you have installed Python package for msgpack (this needs administrator/sudo prompt):
## How to Use
See examples at [car/hello_car.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/car/hello_car.py) or [multirotor\hello_drone.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/hello_drone.py).

## Dependencies
This package depends on `msgpack` and would automatically install `msgpack-rpc-python` (this may need administrator/sudo prompt):
```
pip install msgpack-rpc-python
```

Some examples requires opencv. You can install required packages by running `install_packages.bat`.

Note: Do not run `setup.py`. It is meant for creating python package.

## How to Run
Try out `car/hello_car.py` or `multirotor\hello_drone.py`.
You can run them either from Visual Studio solution or from command line like usual Python scripts.
Also explore other examples.

## Folder Structure

The `airsim` folder contains wrapper over msgpack APIs to expose AirSim APIs in friendly Pythonic way.
Other folders contains example code for how to use APIs.
Some examples also requires opencv.

## More Info

Expand Down
43 changes: 43 additions & 0 deletions PythonClient/airsim.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Metadata-Version: 2.1
Name: airsim
Version: 1.2.0
Summary: Open source simulator based on Unreal Engine for autonomous vehicles from Microsoft AI & Research
Home-page: https://github.com/microsoft/airsim
Author: Shital Shah
Author-email: sytelus@gmail.com
License: UNKNOWN
Description: # Python API Examples for AirSim

This folder contains Python package and examples for [AirSim](https://github.com/microsoft/airsim).

## Pre-requisites
Please make sure you have installed Python package for msgpack (this needs administrator/sudo prompt):
```
pip install msgpack-rpc-python
```

Some examples requires opencv. You can install required packages by running `install_packages.bat`.

Note: Do not run `setup.py`. It is meant for creating python package.

## How to Run
Try out `car/hello_car.py` or `multirotor\hello_drone.py`.
You can run them either from Visual Studio solution or from command line like usual Python scripts.
Also explore other examples.

## Folder Structure

The `airsim` folder contains wrapper over msgpack APIs to expose AirSim APIs in friendly Pythonic way.
Other folders contains example code for how to use APIs.

## More Info

More information on AirSim Python APIs can be found at:
https://github.com/Microsoft/AirSim/blob/master/docs/python.md


Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
11 changes: 11 additions & 0 deletions PythonClient/airsim.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
README.md
setup.py
airsim/__init__.py
airsim/client.py
airsim/pfm.py
airsim/types.py
airsim/utils.py
airsim.egg-info/PKG-INFO
airsim.egg-info/SOURCES.txt
airsim.egg-info/dependency_links.txt
airsim.egg-info/top_level.txt
1 change: 1 addition & 0 deletions PythonClient/airsim.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions PythonClient/airsim.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
airsim
20 changes: 10 additions & 10 deletions PythonClient/car/setup_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ def getParentDir():
@staticmethod
def addAirSimModulePath():
# if airsim module is installed then don't do anything else
import pkgutil
airsim_loader = pkgutil.find_loader('airsim')
if airsim_loader is not None:
return

grand_parent = SetupPath.getParentDir()
if grand_parent != '':
airsim_path = os.path.join(grand_parent, 'airsim')
#import pkgutil
#airsim_loader = pkgutil.find_loader('airsim')
#if airsim_loader is not None:
# return

parent = SetupPath.getParentDir()
if parent != '':
airsim_path = os.path.join(parent, 'airsim')
client_path = os.path.join(airsim_path, 'client.py')
if os.path.exists(client_path):
sys.path.insert(0, grand_parent)
sys.path.insert(0, parent)
else:
logging.warning("airsim module not found in grand parent folder. Using default installed module (if any).")
logging.warning("airsim module not found in parent folder. Using installed package (pip install airsim).")

SetupPath.addAirSimModulePath()
Binary file added PythonClient/dist/airsim-1.2.0-py3-none-any.whl
Binary file not shown.
Binary file added PythonClient/dist/airsim-1.2.0.tar.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions PythonClient/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
),
install_requires=[
'msgpack-rpc-python', 'numpy'
]
)
2 changes: 1 addition & 1 deletion docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ AirSim offers comprehensive images APIs to retrieve synchronized images from mul
More on [image APIs and Computer Vision mode](image_apis.md).

### Pause and Continue APIs
AirSim allows to pause and continue the simulation through `pause(is_paused)` API. To pause the simulation call `pause(True)` and to continue the simulation call `pause(False)`. You may have scenario, especially while using reinforcement learning, to run the simulation for specified amount of time and then automatically pause. While simulation is paused, you may then do some expensive computation, send a new command and then again run the simulation for specified amount of time. This can be achieved by API `continueForTime(seconds)`. This API runs the simulation for the specified number of seconds and then pauses the simulation. For example usage, please see [pause_continue_car.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/pause_continue_car.py) and [pause_continue_drone.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/pause_continue_drone.py).
AirSim allows to pause and continue the simulation through `pause(is_paused)` API. To pause the simulation call `pause(True)` and to continue the simulation call `pause(False)`. You may have scenario, especially while using reinforcement learning, to run the simulation for specified amount of time and then automatically pause. While simulation is paused, you may then do some expensive computation, send a new command and then again run the simulation for specified amount of time. This can be achieved by API `continueForTime(seconds)`. This API runs the simulation for the specified number of seconds and then pauses the simulation. For example usage, please see [pause_continue_car.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/car/pause_continue_car.py) and [pause_continue_drone.py](https://github.com/Microsoft/AirSim/blob/master/PythonClient/multirotor/pause_continue_drone.py).

### Coordinate System
All AirSim API uses NED coordinate system, i.e., +X is North, +Y is East and +Z is Down. All units are in SI system. Please note that this is different from coordinate system used internally by Unreal Engine. In Unreal Engine, +Z is up instead of down and length unit is in centimeters instead of meters. AirSim APIs takes care of the appropriate conversions. The starting point of the vehicle is always coordinates (0, 0, 0) in NED system. Thus when converting from Unreal coordinates to NED, we first subtract the starting offset and then scale by 100 for cm to m conversion. The vehicle is spawned in Unreal environment where the Player Start component is placed. There is a setting called `OriginGeopoint` in [settings.json](setings.md) which assigns geographic longitude, longitude and altitude to the Player Start component.
Expand Down
2 changes: 1 addition & 1 deletion docs/build_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The current recommended and tested environment is **Ubuntu 16.04 LTS**. Theoreti
It's super simple: 1-2-3!

1. Make sure you are [registered with Epic Games](https://docs.unrealengine.com/latest/INT/Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/1/index.html). This is required to get source code access for Unreal Engine.
2. Clone Unreal in your favorite folder and build it (this may take a while!). **Note**: We only support Unreal 4.17 at present.
2. Clone Unreal in your favorite folder and build it (this may take a while!). **Note**: We only support Unreal 4.18 at present.
```bash
# go to the folder where you clone GitHub projects
git clone -b 4.18 https://github.com/EpicGames/UnrealEngine.git
Expand Down
Loading

0 comments on commit a5f162b

Please sign in to comment.