Skip to content

Commit

Permalink
minor changes to PR microsoft#833
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Feb 22, 2018
1 parent d8dce7a commit e169e65
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
8 changes: 4 additions & 4 deletions AirLib/include/common/AirSimSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ struct AirSimSettings {
{
Settings json_parent;
if (settings.getChild("SegmentationSettings", json_parent)) {
std::string init_method = Utils::toLower(json_parent.getString("init_method", ""));
if (init_method == "" || init_method == "none")
segmentation_settings.init_method = SegmentationSettings::InitMethodType::None;
else if (init_method == "commonobjectsrandomids")
std::string init_method = Utils::toLower(json_parent.getString("InitMethod", ""));
if (init_method == "" || init_method == "commonobjectsrandomids")
segmentation_settings.init_method = SegmentationSettings::InitMethodType::CommonObjectsRandomIDs;
else if (init_method == "none")
segmentation_settings.init_method = SegmentationSettings::InitMethodType::None;
else
//TODO: below exception doesn't actually get raised right now because of issue in Unreal Engine?
throw std::invalid_argument(std::string("SegmentationSettings init_method has invalid value in settings ") + init_method);
Expand Down
8 changes: 3 additions & 5 deletions docs/image_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,13 @@ To get desired ground truth segmentation you will need to know the names of the

If you don't know how to open Unreal Environment in Unreal Editor then try following the guide for [building from source](build_windows.md).

Once you decide on the meshes you are interested, note down their names and use above API to set their object IDs.

Alternatively, the `MeshNamingMethod` can be switched to "StaticMeshName" in the [settings](settings.md). In this case, the static mesh name as shown in the content browser in the Unreal Editor is used to refer to meshes. Note that it is not possible to tell individual instances of the same static mesh apart this way, but the names are often more intuitive.
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](../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 pallete](../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.

#### Startup Object IDs
At the start, AirSim assigns object ID to each mesh. To do this, it takes first 3 letters of mesh name, converts them to int, sums them and modulo 255 generates the object ID. In other words, all object with first same 3 letters will get same object ID at the start. 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.
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.

#### Getting Object ID for Mesh
The `simGetSegmentationObjectID` API allows you get object ID for given mesh name.
Expand Down
27 changes: 18 additions & 9 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ Below are complete list of settings available along with their default values. I
"ApiServerPort": 41451
},
"SegmentationSettings": {
"MeshNamingMethod": "OwnerName"
"InitMethod": "",
"MeshNamingMethod": "",
"OverrideExisting": false
},
"PX4": {
"FirmwareName": "PX4",
Expand Down Expand Up @@ -138,14 +140,6 @@ Note that `CaptureSettings` element is json array so you can add settings for mu
## Changing Flight Controller
The `DefaultVehicleConfig` decides which config settings will be used for your vehicles. By default we use [simple_flight](simple_flight.md) so you don't have to do separate HITL or SITL setups. We also support ["PX4"](px4_setup.md) for advanced users.

## LocalHostIp Setting
Now when connecting to remote machines you may need to pick a specific ethernet adapter to reach those machines, for example, it might be
over ethernet or over wifi, or some other special virtual adapter or a VPN. Your PC may have multiple networks, and those networks might not
be allowed to talk to each other, in which case the UDP messages from one network will not get through to the others.

So the LocalHostIp allows you to configure how you are reaching those machines. The default of 127.0.0.1 is not able to reach external machines,
this default is only used when everything you are talking to is contained on a single PC.

## PX4 and MavLink Related Settings
These settings define the Mavlink SystemId and ComponentId for the Simulator (SimSysID, SimCompID), and for an optional external renderer (ExtRendererSysID, ExtRendererCompID)
and the node that allows remote control of the drone from another app this is called the Air Control node (AirControlSysID, AirControlCompID).
Expand Down Expand Up @@ -195,6 +189,21 @@ The recording feature allows you to record data such as position, orientation, v
### ClockSpeed
Determines the speed of simulation clock with respect to wall clock. For example, value of 5.0 would mean simulation clock has 5 seconds elapsed when wall clock has 1 second elapsed (i.e. simulation is running faster). The value of 0.1 means that simulation clock is 10X slower than wall clock. The value of 1 means simulation is running in real time. It is important to realize that quality of simuation may decrease as the simulation clock runs faster. You might see artifacts like object moving past obstacles because collison is not detected. However slowing down simulation clock (i.e. values < 1.0) generally improves the quality of simulation.

### Segmentation Settings
The `InitMethod` determines how object IDs are initialized at startup to generate [segmentation](image_apis.md#segmentation). The value "" or "CommonObjectsRandomIDs" (default) means assign random IDs to each object at startup. This will generate segmentation view with random colors assign to each object. The value "None" means don't initialize object IDs. This will cause segmentation view to have single solid colors. This mode is useful if you plan to set up object IDs using [APIs](image_apis.md#segmentation) and it can save lot of delay at startup for large environments like CityEnviron.

If `OverrideExisting` is false then initializtion does not alter non-zero object IDs already assigned otherwise it does.

If `MeshNamingMethod` is "" or "OwnerName" then we use mesh's owner name to generate random hash as object IDs. If its "StaticMeshName" then we use static mesh's name to generate random hash as object IDs. Note that it is not possible to tell individual instances of the same static mesh apart this way, but the names are often more intuitive.

### LocalHostIp Setting
Now when connecting to remote machines you may need to pick a specific ethernet adapter to reach those machines, for example, it might be
over ethernet or over wifi, or some other special virtual adapter or a VPN. Your PC may have multiple networks, and those networks might not
be allowed to talk to each other, in which case the UDP messages from one network will not get through to the others.

So the LocalHostIp allows you to configure how you are reaching those machines. The default of 127.0.0.1 is not able to reach external machines,
this default is only used when everything you are talking to is contained on a single PC.

### Image Noise Settings
The `NoiseSettings` allows to add noise to the specified image type with a goal of simulating camera sensor noise, interference and other artifacts. By default no noise is added, i.e., `Enabled: false`. If you set `Enabled: true` then following different types of noise and interference artifacts are enabled, each can be further tuned using setting. The noise effects are implemented as shader created as post processing material in Unreal Engine called [CameraSensorNoise](https://github.com/Microsoft/AirSim/blob/master/Unreal/Plugins/AirSim/Content/HUDAssets/CameraSensorNoise.uasset).

Expand Down

0 comments on commit e169e65

Please sign in to comment.