VehicleClient

class airgen.client.VehicleClient(ip='', port=41451, timeout_value=3600, geo=False, run_in_background=False)

Bases: object

Parameters:
  • geo (bool)

  • run_in_background (bool)

armDisarm(arm, vehicle_name='')

Arms or disarms vehicle

Parameters:
  • arm (bool) -- True to arm, False to disarm the vehicle

  • vehicle_name (str, optional) -- Name of the vehicle to send this command to

Returns:

Success

Return type:

bool

confirmConnection()

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

enableApiControl(is_enabled, vehicle_name='')

Enables or disables API control for vehicle corresponding to vehicle_name

Parameters:
  • is_enabled (bool) -- True to enable, False to disable API control

  • vehicle_name (str, optional) -- Name of the vehicle to send this command to

getBarometerData(barometer_name='', vehicle_name='')
Parameters:
  • barometer_name (str, optional) -- Name of Barometer to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

BarometerData

getClientVersion()
getDistanceSensorData(distance_sensor_name='', vehicle_name='')
Parameters:
  • distance_sensor_name (str, optional) -- Name of Distance Sensor to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

DistanceSensorData

getGpsData(gps_name='', vehicle_name='')
Parameters:
  • gps_name (str, optional) -- Name of GPS to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

GpsData

getHomeGeoPoint(vehicle_name='')

Get the Home location of the vehicle

Parameters:

vehicle_name (str, optional) -- Name of vehicle to get home location of

Returns:

Home location of the vehicle

Return type:

GeoPoint

getImages(camera_name, image_types, vehicle_name='')

Get multiple images

Parameters:
  • camera_name (str) -- Name of camera to obtain images from

  • image_types (list[ImageType]) -- Images required

  • vehicle_name (str, optional) -- Name of vehicle associated with the camera

Return type:

list[ImageResponse]

getImuData(imu_name='', vehicle_name='')
Parameters:
  • imu_name (str, optional) -- Name of IMU to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

ImuData

getLidarData(lidar_name='', vehicle_name='')
Parameters:
  • lidar_name (str, optional) -- Name of Lidar to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

LidarData

getMagnetometerData(magnetometer_name='', vehicle_name='')
Parameters:
  • magnetometer_name (str, optional) -- Name of Magnetometer to get data from, specified in settings.json

  • vehicle_name (str, optional) -- Name of vehicle to which the sensor corresponds to

Return type:

MagnetometerData

getMinRequiredClientVersion()
getMinRequiredServerVersion()
getNavMeshInfo()

Get NavMesh information, as an array of XYZ center, min and max values in global NED coordinates

Parameters:

None

Returns:

List of values if successful, else empty list

Return type:

list[Vector3r]

getServerVersion()
getSettingsString()

Fetch the settings text being used by airgen

Returns:

Settings text in JSON format

Return type:

str

isAnyPointInCollisionBatch(points)

Get Collision information about an array of points. Returns True if any of the points is in collision, else False

Parameters:

points (list[Vector3r]) -- List of points to be checked in airgen coordinates

Returns:

True if any of the points is in collision, else False

Return type:

bool

isApiControlEnabled(vehicle_name='')

Returns true if API control is established.

If false (which is default) then API calls would be ignored. After a successful call to enableApiControl, isApiControlEnabled should return true.

Parameters:

vehicle_name (str, optional) -- Name of the vehicle

Returns:

If API control is enabled

Return type:

bool

isPointInCollision(point)

Get Collision information about a point. Returns True if point is in collision, else False

Parameters:

point (Vector3r) -- Point to be checked in airgen coordinates

Returns:

True if point is in collision, else False

Return type:

bool

isRecording()

Whether Recording is running or not

Returns:

True if Recording, else False

Return type:

bool

listVehicles()

Lists the names of current vehicles

Returns:

List containing names of all vehicles

Return type:

list[str]

ping()

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

Return type:

bool

reset()

Reset the vehicle to its original starting state

Note that you must call enableApiControl and armDisarm again after the call to reset

simAddDetectionFilterMeshName(camera_name, image_type, mesh_name, vehicle_name='', external=False)

Add mesh name to detect in wild card format

