Create an AirSim client to a server on localhost. AirSim serves as a factory for Vehicles, (e.g., Car, Multirotor) hosted in an AirSim environment. When constructing a new AirSim client instance you must provide the class of Vehicle hosted by AirSim.
new AirSim(Vehicle);
new AirSim(Car, 80);
The type of vehicle hosted by the AirSim server
Optional
port: numberThe AirSim server port number, default = 41451
Create an AirSim client to a server on host at ipAddress with default port, 41451. AirSim serves as a factory for Vehicles, (e.g., Car, Multirotor) hosted in an AirSim environment. When constructing a new AirSim client instance you must provide the class of Vehicle hosted by AirSim.
new AirSim(Vehicle);
new AirSim(Multirotor, '127.0.0.1');
new AirSim(Car, 'localhost');
The type of vehicle hosted by the AirSim server
Optional
ipAddress: stringCreate an AirSim client to a server on host ip:port. AirSim serves as a factory for Vehicles, (e.g., Car, Multirotor) hosted in an AirSim environment. When constructing a new AirSim client instance you must provide the class of Vehicle hosted by AirSim.
new AirSim(Vehicle);
new AirSim(Multirotor, 80);
new AirSim(Car, 80, '127.0.0.1');
The type of vehicle hosted by the AirSim server
Optional
port: numberThe AirSim server port number, default = 41451
Optional
ipAddress: stringPrivate
_ipPrivate
_portPrivate
_sessionPrivate
_vehiclesAccess the Session with an AirSim server.
Use hasSession()
if you are not sure if the
session has been created.
Error - When no session exists.
Create vehicle at runtime
Promise
Initial pose of the vehicle
Clear a detection search
A Promise
Clear any persistent markers from being displayed,
i.e., those plotted with parameter isPersistent=true
A Promise
Close and shutdown the AirSim session.
Checks state of connection and reports in Console so user can see the progress for connection.
Create a network connection to an AirSim server.
Promise
Continue (or resume if paused) the simulation for the specified number of frames, after which the simulation will be paused.
A Promise
Frames to run the simulation for
Continue the simulation for the specified number of seconds
A Promise
Time (seconds) to run the simulation
Delete an object from the AirSim server environment.
Promise
Name of object to delete
Disable Weather effects. Needs to be called before using setWeatherParameter
API
A Promise
Enable Weather effects. Needs to be called before using setWeatherParameter()
API
A Promise
Find the detections in the camera field of view defined by the search details
Array of object detections
The name of the assets that make up the scene.
An array of asset names.
Get details about the external camera.
Note if the cameraName is unknown to airsim, the server may crash.
A CameraInfo promise
Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used
Get the client version number, an increaing sequence 1, 2, 3, ...
The client version number.
Get a single image
Uint8Array of compressed png image
Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used
Type of image required
Get images from 1 or more cameras. See https://microsoft.github.io/AirSim/image_apis/ for details and examples
The ImageResponse(s)
Images required
Get the lowest compatible client version.
The minimum compatible client version.
Get the lowest compatible server version.
The minimum compatible server version.
Get the pose of a simulation object in the world frame.
The pose
The name of the object who's pose is being requested.
Gets scale of an object in the world frame
The object scale
Object to get the scale of
Get a listing of the names of all objects that makeup the AirSim seem.
An array of object names.
A regex for filtering the names.
Get the AirSim server version number, an increaing sequence 1, 2, 3, ...
The server version number.
Get a JSON string of the AirSim server settings.
A JSON string.
Access a vehicle instance by name.
The vehicle
The name of the vehicle.
Lists the names of vehicles in the simulation.
List containing names of all vehicles
Test if a Session with an AirSim server exists.
True if session exists.
Protected
initInitialize the internal state such as cache vehicles from an AirSim server.
Returns true if the simulation is paused
A Promise
Pauses simulation execution. Use resume() to continue.
A Promise
Ensure the AirSim server is reachable and active to respond to api requests.
Promise
Plot an arrow in World NED frame.
A Promise
The 3D start positions of arrow, specified as Vector3 objects
The 3D end position of arrow, specified as Vector3 objects
Line color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Thickness of line. Default = 5.0.
Size of arrow head. Default = 2.0.
Duration (seconds) to display arrows or True to display indefinetly. Default = True.
Plots a list of arrow 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]
A Promise
Line color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Thickness of line. Default = 5.0.
Size of arrow head. Default = 2.0.
Duration (seconds) to display arrows or True to display indefinetly. Default = True.
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]
A Promise
Line color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Thickness of line. Default = 5.0.
Duration (seconds) to display lines or True to display indefinetly. Default = True.
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]
A Promise
List of 3D locations of line start and end points, specified as Vector3r objects. Must be even
Line color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Thickness of line. Default = 5.0.
Duration (seconds) to display lines or True to display indefinetly. Default = True.
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]
A Promise
Array of 3D locations of line start and end points, specified as Vector3r objects
Line color as RGBA tuple of 0.0 to 1.0 values or CSS color name. Default = 'red'.
Thickness of line. Default = 5.
Duration (seconds) to display line-strip or True to display indefinetly. Default = true.
Plot a 3D point in World NED frame
A Promise
A Vector3 object
Color of points as an RGBA tuple with value 0.0 to 1.0 or CSS color name, Default = 'red'.
Size of plotted point. Default = 10.
Duration (seconds) to display points or True to display indefinetly. Default = True.
Plot a list of 3D points in World NED frame
A Promise
List of Vector3 objects
Color of points as an RGBA tuple with value 0.0 to 1.0 or CSS color name, Default = 'red'.
Size of plotted point. Default = 10.
Duration (seconds) to display points or True to display indefinetly. Default = True.
Plot a string at desired position in World NED frame.
A Promise
The position where the strings should be plotted.
Font scale of transform name. Default = 5.
Text color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Duration (seconds) to display strings or True to display indefinetly. Default = True.
Plots a list of strings at desired positions in World NED frame.
A Promise
List of strings to plot
List of positions where the strings should be plotted. Should be in one-to-one correspondence with the strings' list
Font scale of transform name. Default = 5.
Text color as RGBA tuple of values from 0.0 to 1.0 or CSS color name. Default = 'red'.
Duration (seconds) to display strings or True to display indefinetly. Default = True.
Plots a transform in World NED frame.
A Promise
Pose object representing the transforms to plot
Length of transform axes. Default = 5.
Thickness of transform axes. Default = 5.0.
Duration (seconds) to display transform or True to display indefinetly. Default = True.
Plots a list of transforms in World NED frame.
A Promise
Pose objects representing the transforms to plot
Length of transforms' axes. Default = 5.
Thickness of transforms' axes. Default = 5.0.
Duration (seconds) to display transform or True to display indefinetly. Default = True.
Plots a list of transforms with their names in World NED frame.
A Promise
Pose objects representing the transforms to plot
Strings with one-to-one correspondence to list of poses
Length of transforms' axes. Default = 5.0.
Thickness of transforms' axes. Default = 5.0.
Font scale of transform name. Default = 10. *
Color of transform name as RGBA tuple
Duration (seconds) to display transforms or True to display indefinetly. Default = True.
Prints the specified message in the simulator's window.
If messageParam is supplied, then it's printed next to the message
and in that case if this API is called with same message value
but different messageParam again then previous line is overwritten
with new line (instead of API creating new line on display).
For example, printLogMessage("Iteration: ", i.toString())
keeps updating same line on display when API is called with different
values of i. The valid values of severity parameter corresponds
to different colors.
A Promise
Message to be printed
Parameter to be printed next to the message
The severity level of the message
Reset the vehicle to its original starting state
Note that you must call enableApiControl()
and arm()
again after the call to reset
A Promise
Resume simulation execution.
A Promise
Allows the client to execute a command in Unreal's native console, via an API. Affords access to the countless built-in commands such as "stat unit", "stat fps", "open [map]", adjust any config settings, etc. Allows the user to create bespoke APIs very easily, by adding a custom event to the level blueprint, and then calling the console command "ce MyEventName [args]". No recompilation of AirSim needed!
Promise
Unreal Engine Console command to run
Control the field of view of a selected camera
A Promise
Name of the camera to be controlled
Value of field of view in degree
Control the pose of a selected camera
A Promise
Name of the camera to be controlled
Pose representing the desired position and orientation of the camera
Change intensity of named light
Promise
Name of light to change
New intensity value [0-1]
Set the pose of the object(actor) in the environment The specified actor must have Mobility set to movable, otherwise there will be undefined behaviour. @ see
for details on how to set Mobility and the effect of Teleport parameter
Promise
Name of the object(actor) to move
Desired Pose of the object
Whether to move the object immediately without affecting their velocity
Sets scale of an object in the world frame
Promise
Object to set the scale of
Desired scale of object
Control the position of Sun in the environment.
The Sun's position is computed using the coordinates
specified in OriginGeopoint
in settings for the
date-time specified in the argument, else if the
string is empty, current date & time is used
A Promise
True to enable time-of-day effect, False to reset the position to original
Date & Time in %Y-%m-%d %H:%M:%S format, e.g. 2018-02-12 15:20:00
True to adjust for Daylight Savings Time
Run celestial clock faster or slower than simulation clock E.g. Value 100 means for every 1 second of simulation clock, Sun's position is advanced by 100 seconds so Sun will move in sky much faster
Interval to update the Sun's position
Whether or not to move the Sun
Enable various weather effects
A Promise
Weather effect to be enabled
Intensity of the effect, Range 0-1
Set simulated wind, in World frame, NED direction, m/s
A Promise
Wind, in World frame, NED direction, in m/s
Spawn a new instance of an existing sim object
Name of spawned object, in case it had to be modified
Desired name of new object
Name of asset(mesh) in the project database
Desired pose of object
Desired scale of object
Whether to enable physics for the object
Whether to spawn a blueprint or an actor
Configure a camera to perform a computer vision search and detection of specific mesh object(s).
A Promise
Example for detecting all instances named "Car_*"
startDetectionSearch(
{
camera: 'front_center',
image_type: ImageType.Scene,
meshName: 'Car_*'
}
);
The search details
Returns whether the target point is visible from the perspective of the source point
True if success; false otherwise
https://microsoft.github.io/AirSim/apis/ https://github.com/microsoft/AirSim/blob/master/PythonClient/airsim/client.py