Skip to content

Commit

Permalink
update doc for state API, print pos in example
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Dec 16, 2017
1 parent f7ab5ae commit 459382b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions PythonClient/cv_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
responses = client.simGetImages([
ImageRequest(0, AirSimImageType.DepthVis),
ImageRequest(1, AirSimImageType.DepthPerspective, True),
ImageRequest(0, AirSimImageType.Segmentation),
ImageRequest(0, AirSimImageType.Scene),
ImageRequest(0, AirSimImageType.DisparityNormalized),
ImageRequest(0, AirSimImageType.SurfaceNormals)])
ImageRequest(2, AirSimImageType.Segmentation),
ImageRequest(3, AirSimImageType.Scene),
ImageRequest(4, AirSimImageType.DisparityNormalized),
ImageRequest(4, AirSimImageType.SurfaceNormals)])

for i, response in enumerate(responses):
if response.pixels_as_float:
print("Type %d, size %d" % (response.image_type, len(response.image_data_float)))
print("Type %d, size %d, pos %s" % (response.image_type, len(response.image_data_float), pprint.pformat(response.camera_position)))
AirSimClientBase.write_pfm(os.path.normpath('/temp/cv_mode_' + str(x) + "_" + str(i) + '.pfm'), AirSimClientBase.getPfmArray(response))
else:
print("Type %d, size %d" % (response.image_type, len(response.image_data_uint8)))
print("Type %d, size %d, pos %s" % (response.image_type, len(response.image_data_uint8), pprint.pformat(response.camera_position)))
AirSimClientBase.write_file(os.path.normpath('/temp/cv_mode_' + str(x) + "_" + str(i) + '.png'), response.image_data_uint8)

pose = client.simGetPose()
Expand Down
5 changes: 4 additions & 1 deletion docs/apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ More on [image APIs and Computer Vision mode](image_apis.md).
Car has followings APIs available:

* `setCarControls`: This allows you to set throttle, steering, handbrake and auto or manual gear.
* `getCarState`: This retrieves the state information including speed, current gear, velocity vector, position and orientation.
* `getCarState`: This retrieves the state information including speed, current gear and 6 kinematics quantities: position, orientation, linear and angular velocity, linear and angular acceleration. All quantities are in NED coordinate system, SI units in world frame except for angular velocity and accelerations which are in body frame.
* [Image APIs](image_apis.md).

### APIs for Multirotor
Multirotor can be controlled by specifying angles, velocity vector, destination position or some combination of these. There are corresponding `move*` APIs for this purpose. When doing position control, we need to use some path following algorithm. By default AirSim uses carrot following algorithm. This is often referred to as "high level control" because you just need to specify very high level goal and the firmware takes care of the rest. Currently lowest level control available in AirSim is moveByAngle API however we will be adding more lower level controls soon as well.

#### getMultirotorState
This API state of the vehicle in one call. The state includes, collision, estimated kinematics (i.e. kinematics computed by fusing sensors), ground truth kinematics, GPS location and timestamp (nano seconds since epoch). The kinematics here means 6 quantities: position, orientation, linear and angular velocity, linear and angular acceleration. Please note that simple_slight currently doesn't support state estimator which means estimated and ground truth kinematics values would be same for simple_flight. Estimated kinematics are however available for PX4 except for angular acceleration. All quantities are in NED coordinate system, SI units in world frame except for angular velocity and accelerations which are in body frame.

#### duration and max_wait_seconds
Many API methods has parameters named `duration` or: `max_wait_seconds`.

Expand Down

0 comments on commit 459382b

Please sign in to comment.