For example: simAddDetectionFilterMeshName("Car_*") will detect all instance named "Car_*"

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • image_type (ImageType) -- Type of image required

  • mesh_name (str) -- mesh name in wild card format

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

simAddMeshFromPath(object_name, path, pose, scale, physics_enabled=False)

Spawned selected object in the world

Parameters:
  • object_name (str) -- Desired name of new object

  • asset_name (str) -- Name of asset(mesh) in the project database

  • pose (airgen.Pose) -- Desired pose of object

  • scale (airgen.Vector3r) -- Desired scale of object

  • physics_enabled (bool, optional) -- Whether to enable physics for the object

  • is_blueprint (bool, optional) -- Whether to spawn a blueprint or an actor

Returns:

True if object was spawned, False otherwise

Return type:

bool

simAddVehicle(vehicle_name, vehicle_type, pose, pawn_path='')

Create vehicle at runtime

Parameters:
  • vehicle_name (str) -- Name of the vehicle being created

  • vehicle_type (str) -- Type of vehicle, e.g. "simpleflight"

  • pose (Pose) -- Initial pose of the vehicle

  • pawn_path (str, optional) -- Vehicle blueprint path, default empty wbich uses the default blueprint for the vehicle type

Returns:

Whether vehicle was created

Return type:

bool

simBuildSDF(position, x, y, z, res)

Construct a signed distance field of the environment centered at position, and with dimensions (x, y, z). Internally, the SDF is stored as a special case of a voxel grid with floating point distances instead of boolean occupancy.

Parameters:
  • position (Vector3r) -- Global position around which field is centered in m

  • x (float) -- Size of distance field dimensions in m

  • y (float) -- Size of distance field dimensions in m

  • z (float) -- Size of distance field dimensions in m

  • res (float) -- Resolution of distance field in m

simCameraLookAt(camera_name, pose, vehicle_name='')
  • Control the pose of a selected camera

Parameters:
  • camera_name (str) -- Name of the camera to be controlled

  • pose (Pose) -- Pose representing the desired position the camera has to observe

  • vehicle_name (str, optional) -- Name of vehicle which the camera corresponds to

  • external (bool, optional) -- Whether the camera is an External Camera

simCheckInVolume(position, volume_object_name)

Check if a point is inside a volume.

Parameters:
  • position (Vector3r) -- Global position at which volume is to be checked (m)

  • volume_object_name (str) -- Name of the volume object

simCheckOccupancy(position)

Check and return occupancy of a point. Requires signed distance field to be built beforehand.

Parameters:

position (Vector3r) -- Global position at which occupancy is to be checked (m)

simClearDetectionMeshNames(camera_name, image_type, vehicle_name='', external=False)

Clear all mesh names from detection filter

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • image_type (ImageType) -- Type of image required

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

simContinueForFrames(frames)

Continue (or resume if paused) the simulation for the specified number of frames, after which the simulation will be paused.

Parameters:

frames (int) -- Frames to run the simulation for

simContinueForTime(seconds)

Continue the simulation for the specified number of seconds

Parameters:

seconds (float) -- Time to run the simulation for

simCreateVoxelGrid(position, x, y, z, res, of)

Construct and save a binvox-formatted voxel grid of environment

Parameters:
  • position (Vector3r) -- Position around which voxel grid is centered in m

  • x (int) -- Size of each voxel grid dimension in m

  • y (int) -- Size of each voxel grid dimension in m

  • z (int) -- Size of each voxel grid dimension in m

  • res (float) -- Resolution of voxel grid in m

  • of (str) -- Name of output file to save voxel grid as

Returns:

True if output written to file successfully, else False

Return type:

bool

simDestroyObject(object_name)

Removes selected object from the world

Parameters:

object_name (str) -- Name of object to be removed

Returns:

True if object is queued up for removal

Return type:

bool

simEnableFocusPlane(enable, camera_name, vehicle_name='', external=False)
simEnableManualFocus(enable, camera_name, vehicle_name='', external=False)
simEnableWeather(enable)

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

Parameters:

enable (bool) -- True to enable, False to disable

simFlushPersistentMarkers()

Clear any persistent markers - those plotted with setting is_persistent=True in the APIs below

