Skip to content

Latest commit

 

History

History
1170 lines (844 loc) · 77.6 KB

Python_API.md

File metadata and controls

1170 lines (844 loc) · 77.6 KB

AirSim Python API Documentation

Table of Contents

VehicleClient Class

VehicleClient.__init__()

Initialize vehicle client.

Args Type Required or Optional Description
ip str optional, default=''
port int optional, default=41451
timeout_value int optional, default=3600

VehicleClient.reset()

Reset the vehicle to its original starting state.


VehicleClient.ping()

If connection is established then this call will return true otherwise it will be blocked until timeout.

Returns Description
bool Returns whether call is successful

VehicleClient.getClientVersion()

Request client version.

Returns Description
int Returns version

VehicleClient.getServerVersion()

Request server version.

Returns Description
int Returns version

VehicleClient.getMinRequiredServerVersion()

Request minimum server version.

Returns Description
int Returns version

VehicleClient.getMinRequiredClientVersion()

Request minimum client version.

Returns Description
int Returns version

VehicleClient.enableApiControl(is_enabled)

Enables or disables API control for vehicle corresponding to vehicle_name.

Args Type Required or Optional Description
is_enabled bool required Enable or Disable API
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.isApiControlEnabled()

Returns true if API control is established.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
bool Whether API control is enabled

VehicleClient.armDisarm(arm)

Arms or disarms vehicle.

Args Type Required or Optional Description
arm bool required True to arm, False to disarm the vehicle
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
bool Whether call was successful

VehicleClient.simPause(is_paused)

Pauses simulation.

Args Type Required or Optional Description
is_paused bool required True to pause the simulation, False to release

VehicleClient.simIsPause()

Returns true if the simulation is paused.

Returns Description
bool Whether simulation is paused

VehicleClient.simContinueForTime(seconds)

Continue the simulation for the specified number of seconds.

Args Type Required or Optional Description
seconds float required Time to run the simulation for

VehicleClient.getHomeGeoPoint()

Get the Home location of the vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
GeoPointgeo Home location of the vehicle

VehicleClient.confirmConnection()

Checks state of connection every 1 sec and reports it in Console so user can see the progress for connection.

Returns Description
bool Whether connection is established

VehicleClient.simSwapTextures(tags)

Runtime Swap Texture API.

Args Type Required or Optional Description
tags str required string of "," or ", " delimited tags to identify on which actors to perform the swap
tex_id int optional, default=0 indexes the array of textures assigned to each actor undergoing a swap
component_id int optional, default=0
material_id int optional, default=0
Returns Description
list of str List of objects which matched the provided tags and had the texture swap perfomed

VehicleClient.simSetTimeOfDay(is_enabled)

Control the position of Sun in the environment.

Args Type Required or Optional Description
is_enabled bool required True to enable time-of-day effect, False to reset the position to original
start_datetime str optional, default='' ate & Time in %Y-%m-%d %H:%M:%S format, e.g. 2018-02-12 15:20:00
is_start_datetime_dst bool optional, default=False True to adjust for Daylight Savings Time
celestial_clock_speed float optional, default=1 Run celestial clock faster or slower than simulation clock
update_interval_secs float optional, default=60 Interval to update the Sun's position
move_sun bool optional, default=True Whether or not to move the Sun

VehicleClient.simEnableWeather(enable)

Enable Weather effects. Needs to be called before using simSetWeatherParameter API.

Args Type Required or Optional Description
enable bool required True to enable, False to disable

VehicleClient.simSetWeatherParameter(param, val)

Enable various weather effects.

Args Type Required or Optional Description
param WeatherParameter required Weather effect to be enabled
val float required Intensity of the effect, Range 0-1

VehicleClient.simGetImage(camera_name, image_type)

Get a single image.

Args Type Required or Optional Description
camera_name str required Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used
image_type ImageType required Type of image required
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
str Binary string literal of compressed png image

VehicleClient.simGetImages(requests)

Get multiple images.

Args Type Required or Optional Description
requests List of ImageRequest required Images required
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
List of ImageResponse

VehicleClient.simGetMeshPositionVertexBuffers()

Returns the static meshes that make up the scene. See https://microsoft.github.io/AirSim/meshes/ for details and how to use this.

