Skip to content

Latest commit

 

History

History
1181 lines (860 loc) · 83.1 KB

CPP_API.md

File metadata and controls

1181 lines (860 loc) · 83.1 KB

AirSim CPP API Documentation

Table of Contents

RpcLibClientBase

RpcLibClientBase::RpcLibClientBase(const string& ip_address, uint16_t port, float timeout_sec)

Constructor


bool RpcLibClientBase::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

RpcLibClientBase::ConnectionState RpcLibClientBase::getConnectionState()

Get state of connection

Returns Description
ConnectionState Returns state of connection

void RpcLibClientBase::enableApiControl(bool is_enabled, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json

bool RpcLibClientBase::isApiControlEnabled(const std::string& vehicle_name) const

Return whether API control is enabled

Args Type Required or Optional Description
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
bool Returns whether API control is enabled

int RpcLibClientBase::getClientVersion() const

Get client version

Returns Description
int Client version

int RpcLibClientBase::getMinRequiredServerVersion() const

Get minimum requared server version

Returns Description
int minimum requared server version

int RpcLibClientBase::getMinRequiredClientVersion() const

Get minimum requared client version

Returns Description
int minimum requared client version

int RpcLibClientBase::getServerVersion() const

Get server version

Returns Description
int Server version

void RpcLibClientBase::reset()

Reset the vehicle to its original starting state.


void RpcLibClientBase::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

bool RpcLibClientBase::armDisarm(bool arm, const std::string& vehicle_name)

Arms or disarms vehicle.

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

msr::airlib::GeoPoint RpcLibClientBase::getHomeGeoPoint(const std::string& vehicle_name) const

Get the Home location of the vehicle.

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

msr::airlib::LidarData RpcLibClientBase::getLidarData(const std::string& lidar_name, const std::string& vehicle_name) const

Get information about LiDAR.

Args Type Required or Optional Description
lidar_name str required Name of LiDAR to get data from, specified in settings.json
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
LidarData more information here

msr::airlib::ImuBase::Output RpcLibClientBase::getImuData(const std::string& imu_name, const std::string& vehicle_name) const

Returns informaton about IMU.

Args Type Required or Optional Description
imu_name str required Name of IMU to get data from, specified in settings.json
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
ImuBase more information here

msr::airlib::BarometerBase::Output RpcLibClientBase::getBarometerData(const std::string& barometer_name, const std::string& vehicle_name) const

Returns information about barometer.

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

msr::airlib::MagnetometerBase::Output RpcLibClientBase::getMagnetometerData(const std::string& magnetometer_name, const std::string& vehicle_name) const

Returns information about magnetometer.

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

msr::airlib::GpsBase::Output RpcLibClientBase::getGpsData(const std::string& gps_name, const std::string& vehicle_name) const

Returns information about GPS.

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

msr::airlib::DistanceBase::Output RpcLibClientBase::getDistanceSensorData(const std::string& distance_sensor_name, const std::string& vehicle_name) const

Returns information about distance sensor.

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

vector<int> RpcLibClientBase::simGetLidarSegmentation(const std::string& lidar_name, const std::string& vehicle_name) const

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

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

bool RpcLibClientBase::simSetSegmentationObjectID(const std::string& mesh_name, int object_id, bool is_name_regex)

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 required Whether the mesh name is a regex
Returns Description
bool If the mesh was found

int RpcLibClientBase::simGetSegmentationObjectID(const std::string& mesh_name) const

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
Returns Description
int Returns object ID of the mesh

CollisionInfo RpcLibClientBase::simGetCollisionInfo(const std::string& vehicle_name) const

Returns information aboout collision with vehicle.

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

Pose RpcLibClientBase::simGetVehiclePose(const std::string& vehicle_name) const

Returns current pose of the vehicle.

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

void RpcLibClientBase::simSetVehiclePose(const Pose& pose, bool ignore_collision, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json

void RpcLibClientBase::simSetTraceLine(const std::vector<float>& color_rgba, float thickness, const std::string & vehicle_name)

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

Args Type Required or Optional Description
color_rgba vector 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 required Name of the vehicle, under tag Vehicles in settings.json

vector<ImageCaptureBase::ImageResponse> RpcLibClientBase::simGetImages(vector<ImageCaptureBase::ImageRequest> request, const std::string& vehicle_name)

Get multiple images.

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

vector<uint8_t> RpcLibClientBase::simGetImage(const std::string& camera_name, ImageCaptureBase::ImageType type, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
str Binary string literal of compressed png image

vector<MeshPositionVertexBuffersResponse> RpcLibClientBase::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
vector of MeshPositionVertexBuffersResponse more information [here][https://github.com/microsoft/AirSim/blob/master/docs/meshes.md]

void RpcLibClientBase::simPrintLogMessage(const std::string& message, std::string message_param, unsigned char severity)

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 required Parameter to be printed next to the message
severity unsigned char required Range 0-3, inclusive, corresponding to the severity of the message

void RpcLibClientBase::simFlushPersistentMarkers()

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


void RpcLibClientBase::simPlotPoints(const vector<Vector3r>& points, const vector<float>& color_rgba, float size, float duration, bool is_persistent)

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

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

void RpcLibClientBase::simPlotLineStrip(const vector<Vector3r>& points, const vector<float>& color_rgba, float thickness, float duration, bool is_persistent)

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 vector of Vector3r required vector of Vector3r objects
color_rgba vector of float required desired RGBA values from 0.0 to 1.0
thickness float required Thickness of line
duration float required Duration (seconds) to plot for
is_persistent bool required If set to True, the desired object will be plotted for infinite time.

void RpcLibClientBase::simPlotLineList(const vector<Vector3r>& points, const vector<float>& color_rgba, float thickness, float duration, bool is_persistent)

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 vector of Vector3r required vector of Vector3r objects
color_rgba vector of float required desired RGBA values from 0.0 to 1.0
thickness float required Thickness of line
duration float required Duration (seconds) to plot for
is_persistent bool required If set to True, the desired object will be plotted for infinite time.

void RpcLibClientBase::simPlotArrows(const vector<Vector3r>& points_start, const vector<Vector3r>& points_end, const vector<float>& color_rgba, float thickness, float arrow_size, float duration, bool is_persistent)

Plots a vector 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 vector of Vector3r required vector of 3D start positions of arrow start positions, specified as Vector3r objects
points_end vector of Vector3r required vector of 3D end positions of arrow start positions, specified as Vector3r objects
color_rgba vector of float required desired RGBA values from 0.0 to 1.0
thickness float required Thickness of line
arrow_size float required Size of arrow head
duration float required Duration (seconds) to plot for
is_persistent bool required If set to True, the desired object will be plotted for infinite time.

void RpcLibClientBase::simPlotStrings(const vector<std::string>& strings, const vector<Vector3r>& positions, float scale, const vector<float>& color_rgba, float duration)

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

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

void RpcLibClientBase::simPlotTransforms(const vector<Pose>& poses, float scale, float thickness, float duration, bool is_persistent)

Plots a vector of transforms in World NED frame.

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

void RpcLibClientBase::simPlotTransformsWithNames(const vector<Pose>& poses, const vector<std::string>& names, float tf_scale, float tf_thickness, float text_scale, const vector<float>& text_color_rgba, float duration)

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

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

bool RpcLibClientBase::simIsPaused() const

Returns true if the simulation is paused.

Returns Description
bool Whether simulation is paused

void RpcLibClientBase::simPause(bool is_paused)

Pauses simulation.

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

void RpcLibClientBase::simContinueForTime(double seconds)

Continue the simulation for the specified number of seconds.

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

void RpcLibClientBase::simEnableWeather(bool 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

void RpcLibClientBase::simSetWeatherParameter(WorldSimApiBase::WeatherParameter param, float 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

void RpcLibClientBase::simSetTimeOfDay(bool is_enabled, const string& start_datetime, bool is_start_datetime_dst, float celestial_clock_speed, float update_interval_secs, bool move_sun)

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 required ate & Time in %Y-%m-%d %H:%M:%S format, e.g. 2018-02-12 15:20:00
is_start_datetime_dst bool required True to adjust for Daylight Savings Time
celestial_clock_speed float required Run celestial clock faster or slower than simulation clock
update_interval_secs float required Interval to update the Sun's position
move_sun bool required Whether or not to move the Sun

vector<string> RpcLibClientBase::simListSceneObjects(const string& name_regex) const

vector the objects present in the environment.

Args Type Required or Optional Description
name_regex str required String to match actor names against, e.g. "Cylinder.*"
Returns Description
vector of str vector containing all the names

std::vector<std::string> RpcLibClientBase::simSwapTextures(const std::string& tags, int tex_id, int component_id, int material_id)

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 required indexes the array of textures assigned to each actor undergoing a swap
component_id int required
material_id int required
Returns Description
vector of str vector of objects which matched the provided tags and had the texture swap perfomed

msr::airlib::Pose RpcLibClientBase::simGetObjectPose(const std::string& object_name) const

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

bool RpcLibClientBase::simSetObjectPose(const std::string& object_name, const msr::airlib::Pose& pose, bool teleport)

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 required Whether to move the object immediately without affecting their velocity
Returns Description
bool Whether the move was successful

CameraInfo RpcLibClientBase::simGetCameraInfo(const std::string& camera_name, const std::string& vehicle_name) const

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
CameraInfo

void RpcLibClientBase::simSetCameraOrientation(const std::string& camera_name, const Quaternionr& orientation, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json

void RpcLibClientBase::simSetCameraFov(const std::string& camera_name, float fov_degrees, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json

msr::airlib::Kinematics::State RpcLibClientBase::simGetGroundTruthKinematics(const std::string& vehicle_name) const

Get Ground truth kinematics of the vehicle.

Args Type Required or Optional Description
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
Kinematics::State Ground truth of the vehicle

msr::airlib::Environment::State RpcLibClientBase::simGetGroundTruthEnvironment(const std::string& vehicle_name) const

Get ground truth environment state.

Args Type Required or Optional Description
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
Environment::State Ground truth environment state

void RpcLibClientBase::cancelLastTask(const std::string& vehicle_name)

Cancel previous Async task.

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

RpcLibClientBase* RpcLibClientBase::waitOnLastTask(bool* task_result, float timeout_sec)

Wait for the last Async task to complete.

Args Type Required or Optional Description
task_result bool* required
timeout_sec float required Time for the task to complete
Returns Description
[RpcLibClientBase*][] Result of the last task

void* RpcLibClientBase::getClient()


const void* RpcLibClientBase::getClient() const


CarRpcLibClient

CarRpcLibClient::CarRpcLibClient(const string& ip_address, uint16_t port, float timeout_sec)

Constructor


void CarRpcLibClient::setCarControls(const CarApiBase::CarControls& controls, const std::string& vehicle_name)

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

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

CarApiBase::CarState CarRpcLibClient::getCarState(const std::string& vehicle_name)

Get current state of the vehicle.

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

CarApiBase::CarControls CarRpcLibClient::getCarControls(const std::string& vehicle_name)

Get current control values of the vehicle.

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

MultirotorRpcLibClient

MultirotorRpcLibClient::MultirotorRpcLibClient(const string& ip_address, uint16_t port, float timeout_sec)

Constructor


MultirotorRpcLibClient* MultirotorRpcLibClient::takeoffAsync(float timeout_sec, const std::string& vehicle_name)

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

Args Type Required or Optional Description
timeout_sec float required Takeoff time, in seconds.
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::landAsync(float timeout_sec, const std::string& vehicle_name)

Land the vehicle

Args Type Required or Optional Description
timeout_sec float required Landing time, in seconds.
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::goHomeAsync(float timeout_sec, const std::string& vehicle_name)

Return vehicle to Home i.e. Launch location

Args Type Required or Optional Description
timeout_sec float required Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByMotorPWMsAsync(float front_right_pwm, float rear_left_pwm, float front_left_pwm, float rear_right_pwm, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByRollPitchYawZAsync(float roll, float pitch, float yaw, float z, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByRollPitchYawThrottleAsync(float roll, float pitch, float yaw, float throttle, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByRollPitchYawrateThrottleAsync(float roll, float pitch, float yaw_rate, float throttle, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByRollPitchYawrateZAsync(float roll, float pitch, float yaw_rate, float z, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByAngleRatesZAsync(float roll_rate, float pitch_rate, float yaw_rate, float z, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByAngleRatesThrottleAsync(float roll_rate, float pitch_rate, float yaw_rate, float throttle, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByVelocityAsync(float vx, float vy, float vz, float duration, DrivetrainType drivetrain, const YawMode& yaw_mode, const std::string& vehicle_name)

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 required more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByVelocityZAsync(float vx, float vy, float z, float duration, DrivetrainType drivetrain, const YawMode& yaw_mode, const std::string& vehicle_name)

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 required more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveOnPathAsync(const vector<Vector3r>& path, float velocity, float duration, DrivetrainType drivetrain, const YawMode& yaw_mode, float lookahead, float adaptive_lookahead, const std::string& vehicle_name)

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 vector of vector3r required Desired path
velocity float required Desired linear velocity
duration float required Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
drivetrain DrivetrainType required more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
adaptive_lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveToPositionAsync(float x, float y, float z, float velocity, float timeout_sec, DrivetrainType drivetrain, const YawMode& yaw_mode, float lookahead, float adaptive_lookahead, const std::string& vehicle_name)

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 float required Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
drivetrain DrivetrainType required more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
adaptive_lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveToZAsync(float z, float velocity, float timeout_sec, const YawMode& yaw_mode, float lookahead, float adaptive_lookahead, const std::string& vehicle_name)

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 float required Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
adaptive_lookahead float required more information [here][https://microsoft.github.io/AirSim/apis/#lookahead-and-adaptive_lookahead]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::moveByManualAsync(float vx_max, float vy_max, float z_min, float duration, DrivetrainType drivetrain, const YawMode& yaw_mode, const std::string& vehicle_name)

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 required more information [here][https://microsoft.github.io/AirSim/apis/#drivetrain]
yaw_mode YawMode required more information [here][https://microsoft.github.io/AirSim/apis/#yaw_mode]
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::rotateToYawAsync(float yaw, float timeout_sec, float margin, const std::string& vehicle_name)

Change vehicle yaw angle.

Args Type Required or Optional Description
yaw float required Desired yaw angle in world (NED) frame, in degrees
timeout_sec float required Travel time, in seconds. Process will end after this time regardless whether vehicle as reached destination
margin float required
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::rotateByYawRateAsync(float yaw_rate, float duration, const std::string& vehicle_name)

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 required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

MultirotorRpcLibClient* MultirotorRpcLibClient::hoverAsync(const std::string& vehicle_name)

Make vehicle hover.

Args Type Required or Optional Description
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json
Returns Description
MultirotorRpcLibClient*

void MultirotorRpcLibClient::setAngleLevelControllerGains(const vector<float>& kp, const vector<float>& ki, const vector<float>& kd, const std::string& vehicle_name)

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

Args Type Required or Optional Description
kp vector of float required proportional gains
ki vector of float required integral gains
kd vector of float required derivative gains
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json

void MultirotorRpcLibClient::setAngleRateControllerGains(const vector<float>& kp, const vector<float>& ki, const vector<float>& kd, const std::string& vehicle_name)

Sets angle gains for ALL move*() APIs.

Args Type Required or Optional Description
kp vector of float required proportional gains
ki vector of float required integral gains
kd vector of float required derivative gains
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json

void MultirotorRpcLibClient::setVelocityControllerGains(const vector<float>& kp, const vector<float>& ki, const vector<float>& kd, const std::string& vehicle_name)

Sets velocity controller gains for moveByVelocityAsync().

Args Type Required or Optional Description
kp vector of float required proportional gains
ki vector of float required integral gains
kd vector of float required derivative gains
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json

void MultirotorRpcLibClient::setPositionControllerGains(const vector<float>& kp, const vector<float>& ki, const vector<float>& kd, const std::string& vehicle_name)

Sets position controller gains for moveByPositionAsync.

Args Type Required or Optional Description
kp vector of float required proportional gains
ki vector of float required integral gains
kd vector of float required derivative gains
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json

bool MultirotorRpcLibClient::setSafety(SafetyEval::SafetyViolationType enable_reasons, float obs_clearance, SafetyEval::ObsAvoidanceStrategy obs_startegy, float obs_avoidance_vel, const Vector3r& origin, float xy_length, float max_z, float min_z, const std::string& vehicle_name)


MultirotorState MultirotorRpcLibClient::getMultirotorState(const std::string& vehicle_name)

Gets the current state of vehicle.

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

void MultirotorRpcLibClient::moveByRC(const RCData& rc_data, const std::string& vehicle_name)

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

Args Type Required or Optional Description
rcdata RCData required
vehicle_name str required Name of the vehicle, under tag Vehicles in settings.json

MultirotorRpcLibClient* MultirotorRpcLibClient::waitOnLastTask(bool* task_result, float timeout_sec)

Return when the last task is complete.

Args Type Required or Optional Description
task_result bool* required Whether the task is successful
timeout_sec float required Amount of time to wait
Returns Description
MultirotorState State the of the vehicle.