simGetCameraInfo(camera_name, vehicle_name='', external=False)

Get details about the camera

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

Return type:

CameraInfo

simGetCollisionInfo(vehicle_name='')
Parameters:

vehicle_name (str, optional) -- Name of the Vehicle to get the info of. This call will also reset the collision info (state of the vehicle) to False.

Return type:

CollisionInfo

simGetCurrentFieldOfView(camera_name, vehicle_name='', external=False)
simGetDetections(camera_name, image_type, vehicle_name='', external=False)

Get current detections

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • image_type (ImageType) -- Type of image required

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

Returns:

DetectionInfo array

simGetDistortionParams(camera_name, vehicle_name='', external=False)

Get camera distortion parameters

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

Returns:

List of distortion parameter values corresponding to K1, K2, K3, P1, P2 respectively.

Return type:

List (float)

simGetFilmbackSettings(camera_name, vehicle_name='', external=False)
simGetFocalLength(camera_name, vehicle_name='', external=False)
simGetFocusAperture(camera_name, vehicle_name='', external=False)
simGetFocusDistance(camera_name, vehicle_name='', external=False)
simGetGroundTruthEnvironment(vehicle_name='')

Get ground truth environment state

The position inside the returned EnvironmentState is in the frame of the vehicle's starting point

Parameters:

vehicle_name (str, optional) -- Name of the vehicle

Returns:

Ground truth environment state

Return type:

EnvironmentState

simGetGroundTruthKinematics(vehicle_name='')

Get Ground truth kinematics of the vehicle

The position inside the returned KinematicsState is in the frame of the vehicle's starting point

Parameters:

vehicle_name (str, optional) -- Name of the vehicle

Returns:

Ground truth of the vehicle

Return type:

KinematicsState

simGetImage(camera_name, image_type, vehicle_name='', external=False)

Get a single image

Returns bytes of png format image which can be dumped into abinary file to create .png image string_to_uint8_array() can be used to convert into Numpy unit8 array

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • image_type (ImageType) -- Type of image required

  • vehicle_name (str, optional) -- Name of the vehicle with the camera

  • external (bool, optional) -- Whether the camera is an External Camera

Returns:

Binary string literal of compressed png image

simGetImages(requests, vehicle_name='', external=False)

Get multiple images

Parameters:
  • requests (list[ImageRequest]) -- Images required

  • vehicle_name (str, optional) -- Name of vehicle associated with the camera

  • external (bool, optional) -- Whether the camera is an External Camera

Return type:

list[ImageResponse]

simGetImagesAlongTrajectory(poses, requests, vehicle_name='', external=False)

Get images along a trajectory (specified by position and pose) when

Parameters:
  • poses (list[Pose]) -- A list of poses of the vehicle, at which images are to be requested

  • requests (list[ImageRequest]) -- Images required

  • vehicle_name (str, optional) -- Name of vehicle associated with the camera

  • external (bool, optional) -- Whether the camera is an External Camera, defaults to False

Return type:

list[ImageResponse]

simGetLensSettings(camera_name, vehicle_name='', external=False)

Get the lens settings for the camera

Parameters:
  • camera_name (str) -- camera name

  • vehicle_name (str, optional) -- vechile name. Defaults to "".

  • external (bool, optional) -- Whether the camera is an External Camera. Defaults to False.

simGetLidarSegmentation(lidar_name='', vehicle_name='')

NOTE: Deprecated API, use getLidarData() API instead Returns Segmentation ID of each point's collided object in the last Lidar update

Parameters:
  • lidar_name (str, optional) -- Name of Lidar sensor

  • vehicle_name (str, optional) -- Name of the vehicle wth the sensor

Returns:

Segmentation IDs of the objects

Return type:

list[int]

simGetMeshPositionVertexBuffers()

Returns the static meshes that make up the scene

Return type:

list[MeshPositionVertexBuffersResponse]

simGetObjectCenter(object_name)

Gets the center of an object in the world

Parameters:

object_name (str) -- Object to get the center of

Returns:

Center position

Return type:

airgen.Vector3r

simGetObjectDimensions(object_name)

Gets bounds of an object in the world

Parameters:

object_name (str) -- Object to get the bounds of

Returns:

