Skip to content

Commit

Permalink
Docs: Add info about external cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat2004 committed Feb 12, 2021
1 parent f01b7f3 commit 54ad8bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/image_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ camera_pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(0.26179
client.simSetCameraPose(0, camera_pose);
```

- `simSetCameraFov` allows changing the Field-of-View of the camera at runtime.
- `simSetDistortionParams`, `simGetDistortionParams` allow setting and fetching the distortion parameters K1, K2, K3, P1, P2

All Camera APIs take in 3 common parameters apart from the API-specific ones, `camera_name`(str), `vehicle_name`(str) and `external`(bool, to indicate [External Camera](settings.md#external-cameras)). Camera and vehicle name is used to get the specific camera, if `external` is set to `true`, then the vehicle name is ignored. Also see [external_camera.py](https://github.com/Microsoft/AirSim/tree/master/PythonClient/computer_vision/cv_mode.py) for example usage of these APIs.

### Gimbal
You can set stabilization for pitch, roll or yaw for any camera [using settings](settings.md#gimbal).

Expand Down
25 changes: 21 additions & 4 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ Below are complete list of settings available along with their default values. I
"UpdateIntervalSecs": 60
},
"SubWindows": [
{"WindowID": 0, "CameraName": "0", "ImageType": 3, "VehicleName": "", "Visible": false},
{"WindowID": 1, "CameraName": "0", "ImageType": 5, "VehicleName": "", "Visible": false},
{"WindowID": 2, "CameraName": "0", "ImageType": 0, "VehicleName": "", "Visible": false}
{"WindowID": 0, "CameraName": "0", "ImageType": 3, "VehicleName": "", "Visible": false, "External": false},
{"WindowID": 1, "CameraName": "0", "ImageType": 5, "VehicleName": "", "Visible": false, "External": false},
{"WindowID": 2, "CameraName": "0", "ImageType": 0, "VehicleName": "", "Visible": false, "External": false}
],
"SegmentationSettings": {
"InitMethod": "",
Expand Down Expand Up @@ -168,6 +168,14 @@ Below are complete list of settings available along with their default values. I
"X": NaN, "Y": NaN, "Z": NaN,
"Pitch": NaN, "Roll": NaN, "Yaw": NaN
}
},
"ExternalCameras": {
"FixedCamera1": {
// same elements as in CameraDefaults above
},
"FixedCamera2": {
// same elements as in CameraDefaults above
}
}
}
```
Expand Down Expand Up @@ -198,7 +206,13 @@ Also see [Time of Day API](apis.md#time-of-day-api).
This setting specifies the latitude, longitude and altitude of the Player Start component placed in the Unreal environment. The vehicle's home point is computed using this transformation. Note that all coordinates exposed via APIs are using NED system in SI units which means each vehicle starts at (0, 0, 0) in NED system. Time of Day settings are computed for geographical coordinates specified in `OriginGeopoint`.

## SubWindows
This setting determines what is shown in each of 3 subwindows which are visible when you press 0,1,2 keys. The `WindowID` can be 0 to 2, `CameraName` is any [available camera](image_apis.md#available_cameras) on the vehicle. `ImageType` integer value determines what kind of image gets shown according to [ImageType enum](image_apis.md#available-imagetype). `VehicleName` string allows you to specify the vehicle to use the camera from, used when multiple vehicles are specified in the settings. First vehicle's camera will be used if there are any mistakes such as incorrect vehicle name, or only a single vehicle.
This setting determines what is shown in each of 3 subwindows which are visible when you press 1,2,3 keys.

* `WindowID`: Can be 0 to 2
* `CameraName` is any [available camera](image_apis.md#available_cameras) on the vehicle.
* `ImageType` integer value determines what kind of image gets shown according to [ImageType enum](image_apis.md#available-imagetype).
* `VehicleName` string allows you to specify the vehicle to use the camera from, used when multiple vehicles are specified in the settings. First vehicle's camera will be used if there are any mistakes such as incorrect vehicle name, or only a single vehicle.
* `External`: Set it to `true` if the camera is an external camera. If true, then the `VehicleName` parameter is ignored

For example, for a single car vehicle, below shows driver view, front bumper view and rear view as scene, depth and surface normals respectively.
```json
Expand Down Expand Up @@ -288,6 +302,9 @@ This adds fluctuations on horizontal line.
### Gimbal
The `Gimbal` element allows to freeze camera orientation for pitch, roll and/or yaw. This setting is ignored unless `ImageType` is -1. The `Stabilization` is defaulted to 0 meaning no gimbal i.e. camera orientation changes with body orientation on all axis. The value of 1 means full stabilization. The value between 0 to 1 acts as a weight for fixed angles specified (in degrees, in world-frame) in `Pitch`, `Roll` and `Yaw` elements and orientation of the vehicle body. When any of the angles is omitted from json or set to NaN, that angle is not stabilized (i.e. it moves along with vehicle body).

## External Cameras
This element allows specifying cameras which are separate from the cameras attached to the vehicle, such as a CCTV camera. These are fixed cameras, and don't move along with the vehicles. The key in the element is the name of the camera, and the value i.e. settings are the same as `CameraDefaults` described above. All the camera APIs work with external cameras, including capturing images, changing the pose, etc by passing the parameter `external=True` in the API call.

## Vehicles Settings
Each simulation mode will go through the list of vehicles specified in this setting and create the ones that has `"AutoCreate": true`. Each vehicle specified in this setting has key which becomes the name of the vehicle. If `"Vehicles"` element is missing then this list is populated with default car named "PhysXCar" and default multirotor named "SimpleFlight".

Expand Down

0 comments on commit 54ad8bb

Please sign in to comment.