Returns Description
List of MeshPositionVertexBuffersResponse more information [here][https://github.com/microsoft/AirSim/blob/master/docs/meshes.md]

VehicleClient.simGetCollisionInfo()

Returns information aboout collision with vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
CollisionInfo

VehicleClient.simSetVehiclePose(pose, ignore_collison)

Set the pose of the vehicle.

Args Type Required or Optional Description
pose Pose required Desired Pose pf the vehicle
ignore_collision bool required Whether to ignore any collision or not
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.simGetVehiclePose()

Returns current pose of the vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
Pose

VehicleClient.simSetTraceLine(color_rgba)

Modify the color and thickness of the line when Tracing is enabled.

Args Type Required or Optional Description
color_rgba List of float required desired RGBA values from 0.0 to 1.0
thickness float optional, default='1.0' Thickness of the line
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.simGetObjectPose(object_name)

Returns current pose of the object.

Args Type Required or Optional Description
object_name str required Object to get the Pose of
Returns Description
Pose

VehicleClient.simSetObjectPose(object_name, pose)

Set the pose of the object(actor) in the environment.

Args Type Required or Optional Description
object_name str required Object to get the Pose of
pose Pose required Desired Pose pf the vehicle
teleport bool optional, default=True Whether to move the object immediately without affecting their velocity
Returns Description
bool Whether the move was successful

VehicleClient.simListSceneObjects()

Lists the objects present in the environment.

Args Type Required or Optional Description
name_regex str optional, default='.*' String to match actor names against, e.g. "Cylinder.*"
Returns Description
List of str List containing all the names

VehicleClient.simSetSegmentationObjectID(mesh_name, object_id)

Set segmentation ID for specific objects. See https://microsoft.github.io/AirSim/image_apis/#segmentation for details.

Args Type Required or Optional Description
mesh_name str required Name of the mesh to set the ID of (supports regex)
object_id int required Object ID to be set, range 0-255
is_name_regex bool optional, default=False Whether the mesh name is a regex
Returns Description
bool If the mesh was found

VehicleClient.simGetSegmentationObjectID(mesh_name)

Returns Object ID for the given mesh name. Mapping of Object IDs to RGB values can be seen at https://microsoft.github.io/AirSim/seg_rgbs.txt.

Args Type Required or Optional Description
mesh_name str required Name of the mesh to get the ID of

VehicleClient.simPrintLogMessage(message)

Prints the specified message in the simulator's window.

Args Type Required or Optional Description
message str required Message to be printed
message_param str optional, default='' Parameter to be printed next to the message
severity int optional, default=0 Range 0-3, inclusive, corresponding to the severity of the message

VehicleClient.simGetCameraInfo(camera_name)

Get details about the camera.

Args Type Required or Optional Description
camera_name str required Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
CameraInfo

VehicleClient.simSetCameraOrientation(camera_name, orientation)

Control the orientation of a selected camera.

Args Type Required or Optional Description
camera_name str required Name of the camera to be controlled
orientation Quaternionr required Quaternion representing the desired orientation of the camera
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.simSetCameraFov(camera_name, fov_degrees)

Control the field of view of a selected camera.

Args Type Required or Optional Description
camera_name str required Name of the camera to be controlled
fov_degrees float required Value of field of view in degrees
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.simGetGroundTruthKinematics()

Get Ground truth kinematics of the vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
KinematicsState Ground truth of the vehicle

VehicleClient.simGetGroundTruthEnvironment()

Get ground truth environment state.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
EnvironmentState Ground truth environment state

VehicleClient.getImuData()

Returns informaton about IMU.

Args Type Required or Optional Description
imu_name str optional, default='' Name of IMU to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
ImuData more information [here][https://github.com/microsoft/airsim/blob/master/docs/sensors.md]

VehicleClient.getBarometerData()

Returns information about barometer.

Args Type Required or Optional Description
barometer_name str optional, default='' Name of Barometer to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
BarometerData more information [here][https://github.com/microsoft/airsim/blob/master/docs/sensors.md]

VehicleClient.getMagnetometerData()

Returns information about magnetometer.

Args Type Required or Optional Description
magnetometer_name str optional, default='' Name of Magnetometer to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MagnetometerData more information [here][https://github.com/microsoft/airsim/blob/master/docs/sensors.md]

VehicleClient.getGpsData()

Returns information about GPS.

Args Type Required or Optional Description
gps_name str optional, default='' Name of GPS to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
GpsData more information [here][https://github.com/microsoft/airsim/blob/master/docs/sensors.md]

VehicleClient.getDistanceSensorData()

Returns information about distance sensor.

Args Type Required or Optional Description
distance_sensor_name str optional, default='' Name of distance sensor to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
DistanceSensorData more information [here][https://github.com/microsoft/airsim/blob/master/docs/sensors.md]

VehicleClient.getLidarData()

Get information about LiDAR.

Args Type Required or Optional Description
lidar_name str optional, default='' Name of LiDAR to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
LidarData more information [here][https://github.com/microsoft/airsim/blob/master/docs/lidar.md]

VehicleClient.simGetLidarSegmentation()

Returns Segmentation ID of each point's collided object in the last Lidar update.

Args Type Required or Optional Description
lidar_name str optional, default='' Name of LiDAR to get data from, specified in settings.json
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
List of int Segmentation IDs of the objects

VehicleClient.simFlushPersistentMarkers()

Clear any persistent markers - those plotted with setting is_persistent=True.


VehicleClient.simPlotPoints(points)

Plot a list of 3D points in World NED frame.

Args Type Required or Optional Description
points List of Vector3r required List of Vector3r objects
color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
size float optional, default=10.0 Size of plotted point
duration float optional, default=-1.0 Duration (seconds) to plot for
is_persistent bool optional, default=False If set to True, the desired object will be plotted for infinite time.

VehicleClient.simPlotLineStrip(points)

Plots a line strip in World NED frame, defined from points[0] to points[1], points[1] to points[2], ... , points[n-2] to points[n-1].

Args Type Required or Optional Description
points List of Vector3r required List of Vector3r objects
color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
thickness float optional, default=5.0 Thickness of line
duration float optional, default=-1.0 Duration (seconds) to plot for
is_persistent bool optional, default=False If set to True, the desired object will be plotted for infinite time.

VehicleClient.simPlotLineList(points)

Plots a line strip in World NED frame, defined from points[0] to points[1], points[2] to points[3], ... , points[n-2] to points[n-1].

Args Type Required or Optional Description
points List of Vector3r required List of Vector3r objects
color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
thickness float optional, default=5.0 Thickness of line
duration float optional, default=-1.0 Duration (seconds) to plot for
is_persistent bool optional, default=False If set to True, the desired object will be plotted for infinite time.

VehicleClient.simPlotArrows(points_start, points_end)

Plots a list of arrows in World NED frame, defined from points_start[0] to points_end[0], points_start[1] to points_end[1], ... , points_start[n-1] to points_end[n-1].

Args Type Required or Optional Description
points_start List of Vector3r required List of 3D start positions of arrow start positions, specified as Vector3r objects
points_end List of Vector3r required List of 3D end positions of arrow start positions, specified as Vector3r objects
color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
thickness float optional, default=5.0 Thickness of line
arrow_size float optional, default=2.0 Size of arrow head
duration float optional, default=-1.0 Duration (seconds) to plot for
is_persistent bool optional, default=False If set to True, the desired object will be plotted for infinite time.

VehicleClient.simPlotStrings(strings, positions)

Plots a list of strings at desired positions in World NED frame.

Args Type Required or Optional Description
strings List of str required List of strings to plot
positions List of Vector3r required List of positions where the strings should be plotted. Should be in one-to-one correspondence with the strings' list
scale float optional, default=5 Font scale of transform name
color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
duration float optional, default=-1.0 Duration (seconds) to plot for

VehicleClient.simPlotTransforms(poses)

Plots a list of transforms in World NED frame.

Args Type Required or Optional Description
poses List of Pose required List of Pose objects representing the transforms to plot
scale float optional, default=5 Font scale of transform name
thickness float optional, default=5.0 Thickness of line
duration float optional, default=-1.0 Duration (seconds) to plot for
is_persistent bool optional, default=False If set to True, the desired object will be plotted for infinite time.

VehicleClient.simPlotTransformsWithNames(poses, names)

Plots a list of transforms with their names in World NED frame.

Args Type Required or Optional Description
poses List of Pose required List of Pose objects representing the transforms to plot
names List of str required List of strings with one-to-one correspondence to list of poses
tf_scale float optional, default=5.0 Length of transforms' axes
tf_thickness float optional, default=5.0 Thickness of transforms' axes
text_scale float optional, default=5 Font scale of transform name
text_color_rgba list of float optional, default=[1.0, 0.0, 0.0, 1.0] desired RGBA values from 0.0 to 1.0
duration float optional, default=-1.0 Duration (seconds) to plot for

VehicleClient.cancelLastTask()

Cancel previous Async task.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

VehicleClient.waitOnLastTask()

Wait for the last Async task to complete.

Args Type Required or Optional Description
timeout_sec float optional, default=float('nan') Time for the task to complete
Returns Description
bool Result of the last task

CarClient Class

CarClient.__init__()

initializes car client.

Args Type Required or Optional Description
ip str optional, default=''
port int optional, default=41451
timeout_value int optional, default=3600

CarClient.setCarControls(controls)

Control the car using throttle, steering, brake, etc.

Args Type Required or Optional Description
controls CarControls required Struct containing control values
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

CarClient.getCarState():

Get current state of the vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
CarState State the of the vehicle.

CarClient.getCarControls()

Get current control values of the vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
CarControls Struct containing control values of the vehicle.

MultirotorClient Class

By default AirSim uses carrot following algorithm. By default Async methods will start immediately after starting the task.

MultirotorClient.__init__()

initializes multirotor client

Args Type Required or Optional Description
ip str optional, default=''
port int optional, default=41451
timeout_value int optional, default=3600

MultirotorClient.takeoffAsync()

takeoff vehicle to 3m above ground; vehicle should not be moving when this API is used

Args Type Required or Optional Description
timeout_sec int optional, default=20 Takeoff time, in seconds.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.landAsync()

Land the vehicle

Args Type Required or Optional Description
timeout_sec int optional, default=20 Landing time, in seconds.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.goHomeAsync()

Return vehicle to Home i.e. Launch location

Args Type Required or Optional Description
timeout_sec int optional, default=3e38 Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByAngleZAsync(pitch, roll, z, yaw, duration)

Does not work


MultirotorClient.moveByAngleThrottleAsync(pitch, roll, throttle, yaw_rate, duration)

Does not work


MultirotorClient.moveByVelocityAsync(vx, vy, vz, duration)

Move vehicle at desired velocity.AirSim uses carrot following algorithm.

Args Type Required or Optional Description
vx float required Desired velocity in world (NED) X axis
vy float required Desired velocity in world (NED) Y axis
vz float required Desired velocity in world (NED) Z axis
duration float required Amount of time to send this command for , in seocnds
drivetrain DrivetrainType optional, default=MaxDegreeofFreedom more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByVelocityZAsync(vx, vy, z, duration)

Move vehicle at desired velocity (XY only). AirSim uses carrot following algorithm.

Args Type Required or Optional Description
vx float required Desired velocity in world (NED) X axis
vy float required Desired velocity in world (NED) Y axis
z float required Desired position in world (NED) Z axis
duration float required Amount of time to send this command for , in seocnds
drivetrain DrivetrainType optional, default=MaxDegreeofFreedom more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveOnPathAsync(path, velocity) untested

move vehicle along coordinates. This is the highest level of control in AirSim. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
path vector3r required Desired path
velocity float required Desired linear velocity
timeout_sec int optional, default=3e38 Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
drivetrain DrivetrainType optional, default=MaxDegreeofFreedom more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveToPositionAsync(x, y, z, velocity)

Move vehicle to desired position. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
x float required Desired velocity in world (NED) X axis
y float required Desired velocity in world (NED) Y axis
z float required Desired position in world (NED) Z axis
velocity float required Desired linear velocity
timeout_sec int optional, default=3e38 Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
drivetrain DrivetrainType optional, default=MaxDegreeofFreedom more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveToZAsync(z, velocity)

Move vehicle to desired altitude. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
z float required Desired position in world (NED) Z axis
velocity float required Desired linear velocity
timeout_sec int optional, default=3e38 Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
lookahead int optional, default=-1 more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
adaptive_lookahead int optional, default=1 more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByManualAsync(vx_max, vy_max, z_min, duration) untested

Read current RC state and use it to control the vehicles. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
vx_max float required max velocity allowed in X direction
vy_max float required max velocity allowed in Y direction
vz_max float required max velocity allowed in Z direction
z_min float required min z allowed for vehicle position
duration float required after this duration vehicle would switch back to non-manual mode
drivetrain DrivetrainType optional, default=MaxDegreeofFreedom more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode optional, default=YawMode() more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.rotateToYawAsync(yaw)

Change vehicle yaw angle.

Args Type Required or Optional Description
yaw float required Desired yaw angle in world (NED) frame, in degrees
timeout_sec int optional, default=3e38 Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
margin int optional, default=5
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.rotateByYawRateAsync(yaw_rate, duration)

Change vehicle yaw rate.

Args Type Required or Optional Description
yaw_rate float required Desired yaw velocity in world (NED) frame, in degrees per second
duration float required after this duration vehicle would switch back to non-manual mode
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.hoverAsync()

Make vehicle hover.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByRC(rcdata) untested

Move vehicle with remote control. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
rcdata RCData required
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByMotorPWMsAsync(front_right_pwm, rear_left_pwm, front_left_pwm, rear_right_pwm, duration)

Directly control the motors using PWM values. This is the lowest level of control in AirSim. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
front_right_motor float required PWM value for the front right motor (between 0.0 to 1.0)
rear_left_motor float required PWM value for the front right motor (between 0.0 to 1.0)
front_left_motor float required PWM value for the front right motor (between 0.0 to 1.0)
rear_right_motor float required PWM value for the front right motor (between 0.0 to 1.0)
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByRollPitchYawZAsync(roll, pitch, yaw, z, duration)

Move vehicle by rpy angles and altitude, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll float required Desired roll angle, in radians.
pitch float required Desired pitch angle, in radians.
yaw float required Desired yaw angle, in radians.
z float required Desired position in world (NED) Z axis
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByRollPitchYawThrottleAsync(roll, pitch, yaw, throttle, duration)

Move vehicle by rpy angles and throttle, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll float required Desired roll angle, in radians.
pitch float required Desired pitch angle, in radians.
yaw float required Desired yaw angle, in radians.
throttle float required Desired throttle (between 0.0 to 1.0)
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByRollPitchYawrateThrottleAsync(roll, pitch, yaw_rate, throttle, duration)

Move vehicle by angular rates and throttle, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll float required Desired roll angle, in radians.
pitch float required Desired pitch angle, in radians.
yaw_rate float required Desired yaw velocity, in radians per second.
throttle float required Desired throttle (between 0.0 to 1.0)
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByRollPitchYawrateZAsync(roll, pitch, yaw_rate, z, duration)

Move vehicle by angular rates and altitude, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll float required Desired roll angle, in radians.
pitch float required Desired pitch angle, in radians.
yaw_rate float required Desired yaw velocity, in radians per second.
z float required Desired position in world (NED) Z axis
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByAngleRatesZAsync(roll_rate, pitch_rate, yaw_rate, z, duration)

Move vehicle by anuglar rates and altitude, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll_rate float required Desired roll velocity, in radians per second.
pitch_rate float required Desired pitch velocity, in radians per second.
yaw_rate float required Desired yaw velocity, in radians per second.
z float required Desired position in world (NED) Z axis
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.moveByAngleRatesThrottleAsync(roll_rate, pitch_rate, yaw_rate, throttle, duration)

Move vehicle by angular rates and throttle, in body FLU frame. AirSim uses carrot following algorithm.

Args Type Required or Optional Description
roll_rate float required Desired roll velocity, in radians per second.
pitch_rate float required Desired pitch velocity, in radians per second.
yaw_rate float required Desired yaw velocity, in radians per second.
throttle float required Desired throttle (between 0.0 to 1.0)
duration float required Send command for this duration, in seconds
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
msgpackrpc.future.Future use .join() to make the call blocking/wait to finish—client.method().join()

MultirotorClient.setAngleRateControllerGains()

Sets angle gains for ALL move*() APIs.

Args Type Required or Optional Description
angle_rate_gains AngleRateControllerGains optional, default=AngleRateControllerGains() Correspond to the roll, pitch, yaw axes, defined in the body frame.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

MultirotorClient.setAngleLevelControllerGains()

Sets angle level controller gains (used by any API setting angle references - for ex: moveByRollPitchYawZAsync(), moveByRollPitchYawThrottleAsync(), etc)

Args Type Required or Optional Description
angle_rate_gains AngleRateControllerGains optional, default=AngleRateControllerGains() Correspond to the roll, pitch, yaw axes, defined in the body frame.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

MultirotorClient.setVelocityControllerGains()

Sets velocity controller gains for moveByVelocityAsync().

Args Type Required or Optional Description
velocity_gains VelocityControllerGains optional, default=VelocityControllerGains() Correspond to the world X, Y, Z axes.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

MultirotorClient.setPositionControllerGains()

Sets position controller gains for moveByPositionAsync.

Args Type Required or Optional Description
position_gains PositionControllerGains optional, default=PositionControllerGains() Correspond to the world X, Y, Z axes.
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json

MultirotorClient.getMultirotorState()

Gets the current state of vehicle.

Args Type Required or Optional Description
vehicle_name str optional, default='' Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorState State the of the vehicle.