Extents in X, Y, Z

Return type:

airgen.Vector3r

simGetObjectPose(object_name)

The position inside the returned Pose is in the world frame

Parameters:

object_name (str) -- Object to get the Pose of

Return type:

Pose

simGetObjectScale(object_name)

Gets scale of an object in the world

Parameters:

object_name (str) -- Object to get the scale of

Returns:

Scale

Return type:

airgen.Vector3r

simGetPresetFilmbackSettings(camera_name, vehicle_name='', external=False)
simGetPresetLensSettings(camera_name, vehicle_name='', external=False)

Get the preset lens settings for the camera

Parameters:
  • camera_name (str) -- camera name

  • vehicle_name (str, optional) -- vechile name. Defaults to "".

  • external (bool, optional) -- Whether the camera is an External Camera. Defaults to False.

Returns:

_description_

Return type:

_type_

simGetRandomFreePoint(search_radius)

Return a random free (unoccupied) point within a radius around the vehicle.

Parameters:

search_radius (float) -- Radius around the vehicle to search for a free point in m

Returns:

Free/unoccupied point coordinates if successful, else None

Return type:

Vector3r/None

simGetSDFGradient(position)

Get the SDF gradient at a point (vector pointing away from the closest 'object surface') in the environment. Requires signed distance field to be built beforehand.

Parameters:

position (Vector3r) -- Global position at which gradient is to be computed (m)

Returns:

SDF gradient at the position

Return type:

gradient (Vector3r)

simGetSegmentationObjectID(mesh_name)

Returns Object ID for the given mesh name (case-sensitive)

Parameters:

mesh_name (str) -- Name of the mesh to get the ID of

simGetSignedDistance(position)

Get signed distance of a point (distance to the closest 'object surface') in the environment. Requires signed distance field to be built beforehand.

Distance is positive if the point is in free space, and negative if the point is inside an object.

Parameters:

position (Vector3r) -- Global position at which distance is to be computed (m)

Returns:

dist (float)

simGetSignedDistances(positions)

Get signed distance of a list of points (distance to the closest 'object surface') in the environment. Requires signed distance field to be built beforehand.

Distance is positive if the point is in free space, and negative if the point is inside an object.

Parameters:

positions (list) -- List of global positions at which distance is to be computed (m)

Returns:

dists (list)

simGetVehiclePose(vehicle_name='')

The position inside the returned Pose is in the frame of the vehicle's starting point

Parameters:

vehicle_name (str, optional) -- Name of the vehicle to get the Pose of

Return type:

Pose

simGetWorldExtents()

Returns a list of GeoPoints representing the minimum and maximum extents of the world

Returns:

list[GeoPoint]

simIsPause()

Returns true if the simulation is paused

Returns:

If the simulation is paused

Return type:

bool

simListAssets()

Lists all the assets present in the Asset Registry

Returns:

Names of all the assets

Return type:

list[str]

simListSceneObjects(name_regex='.*')

Lists the objects present in the environment

Default behaviour is to list all objects, regex can be used to return smaller list of matching objects or actors

Parameters:

name_regex (str, optional) -- String to match actor names against, e.g. "Cylinder.*"

Returns:

List containing all the names

Return type:

list[str]

simLoadLevel(level_name)

Loads a level specified by its name

Parameters:

level_name (str) -- Name of the level to load

Returns:

True if the level was successfully loaded

Return type:

bool

simLoadSDF(filepath)

Load a saved signed distance field.

Parameters:

filepath (str) -- Filename to load the SDF from

simPause(is_paused)

Pauses simulation

Parameters:

is_paused (bool) -- True to pause the simulation, False to release

simPlanPath(start, goal, smooth_path, draw_path)

Plan a collision-free path between start and goal points and return the intermediate waypoints.

Parameters:
  • start (Vector3r) -- Start position in airgen coordinates

  • goal (Vector3r) -- Goal position in airgen coordinates

  • smooth_path (bool) -- Returns a smooth spline if True, else returns a list of coarse waypoints

  • draw_path (bool) -- Draws the path in the Unreal environment if True

Returns:

List of waypoints if successful, else empty list

Return type:

list[Vector3r]

simPlanPathToRandomFreePoint(search_radius, smooth_path, draw_path)

