This commit is contained in:
Chris Lovett 2021-04-27 18:36:49 -07:00
Родитель e894d3a215 815fe8e5e2
Коммит 9d2012e324
27 изменённых файлов: 281 добавлений и 201 удалений

Просмотреть файл

@ -115,7 +115,7 @@ Below is summarized list of important changes. This does not include minor/less
* Added [Time of Day API](apis.md#time-of-day-api)
* An experimental integration of [AirSim on Unity](https://github.com/Microsoft/AirSim/tree/master/Unity) is now available. Learn more in [Unity blog post](https://blogs.unity3d.com/2018/11/14/airsim-on-unity-experiment-with-autonomous-vehicle-simulation).
* [New environments](https://github.com/Microsoft/AirSim/releases/tag/v1.2.1): Forest, Plains (windmill farm), TalkingHeads (human head simulation), TrapCam (animal detection via camera)
* Highly efficient [NoDisplay view mode](https://github.com/Microsoft/AirSim/blob/master/docs/settings.md#viewmode) to turn off main screen rendering so you can capture images at high rate
* Highly efficient [NoDisplay view mode](settings.md#viewmode) to turn off main screen rendering so you can capture images at high rate
* [Enable/disable sensors](https://github.com/Microsoft/AirSim/pull/1479) via settings
* [Lidar Sensor](lidar.md)
* [Support for Flysky FS-SM100 RC](https://github.com/Microsoft/AirSim/commit/474214364676b6631c01b3ed79d00c83ba5bccf5) USB adapter

Просмотреть файл

@ -62,7 +62,7 @@ This will generate the necessary shared library and copy it to the UnityDemo Plu
* Click on the new project which showed up in the Unity Hub menu to open it in Unity.
* In the bottom pane, click on `Projects`->`Assets`->`Scenes`. Then, **Double-click** on `SimModeSelector`. This will load the SimModeSelector scene into the scene hierarchy pane. *DO NOT* add CarDemo or DroneDemo scene into the scene hierarchy pane.
* Hit the play button to start the simulation (and hit play again to stop the simulation. .
* Alternatively, you can change the SimMode in your `Settings.json` file. (You can read more about [`Settings.json` here](https://github.com/Microsoft/AirSim/blob/master/docs/settings.md))
* Alternatively, you can change the SimMode in your `Settings.json` file. (You can read more about [`Settings.json` here](settings.md))
* Controlling the car:
Use `WASD` or the `Arrow keys` or the AirSim client.
* Controlling the drone:
@ -119,7 +119,7 @@ chmod +x "{project_name}.{configuration}"
```
### Using Airsim API
* For quickstart with the Python APIs for the car or the drone, simply run the [`hello_car.py`](https://github.com/Microsoft/AirSim/blob/master/PythonClient/car/hello_car.py) or the [`hello_drone.py`](https://github.com/Microsoft/AirSim/blob/master/PythonClient/multirotor/hello_drone.py) script accordingly.
* Details of the AirSim C++ and Python APIs are [here](https://github.com/Microsoft/AirSim/blob/master/docs/apis.md).
* Details of the AirSim C++ and Python APIs are [here](apis.md).
### Acknowledgements
* The drone object was provided by user 31415926 on [sketchfab](https://sketchfab.com/models/055841df0fb24cd4abde06a91f7d360a). It is licensed under the [CC License](https://creativecommons.org/licenses/by/4.0/).

Просмотреть файл

@ -184,7 +184,7 @@ Throttle, brake, steering and gear selections for control. Both automatic and ma
Listens to odometry published by `airsim_node`
#### Publishers:
- `/vel_cmd_world_frame` [airsim_ros_pkgs/VelCmd](airsim_ros_pkgs/VelCmd)
- `/vel_cmd_world_frame` [airsim_ros_pkgs/VelCmd](https://github.com/microsoft/AirSim/tree/master/ros/src/airsim_ros_pkgs/msg/VelCmd.msg)
Sends velocity command to `airsim_node`
### Global params
@ -212,7 +212,8 @@ Upon completion, you will be able to build and run the ros wrapper as in a nativ
##### WSL1 vs WSL2
WSL2 is the latest version of the Windows10 Subsystem for Linux. It is many times faster than WSL1 and is therefore much preferred for building the code in terms of speed.
WSL2 is the latest version of the Windows10 Subsystem for Linux. It is many times faster than WSL1 (if you use the native file system in `/home/...` rather
than Windows mounted folders under `/mnt/...`) and is therefore much preferred for building the code in terms of speed.
Once installed, you can switch between WSL1 or WSL2 versions as you prefer.

Просмотреть файл

@ -40,7 +40,7 @@ catkin build airsim_tutorial_pkgs -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=
$ source PATH_TO/AirSim/ros/devel/setup.bash
$ roslaunch airsim_tutorial_pkgs front_stereo_and_center_mono.launch
```
The above would start rviz with tf's, registered RGBD cloud using [depth_image_proc](https://wiki.ros.org/depth_image_proc) using the [`depth_to_pointcloud` launch file](https://github.com/microsoft/AirSim/master/ros/src/airsim_tutorial_pkgs/launch/front_stereo_and_center_mono/depth_to_pointcloud.launch), and the lidar point cloud.
The above would start rviz with tf's, registered RGBD cloud using [depth_image_proc](https://wiki.ros.org/depth_image_proc) using the [`depth_to_pointcloud` launch file](https://github.com/microsoft/AirSim/blob/master/ros/src/airsim_tutorial_pkgs/launch/front_stereo_and_center_mono/depth_to_pointcloud.launch), and the lidar point cloud.
### Two drones, with cameras, lidar, IMU each

Просмотреть файл

@ -178,7 +178,7 @@ class WeatherParameter:
Please note that `Roadwetness`, `RoadSnow` and `RoadLeaf` effects requires adding [materials](https://github.com/Microsoft/AirSim/tree/master/Unreal/Plugins/AirSim/Content/Weather/WeatherFX) to your scene.
Please see [example code](https://github.com/Microsoft/AirSim/blob/master/PythonClient/computer_vision/weather.py) for more details.
Please see [example code](https://github.com/Microsoft/AirSim/blob/master/PythonClient/environment/weather.py) for more details.
### Recording APIs

Просмотреть файл

@ -86,8 +86,8 @@ int main()
```
## See Also
* [Examples](../Examples) of how to use internal infrastructure in AirSim in your other projects
* [DroneShell](../DroneShell) app shows how to make simple interface using C++ APIs to control drones
* [HelloSpawnedDrones](../HelloSpawnedDrones) app shows how to make additional vehicles on the fly
* [Examples](https://github.com/microsoft/AirSim/tree/master/Examples) of how to use internal infrastructure in AirSim in your other projects
* [DroneShell](https://github.com/microsoft/AirSim/tree/master/DroneShell) app shows how to make simple interface using C++ APIs to control drones
* [HelloSpawnedDrones](https://github.com/microsoft/AirSim/tree/master/HelloSpawnedDrones) app shows how to make additional vehicles on the fly
* [Python APIs](apis.md)

Просмотреть файл

@ -55,7 +55,7 @@ Once both the AirSim environment and the Python application are ready, you can p
This would be a perfect scenario when you want to run the simulation at scale. For instance, you could have several different configurations for the same simulation and execute them in a parallel, unattended way using a Docker image on Azure Container Services
Since AirSim requires access to the host GPU, it is required to use a Docker runtime that supports it. For more information about running AirSim in Docker, click [here](https://github.com/microsoft/AirSim/blob/master/docs/docker_ubuntu.md).
Since AirSim requires access to the host GPU, it is required to use a Docker runtime that supports it. For more information about running AirSim in Docker, click [here](docker_ubuntu.md).
When using Azure Container Services to run this image, the only extra-requirement is to add GPU support to the Container Group where it will be deployed.

Просмотреть файл

@ -8,7 +8,7 @@ We've two options - you can either build inside docker containers or your host m
## Docker
Please see instructions [here](https://github.com/Microsoft/AirSim/blob/master/docs/docker_ubuntu.md)
Please see instructions [here](docker_ubuntu.md)
## Host machine
@ -16,7 +16,7 @@ Please see instructions [here](https://github.com/Microsoft/AirSim/blob/master/d
#### Linux - Build Unreal Engine
- 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.
- Make sure you are [registered with Epic Games](https://docs.unrealengine.com/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/index.html). This is required to get source code access for Unreal Engine.
- Clone Unreal in your favorite folder and build it (this may take a while!). **Note**: We only support Unreal >= 4.24 at present. We recommend using 4.25.
@ -106,7 +106,7 @@ Alternatively, you can use [APIs](apis.md) for programmatic control or use the s
You can also take a look at the `Diagnostics.txt` file.
- How do I use an IDE on Linux?
* You can use Qt Creator or CodeLite. Instructions for Qt Creator are available [here](https://docs.unrealengine.com/latest/INT/Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnIDE/index.html).
* You can use Qt Creator or CodeLite. Instructions for Qt Creator are available [here](https://docs.unrealengine.com/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpQtCreator/index.html).
- Can I cross compile for Linux from a Windows machine?
* Yes, you can, but we haven't tested it. You can find the instructions [here](https://docs.unrealengine.com/latest/INT/Platforms/Linux/GettingStarted/index.html).

Просмотреть файл

@ -47,7 +47,7 @@ Once AirSim is set up by following above steps, you can,
See [Using APIs](apis.md) and [settings.json](settings.md) for various options available.
# AirSim on Unity (Experimental)
[Unity](https://unity3d.com/) is another great game engine platform and we have an **experimental** integration of [AirSim with Unity](https://microsoft.github.com/AirSim/Unity). Please note that this is work in progress and all features may not work yet.
[Unity](https://unity3d.com/) is another great game engine platform and we have an **experimental** integration of [AirSim with Unity](Unity.md). Please note that this is work in progress and all features may not work yet.
# FAQ

Просмотреть файл

@ -62,7 +62,7 @@ You can run the MavlinkCom library and MavLinkTest app to test the connection
between your companion computer and flight controller.
## How Does This Work?
AirSim uses MavLinkCom component developed by @lovettchris. The MavLinkCom has a proxy architecture where you can open a connection to PX4 either using serial or UDP and then other components share this connection. When PX4 sends MavLink message, all components receive that message. If any component sends a message then it's received by PX4 only. This allows you to connect any number of components to PX4 [This code](https://github.com/Microsoft/AirSim/blob/master/AirLib/include/vehicles/multirotor/controllers/MavLinkDroneController.hpp#L793) opens a connection for LogViewer and QGC. You can add something more if you like.
AirSim uses MavLinkCom component developed by @lovettchris. The MavLinkCom has a proxy architecture where you can open a connection to PX4 either using serial or UDP and then other components share this connection. When PX4 sends MavLink message, all components receive that message. If any component sends a message then it's received by PX4 only. This allows you to connect any number of components to PX4 [This code](https://github.com/microsoft/AirSim/blob/master/AirLib/include/vehicles/multirotor/firmwares/mavlink/MavLinkMultirotorApi.hpp#L600) opens a connection for LogViewer and QGC. You can add something more if you like.
If you want to use QGC + AirSim together than you will need QGC to let own the serial port. QGC opens up TCP connection that acts as a proxy so any other component can connect to QGC and send MavLinkMessage to QGC and then QGC forwards that message to PX4. So you tell AirSim to connect to QGC and let QGC own serial port.

Просмотреть файл

@ -66,7 +66,7 @@ First make sure your project's .uproject file is referencing the plugin. Then ma
You are in luck! We have `build_all_ue_projects.bat` which exactly does that. Don't treat it as black box (at least not yet), open it up and see what it does. It has 4 variables that are being set from command line args. If these args is not supplied they are set to default values in next set of statements. You might want to change default values for the paths. This batch file builds AirSim plugin, deploys it to all listed projects (see CALL statements later in the batch file), runs packaging for those projects and puts final binaries in specified folder - all in one step! This is what we use to create our own binary releases.
#### How do I contribute back to AirSim?
Before making any changes make sure you have created your feature branch. After you test your code changes in Blocks environment, follow the [usual steps](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/) to make contributions just like any other GitHub projects. If you are not familiar with Git Branch-Rebase-Merge workflow, please [read this first](http://shitalshah.com/p/git-workflow-branch-rebase-squash-merge/).
Before making any changes make sure you have created your feature branch. After you test your code changes in Blocks environment, follow the [usual steps](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/) to make contributions just like any other GitHub projects. Please use rebase and squash merge, for more information see [An introduction to Git merge and rebase: what they are, and how to use them](https://www.freecodecamp.org/news/an-introduction-to-git-merge-and-rebase-what-they-are-and-how-to-use-them-131b863785f/).

24
docs/distance_sensor.md Normal file
Просмотреть файл

@ -0,0 +1,24 @@
## Distance Sensor
By default, Distance Sensor points to the front of the vehicle. It can be pointed in any direction by modifying the settings
Configurable Parameters -
Parameter | Description
-----------------|------------
X Y Z | Position of the sensor relative to the vehicle (in NED, in meters) (Default (0,0,0)-Multirotor, (0,0,-1)-Car)
Yaw Pitch Roll | Orientation of the sensor relative to the vehicle (degrees) (Default (0,0,0))
MinDistance | Minimum distance measured by distance sensor (metres, only used to fill Mavlink message for PX4) (Default 0.2m)
MaxDistance | Maximum distance measured by distance sensor (metres) (Default 40.0m)
For example, to make the sensor point towards the ground (for altitude measurement similar to barometer), the orientation can be modified as follows -
```json
"Distance": {
"SensorType": 5,
"Enabled" : true,
"Yaw": 0, "Pitch": -90, "Roll": 0
}
```
**Note:** For Cars, the sensor is placed 1 meter above the vehicle center by default. This is required since otherwise the sensor gives strange data due it being inside the vehicle. This doesn't affect the sensor values say when measuring the distance between 2 cars. See [`PythonClient/car/distance_sensor_multi.py`](https://github.com/Microsoft/AirSim/blob/master/PythonClient/car/distance_sensor_multi.py) for an example usage.

Просмотреть файл

@ -52,12 +52,12 @@ You can download it by running
$ ./run_airsim_image_binary.sh Blocks/Blocks.sh -- headless
```
- [Specifying a `settings.json`](https://github.com/Microsoft/AirSim/blob/master/docs/docker_ubuntu.md#airsim_binary-docker-image)
- [Specifying a `settings.json`](docker_ubuntu.md#airsim_binary-docker-image)
## Source
#### Requirements:
- Install [nvidia-docker2](https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(version-2.0))
- Install [ue4-docker](https://adamrehn.com/docs/ue4-docker/configuration/configuring-linux)
- Install [ue4-docker](https://docs.adamrehn.com/ue4-docker/configuration/configuring-linux)
#### Build Unreal Engine inside docker:
* To get access to Unreal Engine's source code, register on Epic Games' website and link it to your github account, as explained in the `Required Steps` section [here](https://docs.unrealengine.com/en-us/Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow).
@ -65,14 +65,14 @@ $ ./run_airsim_image_binary.sh Blocks/Blocks.sh -- headless
* Build unreal engine 4.19.2 docker image. We're going to use CUDA 10.0 in our example.
`$ ue4-docker build 4.19.2 --cuda=10.0 --no-full`
[optional] `$ ue4-docker clean` to free up some space. [Details here](https://adamrehn.com/docs/ue4-docker/commands/clean)
[optional] `$ ue4-docker clean` to free up some space. [Details here](https://docs.adamrehn.com/ue4-docker/commands/clean)
- `ue4-docker` supports all CUDA version listed on NVIDIA's cudagl dockerhub [here](https://hub.docker.com/r/nvidia/cudagl/).
- Please see [this page](https://adamrehn.com/docs/ue4-docker/building-images/advanced-build-options) for advanced configurations using `ue4-docker`
- Please see [this page](https://docs.adamrehn.com/ue4-docker/building-images/advanced-build-options) for advanced configurations using `ue4-docker`
* Disk space:
- The unreal images and containers can take up a lot of space, especially if you try more than one version.
- Here's a list of useful links to monitor space used by docker and clean up intermediate builds:
* [Large container images primer](https://adamrehn.com/docs/ue4-docker/read-these-first/large-container-images-primer)
* [Large container images primer](https://docs.adamrehn.com/ue4-docker/read-these-first/large-container-images-primer)
* [$ `docker system df`](https://docs.docker.com/engine/reference/commandline/system_df/)
[$ `docker container prune`](https://docs.docker.com/engine/reference/commandline/container_prune/)
[$ `docker image prune`](https://docs.docker.com/engine/reference/commandline/image_prune/)
@ -81,7 +81,7 @@ $ ./run_airsim_image_binary.sh Blocks/Blocks.sh -- headless
#### Building AirSim inside UE4 docker container:
* Build AirSim docker image (which lays over the unreal image we just built)
Below are the default arguments.
`--base_image`: This is image over which we'll install airsim. We've tested on `adamrehn/ue4-engine:4.19.2-cudagl10.0`. See [ue4-docker](https://adamrehn.com/docs/ue4-docker/building-images/available-container-images) for other versions.
`--base_image`: This is image over which we'll install airsim. We've tested on `adamrehn/ue4-engine:4.19.2-cudagl10.0`. See [ue4-docker](https://docs.adamrehn.com/ue4-docker/building-images/available-container-images) for other versions.
`--target_image` is the desired name of your docker image.
Defaults to `airsim_source` with same tag as the base image
@ -106,8 +106,8 @@ $ python build_airsim_image.py \
* Inside the container, you can see `UnrealEngine` and `AirSim` under `/home/ue4`.
* Start unreal engine inside the container:
`ue4@HOSTMACHINE:~$ /home/ue4/UnrealEngine/Engine/Binaries/Linux/UE4Editor`
* [Specifying an airsim settings.json](https://github.com/Microsoft/AirSim/blob/master/docs/docker_ubuntu.md#airsim_source-docker-image)
* Continue with [AirSim's Linux docs](https://microsoft.github.io/AirSim/docs/build_linux/#build-unreal-environment).
* See [Specifying an airsim settings.json](docker_ubuntu.md#airsim_source-docker-image) below.
* Continue with [AirSim's Linux docs](build_linux.md#build-unreal-environment).
#### [Misc] Packaging Unreal Environments in `airsim_source` containers
* Let's take the Blocks environment as an example.

Просмотреть файл

@ -222,7 +222,7 @@ When you specify `ImageType = DepthVis` in `ImageRequest`, you get an image that
You normally want to retrieve disparity image as float (i.e. set `pixels_as_float = true` and specify `ImageType = DisparityNormalized` in `ImageRequest`) in which case each pixel is `(Xl - Xr)/Xmax`, which is thereby normalized to values between 0 to 1.
### Segmentation
When you specify `ImageType = Segmentation` in `ImageRequest`, you get an image that gives you ground truth segmentation of the scene. At the startup, AirSim assigns value 0 to 255 to each mesh available in environment. This value is then mapped to a specific color in [the pallet](https://raw.githubusercontent.com/microsoft/AirSim/master/Unreal/Plugins/AirSim/Content/HUDAssets/seg_color_palette.png). The RGB values for each object ID can be found in [this file](seg_rgbs.txt).
When you specify `ImageType = Segmentation` in `ImageRequest`, you get an image that gives you ground truth segmentation of the scene. At the startup, AirSim assigns value 0 to 255 to each mesh available in environment. This value is then mapped to a specific color in [the pallet](https://github.com/microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Content/HUDAssets/seg_color_palette.png). The RGB values for each object ID can be found in [this file](seg_rgbs.txt).
You can assign a specific value (limited to the range 0-255) to a specific mesh using APIs. For example, below Python code sets the object ID for the mesh called "Ground" to 20 in Blocks environment and hence changes its color in Segmentation view:
@ -268,7 +268,7 @@ If you don't know how to open Unreal Environment in Unreal Editor then try follo
Once you decide on the meshes you are interested, note down their names and use above API to set their object IDs. There are [few settings](settings.md#segmentation-settings) available to change object ID generation behavior.
#### Changing Colors for Object IDs
At present the color for each object ID is fixed as in [this pallet](https://github.com/Microsoft/AirSim/tree/master/Unreal//Plugins/AirSim/Content/HUDAssets/seg_color_pallet.png). We will be adding ability to change colors for object IDs to desired values shortly. In the meantime you can open the segmentation image in your favorite image editor and get the RGB values you are interested in.
At present the color for each object ID is fixed as in [this pallet](https://github.com/microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Content/HUDAssets/seg_color_palette.png). We will be adding ability to change colors for object IDs to desired values shortly. In the meantime you can open the segmentation image in your favorite image editor and get the RGB values you are interested in.
#### Startup Object IDs
At the start, AirSim assigns object ID to each object found in environment of type `UStaticMeshComponent` or `ALandscapeProxy`. It then either uses mesh name or owner name (depending on settings), lower cases it, removes any chars below ASCII 97 to remove numbers and some punctuations, sums int value of all chars and modulo 255 to generate the object ID. In other words, all object with same alphabet chars would get same object ID. This heuristic is simple and effective for many Unreal environments but may not be what you want. In that case, please use above APIs to change object IDs to your desired values. There are [few settings](settings.md#segmentation-settings) available to change this behavior.

Двоичные данные
docs/images/log_viewer_connect.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.3 KiB

Просмотреть файл

@ -38,7 +38,7 @@ e.g.
```json
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings_json.md",
"SeeDocsAt": "https://microsoft.github.io/AirSim/settings/",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",

Просмотреть файл

@ -2,28 +2,68 @@
The LogViewer is a Windows WPF app that presents the MavLink streams that it is getting from the
Unreal Simulator. You can use this to monitor what is happening on the drone while it is flying.
For example, the picture below shows a real time graph of the x, y an z gyro sensor information being generated by the simulator.
For example, the picture below shows a real time graph of the x, y an z gyro sensor information
being generated by the simulator.
### Usage
To use this LogViewer, connect the simulator `before` you run the simulation. Simply press the blue connector
button on the top right corner of the window, select the Socket `tab`, enter the port number 14388, and
your `localhost` network. Then press the record button (triangle on the right hand side of the toolbar).
Now start the simulator, pick some mavlink items to graph, you should see something like this:
You can open a log file, it supports .mavlink and PX4 *.ulg files, then you will see the contents of
the log in a tree view on the left, whatever metrics you select will be added to the right the right
side. You can close each individual chart with the little close box in the top right of each chart
and you can group charts so they share the same vertical axis using the group charts button on the
top toolbar.
![Log Viewer](images/log_viewer.png)
The drone view here is the actual estimated position coming from the PX4, so that is a great way to check
whether the PX4 is in sync with the simulator. Sometimes you can see some drift here as the attitude
estimation catches up with reality, this is more visible after a bad crash.
There is also a map option which will plot the GPS path the drone took. You can also load multiple
log files so you can compare the data from each.
### Realtime
You can also get a realtime view if you connect the LogViewer `before` you run the simulation.
![connect](images/log_viewer_connect.png)
For this to work you need to configure the `settings.json` with the following settings:
```
{
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"Vehicles": {
"PX4": {
...,
"LogViewerHostIp": "127.0.0.1",
"LogViewerPort": 14388,
}
}
}
```
Simply press the blue connector button on the top right corner of the window, select the Socket
`tab`, enter the port number `14388`, and your `localhost` network. If you are using WSL 2 on
Windows then select `vEthernet (WSL)`.
If you do choose `vEthernet (WSL)` then make sure you also set `LocalHostIp` and
`LogViewerHostIp` to the matching WSL ethernet address, something like `172.31.64.1`.
Then press the record button (triangle on the right hand side of the toolbar). Now start the
simulator, and the data will start streaming into LogViewer.
The drone view in Log Viewer shows the actual estimated position coming from the PX4, so that is a
great way to check whether the PX4 is in sync with the simulator. Sometimes you can see some drift
here as the attitude estimation catches up with reality, this can become more visible after a bad
crash.
### Installation
If you can't build the LogViewer.sln, there is also a [click once installer](https://lovettsoftwarestorage.blob.core.windows.net/downloads/Px4LogViewer/Px4LogViewer.application).
If you can't build the LogViewer.sln, there is also a [click once
installer](https://lovettsoftwarestorage.blob.core.windows.net/downloads/Px4LogViewer/Px4LogViewer.application).
### Configuration
The magic port number 14388 can be configured in the simulator by editing the [settings.json file](settings.md).
The magic port number 14388 can be configured in the simulator by editing the [settings.json
file](settings.md). If you change the port number in LogViewer connection dialog then be sure
to make the matching changes in your `settings.json` file.
### Debugging

Просмотреть файл

@ -80,96 +80,102 @@ will generate the right MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE and MAVLINK_M
The following code from the UnitTest project shows how to connect to a [Pixhawk](http://www.pixhawk.org/) flight controller over USB serial port,
then wait for the first heartbeat message to be received:
auto connection = MavLinkConnection::connectSerial("drone", "/dev/ttyACM0", 115200, "sh /etc/init.d/rc.usb\n");
MavLinkHeartbeat heartbeat;
if (!waitForHeartbeat(10000, heartbeat)) {
throw std::runtime_error("Received no heartbeat from PX4 after 10 seconds");
}
```c++
auto connection = MavLinkConnection::connectSerial("drone", "/dev/ttyACM0", 115200, "sh /etc/init.d/rc.usb\n");
MavLinkHeartbeat heartbeat;
if (!waitForHeartbeat(10000, heartbeat)) {
throw std::runtime_error("Received no heartbeat from PX4 after 10 seconds");
}
```
The following code connects to serial port, and then forwards all messages to and from QGroundControl to that drone using another connection
that is joined to the drone stream.
auto droneConnection = MavLinkConnection::connectSerial("drone", "/dev/ttyACM0", 115200, "sh /etc/init.d/rc.usb\n");
auto proxyConnection = MavLinkConnection::connectRemoteUdp("qgc", "127.0.0.1", "127.0.0.1", 14550);
droneConnection->join(proxyConnection);
```c++
auto droneConnection = MavLinkConnection::connectSerial("drone", "/dev/ttyACM0", 115200, "sh /etc/init.d/rc.usb\n");
auto proxyConnection = MavLinkConnection::connectRemoteUdp("qgc", "127.0.0.1", "127.0.0.1", 14550);
droneConnection->join(proxyConnection);
```
The following code then takes that connection and turns on heartBeats and starts tracking vehicle information using local
system id 166 and component id 1.
```c++
auto vehicle = std::make_shared<MavLinkVehicle>(166, 1);
vehicle->connect(connection);
vehicle->startHeartbeat();
auto vehicle = std::make_shared<MavLinkVehicle>(166, 1);
vehicle->connect(connection);
vehicle->startHeartbeat();
std::this_thread::sleep_for(std::chrono::seconds(5));
VehicleState state = vehicle->getVehicleState();
printf("Home position is %s, %f,%f,%f\n", state.home.is_set ? "set" : "not set",
state.home.global_pos.lat, state.home.global_pos.lon, state.home.global_pos.alt);
std::this_thread::sleep_for(std::chrono::seconds(5));
VehicleState state = vehicle->getVehicleState();
printf("Home position is %s, %f,%f,%f\n", state.home.is_set ? "set" : "not set",
state.home.global_pos.lat, state.home.global_pos.lon, state.home.global_pos.alt);
```
The following code uses the vehicle object to arm the drone and take off and wait for the takeoff altitude to be reached:
bool rc = false;
if (!vehicle->armDisarm(true).wait(3000, &rc) || !rc) {
printf("arm command failed\n");
return;
}
if (!vehicle->takeoff(targetAlt).wait(3000, &rc) || !rc) {
printf("takeoff command failed\n");
return;
}
int version = vehicle->getVehicleStateVersion();
while (true) {
int newVersion = vehicle->getVehicleStateVersion();
if (version != newVersion) {
VehicleState state = vehicle->getVehicleState();
float alt = state.local_est.pos.z;
if (alt >= targetAlt - delta && alt <= targetAlt + delta)
{
reached = true;
printf("Target altitude reached\n");
break;
}
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
```c++
bool rc = false;
if (!vehicle->armDisarm(true).wait(3000, &rc) || !rc) {
printf("arm command failed\n");
return;
}
if (!vehicle->takeoff(targetAlt).wait(3000, &rc) || !rc) {
printf("takeoff command failed\n");
return;
}
int version = vehicle->getVehicleStateVersion();
while (true) {
int newVersion = vehicle->getVehicleStateVersion();
if (version != newVersion) {
VehicleState state = vehicle->getVehicleState();
float alt = state.local_est.pos.z;
if (alt >= targetAlt - delta && alt <= targetAlt + delta)
{
reached = true;
printf("Target altitude reached\n");
break;
}
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
```
The following code uses offboard control to make the drone fly in a circle with camera pointed at the center.
Here we use the subscribe method to check each new local position message to indicate so we can compute the new
velocity vector as soon as that new position is received. We request a high rate for those messages using
setMessageInterval to ensure smooth circular orbit.
vehicle->setMessageInterval((int)MavLinkMessageIds::MAVLINK_MSG_ID_LOCAL_POSITION_NED, 30);
vehicle->requestControl();
int subscription = vehicle->getConnection()->subscribe(
[&](std::shared_ptr<MavLinkConnection> connection, const MavLinkMessage& m) {
if (m.msgid == (int)MavLinkMessageIds::MAVLINK_MSG_ID_LOCAL_POSITION_NED)
{
float x = localPos.x;
float y = localPos.y;
float dx = x - cx;
float dy = y - cy;
float angle = atan2(dy, dx);
if (angle < 0) angle += M_PI * 2;
float tangent = angle + M_PI_2;
double newvx = orbitSpeed * cos(tangent);
double newvy = orbitSpeed * sin(tangent);
float heading = angle + M_PI;
vehicle->moveByLocalVelocityWithAltHold(newvx, newvy, altitude, true, heading);
}
});
```c++
vehicle->setMessageInterval((int)MavLinkMessageIds::MAVLINK_MSG_ID_LOCAL_POSITION_NED, 30);
vehicle->requestControl();
int subscription = vehicle->getConnection()->subscribe(
[&](std::shared_ptr<MavLinkConnection> connection, const MavLinkMessage& m) {
if (m.msgid == (int)MavLinkMessageIds::MAVLINK_MSG_ID_LOCAL_POSITION_NED)
{
// convert generic msg to strongly typed message.
MavLinkLocalPositionNed localPos;
localPos.decode(msg);
float x = localPos.x;
float y = localPos.y;
float dx = x - cx;
float dy = y - cy;
float angle = atan2(dy, dx);
if (angle < 0) angle += M_PI * 2;
float tangent = angle + M_PI_2;
double newvx = orbitSpeed * cos(tangent);
double newvy = orbitSpeed * sin(tangent);
float heading = angle + M_PI;
vehicle->moveByLocalVelocityWithAltHold(newvx, newvy, altitude, true, heading);
}
});
```
The following code stops flying the drone in offboard mode and tells the drone to loiter at its current location.
This version of the code shows how to use the AsyncResult without blocking on a wait call.
```c++
vehicle->releaseControl();
if (vehicle->loiter().then([=](bool rc) {
printf("loiter command %s\n", rc ? "succeeded" : "failed");
}
```
The following code gets all configurable parameters from the drone and prints them:
```c++
auto list = vehicle->getParamList();
auto end = list.end();
int count = 0;
@ -184,17 +190,19 @@ The following code gets all configurable parameters from the drone and prints th
printf("%s=%d\n", p.name.c_str(), static_cast<int>(p.value));
}
}
```
The following code sets a parameter on the Pixhawk to disable the USB safety check (this is handy if you are controlling
the Pixhawk over USB using another onboard computer that is part of the drone itself). You should NOT do this if you
are connecting your PC or laptop to the drone over USB.
```c++
MavLinkParameter p;
p.name = "CBRK_USB_CHK";
p.value = 197848;
if (!vehicle->setParameter(p).wait(3000,&rc) || !rc) {
printf("Setting the CBRK_USB_CHK failed");
}
```
MavLinkVehicle actually has a helper method for this called allowFlightControlOverUsb, so now you know how it is implemented :-)

Просмотреть файл

@ -3,27 +3,23 @@
## Source code
Getting the PX4 source code is easy:
```
git clone https://github.com/PX4/Firmware.git
cd Firmware
```
Oh, and if you don't have git yet just run this:
```
sudo apt-get install git
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh --no-sim-tools
cd PX4-Autopilot
```
We are currently testing using the 1.6.0rc1 version, but the latest master branch should be ok too.
Now to build it you will need the right tools.
## PX4 Build tools
The full instructions are available on the [dev.px4.io](http://dev.px4.io/starting-installing-linux.html) website,
The full instructions are available on the [dev.px4.io](https://docs.px4.io/master/en/dev_setup/building_px4.html) website,
but we've copied the relevant subset of those instructions here for your convenience.
(Note that [BashOnWindows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide)) can be used to build
the PX4 firmware, just follow the BashOnWindows instructions at the bottom of this page).
the PX4 firmware, just follow the BashOnWindows instructions at the bottom of this page) then proceed with the
Ubuntu setup for PX4.
## Build SITL version
@ -34,7 +30,17 @@ make px4_sitl_default none_iris
Note: this build system is quite special, it knows how to update git submodules (and there's a lot
of them), then it runs cmake (if necessary), then it runs the build itself. So in a way the root
Makefile is a meta-meta makefile :-)
Makefile is a meta-meta makefile :-) You might see prompts like this:
```shell
*******************************************************************************
* IF YOU DID NOT CHANGE THIS FILE (OR YOU DON'T KNOW WHAT A SUBMODULE IS): *
* Hit 'u' and <ENTER> to update ALL submodules and resolve this. *
* (performs git submodule sync --recursive *
* and git submodule update --init --recursive ) *
*******************************************************************************
```
Every time you see this prompt type 'u' on your keyboard.
It shouldn't take long, about 2 minutes. If all succeeds, the last line will link the `px4` app,
which you can then run using the following:

Просмотреть файл

@ -8,9 +8,8 @@ However, the provided script does not let us view the PX4 console. If you want t
**Note** you have to build PX4 with `make px4_sitl_default none_iris` as shown [here](px4_sitl.md#setting-up-px4-software-in-loop) before trying to run multiple PX4 instances.
1. From your bash (or Cygwin) terminal go to the PX4 Firmware directory and run the `sitl_multiple_run.sh` script while specifying the number of vehicles you need
```
cd PX4
cd Firmware
```
cd PX4-Autopilot
./Tools/sitl_multiple_run.sh 2 # 2 here is the number of vehicles/instances
```
This starts multiple instances that listen to TCP ports 4560 to 4560+i where 'i' is the number of vehicles/instances specified
@ -69,7 +68,7 @@ API does not require RC, see [`No Remote Control`](px4_sitl.md#No-Remote-Control
## Starting SITL instances with PX4 console
If you want to start your SITL instances while being able to view the PX4 console, you will need to run the shell scripts found [here](/PX4Scripts) rather than `sitl_multiple_run.sh`.
If you want to start your SITL instances while being able to view the PX4 console, you will need to run the shell scripts found [here](https://github.com/microsoft/AirSim/tree/master/PX4Scripts) rather than `sitl_multiple_run.sh`.
Here is how you would do so:
**Note** This script also assumes PX4 is built with `make px4_sitl_default none_iris` as shown [here](px4_sitl.md#setting-up-px4-software-in-loop) before trying to run multiple PX4 instances.
@ -79,8 +78,8 @@ Here is how you would do so:
cd PX4
mkdir -p Scripts
cd Scripts
wget https://raw.githubusercontent.com/microsoft/AirSim/master/PX4Scripts/sitl_kill.sh
wget https://raw.githubusercontent.com/microsoft/AirSim/master/PX4Scripts/run_airsim_sitl.sh
wget https://github.com/microsoft/AirSim/raw/master/PX4Scripts/sitl_kill.sh
wget https://github.com/microsoft/AirSim/raw/master/PX4Scripts/run_airsim_sitl.sh
```
**Note** the shell scripts expect the `Scripts` and `Firmware` directories to be within the same parent directory. Also, you may need to make the scripts executable by running `chmod +x sitl_kill.sh` and `chmod +x run_airsim_sitl.sh`.
2. Run the `sitl_kill.sh` script to kill all active PX4 SITL instances

Просмотреть файл

@ -8,14 +8,12 @@ The [PX4 software stack](http://github.com/px4/firmware) is an open source very
The following Pixhawk hardware has been tested with AirSim:
1. [3DR Pixhawk v2](https://3dr.com/support/pixhawk/)
2. [3DR Pixhawk mini](https://store.3dr.com/products/3dr-pixhawk)
2. [Pixhawk PX4 2.4.8](http://www.banggood.com/Pixhawk-PX4-2_4_8-Flight-Controller-32-Bit-ARM-PX4FMU-PX4IO-Combo-for-Multicopters-p-1040416.html)
3. [PixFalcon](https://hobbyking.com/en_us/pixfalcon-micro-px4-autopilot.html?___store=en_us)
4. [PixRacer](https://www.banggood.com/Pixracer-Autopilot-Xracer-V1_0-Flight-Controller-Mini-PX4-Built-in-Wifi-For-FPV-Racing-RC-Multirotor-p-1056428.html?utm_source=google&utm_medium=cpc_ods&utm_content=starr&utm_campaign=Smlrfpv-ds-FPVracer&gclid=CjwKEAjw9MrIBRCr2LPek5-h8U0SJAD3jfhtbEfqhX4Lu94kPe88Zrr62A5qVgx-wRDBuUulGzHELRoCRVTw_wcB)
5. [Pixhawk 2.1](http://www.proficnc.com/)
6. [Pixhawk 4 mini from Holybro](https://shop.holybro.com/pixhawk4-mini_p1120.html)
7. [Pixhawk 4 from Holybro](https://shop.holybro.com/pixhawk-4beta-launch_p1089.html)
1. [Pixhawk PX4 2.4.8](http://www.banggood.com/Pixhawk-PX4-2_4_8-Flight-Controller-32-Bit-ARM-PX4FMU-PX4IO-Combo-for-Multicopters-p-1040416.html)
1. [PixFalcon](https://hobbyking.com/en_us/pixfalcon-micro-px4-autopilot.html?___store=en_us)
1. [PixRacer](https://www.banggood.com/Pixracer-Autopilot-Xracer-V1_0-Flight-Controller-Mini-PX4-Built-in-Wifi-For-FPV-Racing-RC-Multirotor-p-1056428.html?utm_source=google&utm_medium=cpc_ods&utm_content=starr&utm_campaign=Smlrfpv-ds-FPVracer&gclid=CjwKEAjw9MrIBRCr2LPek5-h8U0SJAD3jfhtbEfqhX4Lu94kPe88Zrr62A5qVgx-wRDBuUulGzHELRoCRVTw_wcB)
1. [Pixhawk 2.1](http://www.proficnc.com/)
1. [Pixhawk 4 mini from Holybro](https://shop.holybro.com/pixhawk4-mini_p1120.html)
1. [Pixhawk 4 from Holybro](https://shop.holybro.com/pixhawk-4beta-launch_p1089.html)
Version 1.11.2 of the PX4 firmware also works on the Pixhawk 4 devices.
@ -26,7 +24,7 @@ For this you will need one of the supported device listed above. For manual flig
1. Make sure your RC receiver is bound with its RC transmitter. Connect the RC transmitter to the flight controller's RC port. Refer to your RC manual and [PX4 docs](https://docs.px4.io/en/getting_started/rc_transmitter_receiver.html) for more information.
2. Download [QGroundControl](http://qgroundcontrol.com/), launch it and connect your flight controller to the USB port.
3. Use QGroundControl to flash the latest PX4 Flight Stack.
See also [initial firmware setup video](https://dev.px4.io/starting-initial-config.html).
See also [initial firmware setup video](https://docs.px4.io/master/en/config/).
4. In QGroundControl, configure your Pixhawk for HIL simulation by selecting the HIL Quadrocopter X airframe. After PX4 reboots, check that "HIL Quadrocopter X" is indeed selected.
5. In QGroundControl, go to Radio tab and calibrate (make sure the remote control is on and the receiver is showing the indicator for the binding).
6. Go to the Flight Mode tab and chose one of the remote control switches as "Mode Channel". Then set (for example) Stabilized and Attitude flight modes for two positions of the switch.
@ -50,9 +48,9 @@ See also [initial firmware setup video](https://dev.px4.io/starting-initial-conf
"Parameters": {
"NAV_RCL_ACT": 0,
"NAV_DLL_ACT": 0,
"COM_OBL_ACT": 1,
"LPE_LAT": 47.641468,
"LPE_LON": -122.140165,
"COM_OBL_ACT": 1
"LPE_LON": -122.140165
}
}
}

Просмотреть файл

@ -1,25 +1,35 @@
# Setting up PX4 Software-in-Loop
The [PX4](http://dev.px4.io) software provides a "software-in-loop" simulation (SITL) version of their stack that runs in Linux. If you are on Windows then you must
use the [Cygwin Toolchain](https://dev.px4.io/master/en/setup/dev_env_windows_cygwin.html) as the [Bash On Windows](https://dev.px4.io/master/en/setup/dev_env_windows_bash_on_win.html) toolchain no longer works for SITL.
The [PX4](http://dev.px4.io) software provides a "software-in-loop" simulation (SITL) version of
their stack that runs in Linux. If you are on Windows then you can use the [Cygwin
Toolchain](https://dev.px4.io/master/en/setup/dev_env_windows_cygwin.html) or you can use the
[Windows subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) and follow
the PX4 Linux toolchain setup.
If you are using WSL2 please read these [additional
instructions](px4_sitl_wsl2.md).
**Note** that every time you stop the unreal app you have to restart the `px4` app.
1. From your bash terminal follow [these steps for Linux](https://docs.px4.io/master/en/dev_setup/dev_env_linux.html) and follow **all** the instructions under `NuttX based hardware` to install prerequisites. We've also included our own copy of the [PX4 build instructions](px4_build.md) which is a bit more concise about what we need exactly.
1. From your bash terminal follow [these steps for
Linux](https://docs.px4.io/master/en/dev_setup/dev_env_linux.html) and follow **all** the
instructions under `NuttX based hardware` to install prerequisites. We've also included our own
copy of the [PX4 build instructions](px4_build.md) which is a bit more concise about what we need
exactly.
2. Get the PX4 source code and build the posix SITL version of PX4:
```
mkdir -p PX4
cd PX4
git clone https://github.com/PX4/Firmware.git
cd Firmware
git checkout v1.10.1 # recommended version
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh --no-nuttx --no-sim-tools
cd PX4-Autopilot
```
And find the latest stable release from [https://github.com/PX4/PX4-Autopilot/releases](https://github.com/PX4/PX4-Autopilot/releases)
and checkout the source code matching that release, for example:
```
git checkout v1.11.3
```
**Note**: __Cygwin version [0.8](https://github.com/PX4/PX4-windows-toolchain/releases/download/v0.8/PX4.Windows.Cygwin.Toolchain.0.8.msi) is recommended for PX4 v1.10.1__
3. Use following command to build and start PX4 firmware in SITL mode:
```
@ -63,9 +73,9 @@ The default ports have changed recently, so check them closely to make sure AirS
"Parameters": {
"NAV_RCL_ACT": 0,
"NAV_DLL_ACT": 0,
"COM_OBL_ACT": 1,
"LPE_LAT": 47.641468,
"LPE_LON": -122.140165,
"COM_OBL_ACT": 1
"LPE_LON": -122.140165
}
}
}
@ -75,9 +85,9 @@ The default ports have changed recently, so check them closely to make sure AirS
The "Barometer" setting keeps PX4 happy because the default AirSim barometer has a bit too much
noise generation. This setting clamps that down a bit.
6. Now run your Unreal AirSim environment and it should connect to SITL PX4 via TCP.
You should see a bunch of messages from the SITL PX4 window.
Specifically, the following messages tell you that AirSim is connected properly and GPS fusion is stable:
6. Now run your Unreal AirSim environment and it should connect to SITL PX4 via TCP. You should see
a bunch of messages from the SITL PX4 window. Specifically, the following messages tell you that
AirSim is connected properly and GPS fusion is stable:
```
INFO [simulator] Simulator connected on UDP port 14560
INFO [mavlink] partner IP: 127.0.0.1
@ -87,10 +97,14 @@ Specifically, the following messages tell you that AirSim is connected properly
If you do not see these messages then check your port settings.
7. You should also be able to use QGroundControl with SITL mode. Make sure
there is no Pixhawk hardware plugged in, otherwise QGroundControl will choose
to use that instead. Note that as we don't have a physical board, an RC cannot be connected directly to it. So the alternatives are either use XBox 360 Controller or connect your RC using USB (for example, in case of FrSky Taranis X9D Plus) or using trainer USB cable to your PC. This makes your RC look like a joystick. You will need to do extra set up in QGroundControl to use virtual joystick for RC control. You do not need to do this unless you plan to fly a drone manually in AirSim. Autonomous flight using the Python
API does not require RC, see `No Remote Control` below.
7. You should also be able to use QGroundControl with SITL mode. Make sure there is no Pixhawk
hardware plugged in, otherwise QGroundControl will choose to use that instead. Note that as we
don't have a physical board, an RC cannot be connected directly to it. So the alternatives are
either use XBox 360 Controller or connect your RC using USB (for example, in case of FrSky
Taranis X9D Plus) or using trainer USB cable to your PC. This makes your RC look like a joystick.
You will need to do extra set up in QGroundControl to use virtual joystick for RC control. You
do not need to do this unless you plan to fly a drone manually in AirSim. Autonomous flight
using the Python API does not require RC, see `No Remote Control` below.
## Setting GPS origin
@ -118,8 +132,9 @@ Notice the above setting is provided in the `params` section of the `settings.js
"COM_OBL_ACT": 1
```
This tells the drone automatically hover after each offboard control command finishes (the default setting is to land). Hovering is a smoother transition between multiple offboard commands. You can check this setting
by running the following PX4 console command:
This tells the drone automatically hover after each offboard control command finishes (the default
setting is to land). Hovering is a smoother transition between multiple offboard commands. You can
check this setting by running the following PX4 console command:
```
param show COM_OBL_ACT
@ -127,14 +142,16 @@ param show COM_OBL_ACT
## Check the Home Position
If you are using DroneShell to execute commands (arm, takeoff, etc) then you should wait until the Home position is set. You will see the PX4 SITL console output this message:
If you are using DroneShell to execute commands (arm, takeoff, etc) then you should wait until the
Home position is set. You will see the PX4 SITL console output this message:
```
INFO [commander] home: 47.6414680, -122.1401672, 119.99
INFO [tone_alarm] home_set
```
Now DroneShell 'pos' command should report this position and the commands should be accepted by PX4. If you attempt to takeoff without a home position you will see the message:
Now DroneShell 'pos' command should report this position and the commands should be accepted by PX4.
If you attempt to takeoff without a home position you will see the message:
```
WARN [commander] Takeoff denied, disarm and re-try
@ -146,7 +163,8 @@ After home position is set check the local position reported by 'pos' command :
Local position: x=-0.0326988, y=0.00656854, z=5.48506
```
If the z coordinate is large like this then takeoff might not work as expected. Resetting the SITL and simulation should fix that problem.
If the z coordinate is large like this then takeoff might not work as expected. Resetting the SITL
and simulation should fix that problem.
## WSL 2
@ -161,7 +179,10 @@ Notice the above setting is provided in the `params` section of the `settings.js
"NAV_DLL_ACT": 0,
```
This is required if you plan to fly the SITL mode PX4 with no remote control, just using python scripts, for example. These parameters stop the PX4 from triggering "failsafe mode on" every time a move command is finished. You can use the following PX4 command to check these values are set correctly:
This is required if you plan to fly the SITL mode PX4 with no remote control, just using python
scripts, for example. These parameters stop the PX4 from triggering "failsafe mode on" every time a
move command is finished. You can use the following PX4 command to check these values are set
correctly:
```
param show NAV_RCL_ACT
@ -172,25 +193,28 @@ NOTE: Do `NOT` do this on a real drone as it is too dangerous to fly without the
## Manually set parameters
You can also run the following in the PX4 console to set all these parameters:
You can also run the following in the PX4 console to set all these parameters manually:
```
param set LPE_LAT 47.641468
param set LPE_LON -122.140165
param set COM_OBL_ACT 1
param set NAV_RCL_ACT 0
param set NAV_DLL_ACT 0
```
## Setting up multi-vehicle simulation
You can simulate multiple drones in SITL mode using AirSim. However, this requires setting up multiple instances of the PX4 firmware simulator to be able to listen for each vehicle's connection on a separate TCP port (4560, 4561, etc). Please see [this dedicated page](px4_multi_vehicle.md) for instructions on setting up multiple instances of PX4 in SITL mode.
You can simulate multiple drones in SITL mode using AirSim. However, this requires setting up
multiple instances of the PX4 firmware simulator to be able to listen for each vehicle's connection
on a separate TCP port (4560, 4561, etc). Please see [this dedicated page](px4_multi_vehicle.md) for
instructions on setting up multiple instances of PX4 in SITL mode.
## Using VirtualBox Ubuntu
If you want to run the above posix_sitl in a `VirtualBox Ubuntu` machine then it will have a different ip address from localhost. So in this case you need to edit the [settings file](settings.md) and change the UdpIp and SitlIp to the ip address of your virtual machine
set the LocalIpAddress to the address of your host machine running the Unreal engine.
If you want to run the above posix_sitl in a `VirtualBox Ubuntu` machine then it will have a
different ip address from localhost. So in this case you need to edit the [settings
file](settings.md) and change the UdpIp and SitlIp to the ip address of your virtual machine set the
LocalIpAddress to the address of your host machine running the Unreal engine.
## Remote Controller
There are several options for flying the simulated drone using a remote control or joystick like xbox gamepad. See [remote controllers](remote_control.md#RC_Setup_for_PX4)
There are several options for flying the simulated drone using a remote control or joystick like
xbox gamepad. See [remote controllers](remote_control.md#rc-setup-for-px4)

Просмотреть файл

@ -10,14 +10,14 @@ You can either use XBox controller or [FrSky Taranis X9D Plus](https://hobbyking
### Other Devices
AirSim can detect large variety of devices however devices other than above *might* need extra configuration. In future we will add ability to set this config through settings.json. For now, if things are not working then you might want to try workarounds such as [x360ce](http://www.x360ce.com/) or change code in [SimJoystick.cpp file](/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp#L50).
AirSim can detect large variety of devices however devices other than above *might* need extra configuration. In future we will add ability to set this config through settings.json. For now, if things are not working then you might want to try workarounds such as [x360ce](http://www.x360ce.com/) or change code in [SimJoystick.cpp file](https://github.com/microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp#L50).
### Note on FrSky Taranis X9D Plus
[FrSky Taranis X9D Plus](https://hobbyking.com/en_us/frsky-2-4ghz-accst-taranis-x9d-plus-and-x8r-combo-digital-telemetry-radio-system-mode-2.html) is real UAV remote control with an advantage that it has USB port so it can be directly connected to PC. You can [download AirSim config file](misc/AirSim_FrSkyTaranis.bin) and [follow this tutorial](https://www.youtube.com/watch?v=qe-13Gyb0sw) to import it in your RC. You should then see "sim" model in RC with all channels configured properly.
### Note on Linux
Currently default config on Linux is for using Xbox controller. This means other devices might not work properly. In future we will add ability to configure RC in settings.json but for now you *might* have to change code in [SimJoystick.cpp file](/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp#L340) to use other devices.
Currently default config on Linux is for using Xbox controller. This means other devices might not work properly. In future we will add ability to configure RC in settings.json but for now you *might* have to change code in [SimJoystick.cpp file](https://github.com/microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp#L340) to use other devices.
## RC Setup for PX4
@ -27,7 +27,7 @@ AirSim supports PX4 flight controller however it requires different setup. There
2. For Hardware-in-Loop mode, you connect transmitter to Pixhawk. Usually you can find online doc or YouTube video tutorial on how to do that.
3. [Calibrate your RC in QGroundControl](https://docs.qgroundcontrol.com/en/SetupView/Radio.html).
See [PX4 RC configuration](https://docs.px4.io/en/getting_started/rc_transmitter_receiver.html) and Please see [this guide](http://ardupilot.org/copter/docs/common-pixhawk-and-px4-compatible-rc-transmitter-and-receiver-systems.html) for more information.
See [PX4 RC configuration](https://docs.px4.io/en/getting_started/rc_transmitter_receiver.html) and Please see [this guide](https://docs.px4.io/master/en/getting_started/rc_transmitter_receiver.html#px4-compatible-receivers) for more information.
### Using XBox 360 USB Gamepad

Просмотреть файл

@ -152,33 +152,12 @@ above and you can set Enabled to false to disable a specific type of sensor.
```
### Sensor specific settings
Each sensor-type has its own set of settings as well.
Please see [lidar](lidar.md) for example of Lidar specific settings.
#### Distance Sensor
For detailed information on the meaning of these sensor settings
see the following pages:
By default, Distance Sensor points to the front of the vehicle. It can be pointed in any direction by modifying the settings
Configurable Parameters -
Parameter | Description
-----------------|------------
X Y Z | Position of the sensor relative to the vehicle (in NED, in meters) (Default (0,0,0)-Multirotor, (0,0,-1)-Car)
Yaw Pitch Roll | Orientation of the sensor relative to the vehicle (degrees) (Default (0,0,0))
MinDistance | Minimum distance measured by distance sensor (metres, only used to fill Mavlink message for PX4) (Default 0.2m)
MaxDistance | Maximum distance measured by distance sensor (metres) (Default 40.0m)
For example, to make the sensor point towards the ground (for altitude measurement similar to barometer), the orientation can be modified as follows -
```json
"Distance": {
"SensorType": 5,
"Enabled" : true,
"Yaw": 0, "Pitch": -90, "Roll": 0
}
```
**Note:** For Cars, the sensor is placed 1 meter above the vehicle center by default. This is required since otherwise the sensor gives strange data due it being inside the vehicle. This doesn't affect the sensor values say when measuring the distance between 2 cars. See [`PythonClient/car/distance_sensor_multi.py`](https://github.com/Microsoft/AirSim/blob/master/PythonClient/car/distance_sensor_multi.py) for an example usage.
- [Lidar sensor settings](lidar.md)
- [Distance sensor settings](distance_sensor.md)
##### Server side visualization for debugging

Просмотреть файл

@ -16,7 +16,7 @@ These instructions apply if you are already using AirSim on Unreal Engine 4.16.
### For Linux Users
1. From your AirSim repo folder, run 'clean_rebuild.sh`.
2. Rename or delete your existing folder for Unreal Engine.
3. Follow step 1 and 2 to [install Unreal Engine 4.24](https://github.com/Microsoft/AirSim/blob/master/docs/build_linux.md#install-and-build).
3. Follow step 1 and 2 to [install Unreal Engine 4.24](build_linux.md).
4. See also [Build AirSim on Linux](build_linux.md) for more information.
## Upgrading Your Custom Unreal Project

Просмотреть файл

@ -6,7 +6,7 @@ You can simply download precompiled binaries and run to get started immediately.
**Windows, Linux**: Download the binaries for the environment of your choice from the [latest release](https://github.com/Microsoft/AirSim/releases). Some pre-compiled environment binaries may include multiple files (i.e. City.zip.001, City.zip.002). Make sure to download both files before starting the environment. You may need to concatenate both files to unzip them.
**macOS**: You will need to [build it yourself](https://microsoft.github.io/AirSim/build_linux/)
**macOS**: You will need to [build it yourself](build_linux.md)
### Unity (Experimental)
A free environment called Windridge City is available at [Unity Asset Store](https://assetstore.unity.com/) as an experimental release of AirSim on Unity. **Note**: This is an old release, and many of the features and APIs might not work.

Просмотреть файл

@ -31,11 +31,10 @@ extra:
link: https://github.com/Microsoft/AirSim
extra_javascript:
- javascripts/config.js
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
copyright: Copyright &copy; 2018 Microsoft Research
copyright: Copyright &copy; 2021 Microsoft Research
nav:
- "Home":
@ -64,9 +63,11 @@ nav:
- "XBox Controller": 'xbox_controller.md'
- "Steering Wheel": 'steering_wheel_installation.md'
- "Multiple Vehicles": 'multi_vehicle.md'
- "Sensors": 'sensors.md'
- "LIDAR": 'lidar.md'
- "Infrared Camera": "InfraredCamera.md"
- "Sensors":
- "Sensors": 'sensors.md'
- "LIDAR": 'lidar.md'
- "Distance Sensor": 'distance_sensor.md'
- "Infrared Camera": "InfraredCamera.md"
- "ROS: AirSim ROS Wrapper": "airsim_ros_pkgs.md"
- "ROS: AirSim Tutorial Packages": "airsim_tutorial_pkgs.md"
- "Domain Randomization": "retexturing.md"