Plan a collision-free path to a random point within a radius around the vehicle and return the intermediate waypoints.

Parameters:
  • search_radius (float) -- Radius around the vehicle to search for a free point in m

  • smooth_path (bool) -- Returns a smooth spline if True, else returns a list of coarse waypoints

  • draw_path (bool) -- Draws the path in the Unreal environment if True

Returns:

List of waypoints if successful, else empty list

Return type:

list[Vector3r]

simPlanPathToRandomizeGoal(start, goal, search_radius, num_trials, smooth_path, draw_path)

Plan a collision-free path from the current position to a random point within a radius around the goal and return the intermediate waypoints.

Parameters:
  • start (Vector3r) -- Start position in airgen coordinates

  • goal (Vector3r) -- Goal position in airgen coordinates

  • search_radius (float) -- Radius around the vehicle to search for a free point in m

  • num_trials (int) -- number of random points to query for a free point

  • smooth_path (bool) -- Returns a smooth spline if True, else returns a list of coarse waypoints

  • draw_path (bool) -- Draws the path in the Unreal environment if True

Returns:

List of waypoints if successful, else empty list

Return type:

list[Vector3r]

simPlotArrows(points_start, points_end, color_rgba=[1.0, 0.0, 0.0, 1.0], thickness=5.0, arrow_size=2.0, duration=-1.0, is_persistent=False)

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]

Parameters:
  • points_start (list[Vector3r]) -- List of 3D start positions of arrow start positions, specified as Vector3r objects

  • points_end (list[Vector3r]) -- List of 3D end positions of arrow start positions, specified as Vector3r objects

  • color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0

  • thickness (float, optional) -- Thickness of line

  • arrow_size (float, optional) -- Size of arrow head

  • duration (float, optional) -- Duration (seconds) to plot for

  • is_persistent (bool, optional) -- If set to True, the desired object will be plotted for infinite time.

simPlotLineList(points, color_rgba=[1.0, 0.0, 0.0, 1.0], thickness=5.0, duration=-1.0, is_persistent=False)

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]

Parameters:
  • points (list[Vector3r]) -- List of 3D locations of line start and end points, specified as Vector3r objects. Must be even

  • color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0

  • thickness (float, optional) -- Thickness of line

  • duration (float, optional) -- Duration (seconds) to plot for

  • is_persistent (bool, optional) -- If set to True, the desired object will be plotted for infinite time.

simPlotLineStrip(points, color_rgba=[1.0, 0.0, 0.0, 1.0], thickness=5.0, duration=-1.0, is_persistent=False)

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]

Parameters:
  • points (list[Vector3r]) -- List of 3D locations of line start and end points, specified as Vector3r objects

  • color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0

  • thickness (float, optional) -- Thickness of line

  • duration (float, optional) -- Duration (seconds) to plot for

  • is_persistent (bool, optional) -- If set to True, the desired object will be plotted for infinite time.

simPlotPoints(points, color_rgba=[1.0, 0.0, 0.0, 1.0], size=10.0, duration=-1.0, is_persistent=False)

Plot a list of 3D points in World NED frame

Parameters:
  • points (list[Vector3r]) -- List of Vector3r objects

  • color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0

  • size (float, optional) -- Size of plotted point

  • duration (float, optional) -- Duration (seconds) to plot for

  • is_persistent (bool, optional) -- If set to True, the desired object will be plotted for infinite time.

simPlotStrings(strings, positions, scale=5, color_rgba=[1.0, 0.0, 0.0, 1.0], duration=-1.0)

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

Parameters:
  • strings (list[String], optional) -- List of strings to plot

  • positions (list[Vector3r]) -- List of positions where the strings should be plotted. Should be in one-to-one correspondence with the strings' list

  • scale (float, optional) -- Font scale of transform name

  • color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0

  • duration (float, optional) -- Duration (seconds) to plot for

simPlotTransforms(poses, scale=5.0, thickness=5.0, duration=-1.0, is_persistent=False)

Plots a list of transforms in World NED frame.

Parameters:
  • poses (list[Pose]) -- List of Pose objects representing the transforms to plot

  • scale (float, optional) -- Length of transforms' axes

  • thickness (float, optional) -- Thickness of transforms' axes

  • duration (float, optional) -- Duration (seconds) to plot for

  • is_persistent (bool, optional) -- If set to True, the desired object will be plotted for infinite time.

simPlotTransformsWithNames(poses, names, tf_scale=5.0, tf_thickness=5.0, text_scale=10.0, text_color_rgba=[1.0, 0.0, 0.0, 1.0], duration=-1.0)

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

Parameters:
  • poses (list[Pose]) -- List of Pose objects representing the transforms to plot

  • names (list[string]) -- List of strings with one-to-one correspondence to list of poses

  • tf_scale (float, optional) -- Length of transforms' axes

  • tf_thickness (float, optional) -- Thickness of transforms' axes

  • text_scale (float, optional) -- Font scale of transform name

  • text_color_rgba (list, optional) -- desired RGBA values from 0.0 to 1.0 for the transform name

  • duration (float, optional) -- Duration (seconds) to plot for

simPrintLogMessage(message, message_param='', severity=0)

Prints the specified message in the simulator's window.

If message_param 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 message_param again then previous line is overwritten with new line (instead of API creating new line on display).

For example, simPrintLogMessage("Iteration: ", to_string(i)) keeps updating same line on display when API is called with different values of i. The valid values of severity parameter is 0 to 3 inclusive that corresponds to different colors.

Parameters:
  • message (str) -- Message to be printed

  • message_param (str, optional) -- Parameter to be printed next to the message

  • severity (int, optional) -- Range 0-3, inclusive, corresponding to the severity of the message

simProjectToFreeSpace(position, mindist)

Project a given point into free space using the SDF, with a specified minimum clearance from existing objects. Returns the same point if the point is already free, else follows the SDF gradient to find a free point that satisfies the minimum distance constraint.

Parameters:
  • position (Vector3r) -- Global position to project (m)

  • mindist (float) -- Minimum distance from objects to satisfy when finding the free point

Returns:

Projected position in free space

Return type:

free_pt (Vector3r)

simRunConsoleCommand(command)

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. 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 airgen needed!

Parameters:

command ([string]) -- Desired Unreal Engine Console command to run

Returns:

Success

Return type:

[bool]

simSaveSDF(filepath)

Save the constructed signed distance field to a file.

Parameters:

filepath (str) -- Filename to save the SDF to

simSetCameraFov(camera_name, fov_degrees, vehicle_name='', external=False)
  • Control the field of view of a selected camera

Parameters:
  • camera_name (str) -- Name of the camera to be controlled

  • fov_degrees (float) -- Value of field of view in degrees

  • vehicle_name (str, optional) -- Name of vehicle which the camera corresponds to

  • external (bool, optional) -- Whether the camera is an External Camera

simSetCameraPose(camera_name, pose, vehicle_name='', external=False)
  • Control the pose of a selected camera

Parameters:
  • camera_name (str) -- Name of the camera to be controlled

  • pose (Pose) -- Pose representing the desired position and orientation of the camera

  • vehicle_name (str, optional) -- Name of vehicle which the camera corresponds to

  • external (bool, optional) -- Whether the camera is an External Camera

simSetDetectionFilterRadius(camera_name, image_type, radius_cm, vehicle_name='', external=False)

Set detection radius for all cameras

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • image_type (ImageType) -- Type of image required

  • radius_cm (int) -- Radius in [cm]

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

simSetDistortionParam(camera_name, param_name, value, vehicle_name='', external=False)

Set single camera distortion parameter

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • param_name (str) -- Name of distortion parameter

  • value (float) -- Value of distortion parameter

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

simSetDistortionParams(camera_name, distortion_params, vehicle_name='', external=False)

Set camera distortion parameters

Parameters:
  • camera_name (str) -- Name of the camera, for backwards compatibility, ID numbers such as 0,1,etc. can also be used

  • distortion_params (dict) -- Dictionary of distortion param names and corresponding values {"K1": 0.0, "K2": 0.0, "K3": 0.0, "P1": 0.0, "P2": 0.0}

  • vehicle_name (str, optional) -- Vehicle which the camera is associated with

  • external (bool, optional) -- Whether the camera is an External Camera

simSetFilmbackSettings(sensor_width, sensor_height, camera_name, vehicle_name='', external=False)
simSetFocalLength(focal_length, camera_name, vehicle_name='', external=False)
simSetFocusAperture(focus_aperture, camera_name, vehicle_name='', external=False)
simSetFocusDistance(focus_distance, camera_name, vehicle_name='', external=False)
simSetGeoReference(geopoint)

Set the geo reference of the scene (only valid for Cesium)

Parameters:

geopoint (GeoPoint) -- Desired GeoPoint of the scene

simSetKinematics(state, ignore_collision, vehicle_name='')

Set the kinematics state of the vehicle

If you don't want to change position (or orientation) then just set components of position (or orientation) to floating point nan values

Parameters:
  • state (KinematicsState) -- Desired Pose pf the vehicle

  • ignore_collision (bool) -- Whether to ignore any collision or not

  • vehicle_name (str, optional) -- Name of the vehicle to move

simSetLightIntensity(light_name, intensity)

Change intensity of named light

Parameters:
  • light_name (str) -- Name of light to change

  • intensity (float) -- New intensity value

Returns:

True if successful, otherwise False

Return type:

bool

simSetObjectGeoPose(object_name, geopose, teleport=True)

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 https://www.unrealengine.com/en-US/blog/moving-physical-objects for details on how to set Mobility and the effect of Teleport parameter

Parameters:
  • object_name (str) -- Name of the object(actor) to move

  • pose (Pose) -- Desired Pose of the object

  • teleport (bool, optional) -- Whether to move the object immediately without affecting their velocity

Returns:

If the move was successful

Return type:

bool

simSetObjectMaterial(object_name, material_name, component_id=0)

Runtime Swap Texture API :param object_name: name of object to set material for :type object_name: str :param material_name: name of material to set for object :type material_name: str :param component_id: index of material elements :type component_id: int, optional

Returns:

True if material was set

Return type:

bool

simSetObjectMaterialFromTexture(object_name, texture_path, component_id=0)

Runtime Swap Texture API :param object_name: name of object to set material for :type object_name: str :param texture_path: path to texture to set for object :type texture_path: str :param component_id: index of material elements :type component_id: int, optional

Returns:

True if material was set

Return type:

bool

simSetObjectPose(object_name, pose, teleport=True)

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 https://www.unrealengine.com/en-US/blog/moving-physical-objects for details on how to set Mobility and the effect of Teleport parameter

Parameters:
  • object_name (str) -- Name of the object(actor) to move

  • pose (Pose) -- Desired Pose of the object

  • teleport (bool, optional) -- Whether to move the object immediately without affecting their velocity

Returns:

If the move was successful

Return type:

bool

simSetObjectScale(object_name, scale_vector)

Sets scale of an object in the world

Parameters:
  • object_name (str) -- Object to set the scale of

  • scale_vector (airgen.Vector3r) -- Desired scale of object

Returns:

True if scale change was successful

Return type:

bool

simSetPresetFilmbackSettings(preset_filmback_settings, camera_name, vehicle_name='', external=False)
simSetPresetLensSettings(preset_lens_settings, camera_name, vehicle_name='', external=False)
Parameters:
  • camera_name (str)

  • vehicle_name (str)

simSetSegmentationInstanceID(mesh_name, instance_id, is_name_regex=False)

Set segmentation ID for specific instances

Parameters:
  • mesh_name (str) -- Name of the mesh to set the ID of (supports regex)

  • instance_id (int) -- start of instance ID to be set, range 0-255. Gets incremented each time for each instance (mesh)

  • is_name_regex (bool, optional) -- Whether the mesh name is a regex

Returns:

number of instances (meshes) matched with mesh_id updated

Return type:

int

simSetSegmentationObjectID(mesh_name, object_id, is_name_regex=False)

Set segmentation ID for specific objects

Parameters:
  • mesh_name (str) -- Name of the mesh to set the ID of (supports regex)

  • object_id (int) -- Object ID to be set, range 0-255.

  • is_name_regex (bool, optional) -- Whether the mesh name is a regex. If True, all meshes matching the regex will be set to the same ID

Returns:

If the mesh was found

Return type:

bool

simSetTimeOfDay(is_enabled, start_datetime='', is_start_datetime_dst=False, celestial_clock_speed=1, update_interval_secs=60, move_sun=True)

Control the position of Sun in the environment

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

Parameters:
  • is_enabled (bool) -- True to enable time-of-day effect, False to reset the position to original

  • start_datetime (str, optional) -- Date & Time in %Y-%m-%d %H:%M:%S format, e.g. 2018-02-12 15:20:00

  • is_start_datetime_dst (bool, optional) -- True to adjust for Daylight Savings Time

  • celestial_clock_speed (float, optional) -- 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

  • update_interval_secs (float, optional) -- Interval to update the Sun's position

  • move_sun (bool, optional) -- Whether or not to move the Sun

simSetTraceLine(color_rgba, thickness=1.0, vehicle_name='')

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

Tracing can be enabled by pressing T in the Editor or setting EnableTrace to True in the Vehicle Settings

Parameters:
  • color_rgba (list) -- desired RGBA values from 0.0 to 1.0

  • thickness (float, optional) -- Thickness of the line

  • vehicle_name (string, optional) -- Name of the vehicle to set Trace line values for

simSetVehicleGeoPose(geopose, ignore_collision, vehicle_name='')

Set the pose of the vehicle

If you don't want to change position (or orientation) then just set components of position (or orientation) to floating point nan values

Parameters:
  • pose (Pose) -- Desired Pose pf the vehicle

  • ignore_collision (bool) -- Whether to ignore any collision or not

  • vehicle_name (str, optional) -- Name of the vehicle to move

simSetVehiclePose(pose, ignore_collision, vehicle_name='')

Set the pose of the vehicle

If you don't want to change position (or orientation) then just set components of position (or orientation) to floating point nan values

Parameters:
  • pose (Pose) -- Desired Pose pf the vehicle

  • ignore_collision (bool) -- Whether to ignore any collision or not

  • vehicle_name (str, optional) -- Name of the vehicle to move

simSetWeatherParameter(param, val)

Enable various weather effects

Parameters:
  • param (WeatherParameter) -- Weather effect to be enabled

  • val (float) -- Intensity of the effect, Range 0-1

simSetWind(wind)

Set simulated wind, in World frame, NED direction, m/s

Parameters:

wind (Vector3r) -- Wind, in World frame, NED direction, in m/s

simSpawnObject(object_name, asset_name, pose, scale, physics_enabled=False, is_blueprint=False)

Spawned selected object in the world

Parameters:
  • object_name (str) -- Desired name of new object

  • asset_name (str) -- Name of asset(mesh) in the project database

  • pose (airgen.Pose) -- Desired pose of object

  • scale (airgen.Vector3r) -- Desired scale of object

  • physics_enabled (bool, optional) -- Whether to enable physics for the object

  • is_blueprint (bool, optional) -- Whether to spawn a blueprint or an actor

Returns:

Name of spawned object, in case it had to be modified

Return type:

str

simSwapTextures(tags, tex_id=0, component_id=0, material_id=0)

Runtime Swap Texture API

Parameters:
  • tags (str) -- string of "," or ", " delimited tags to identify on which actors to perform the swap

  • tex_id (int, optional) --

    indexes the array of textures assigned to each actor undergoing a swap

    If out-of-bounds for some object's texture set, it will be taken modulo the number of textures that were available

  • component_id (int, optional)

  • material_id (int, optional)

Returns:

List of objects which matched the provided tags and had the texture swap perfomed

Return type:

list[str]

simTestLineOfSightBetweenPoints(point1, point2)

Returns whether the target point is visible from the perspective of the source point

Parameters:
  • point1 (GeoPoint) -- source point

  • point2 (GeoPoint) -- target point

Returns:

Success

Return type:

[bool]

simTestLineOfSightToPoint(point, vehicle_name='')

Returns whether the target point is visible from the perspective of the inputted vehicle

Parameters:
  • point (GeoPoint) -- target point

  • vehicle_name (str, optional) -- Name of vehicle

Returns:

Success

Return type:

[bool]

startRecording()

Start Recording

Recording will be done according to the settings

stopRecording()

Stop Recording