public GetServerVersion() { command = new MessagePackCommand { Request = 0, MessageId = 0, Method = "getServerVersion", args = new ArrayList { } }; }
public RotateToYaw(float yaw) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "rotateToYaw", args = new ArrayList { yaw, 600, 5, "" } }; }
public Land() { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "land", args = new ArrayList { 60, "" } }; }
public WeatherEnable(bool enable) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "simEnableWeather", args = new ArrayList { enable } }; }
public WeatherSet(int weatherType, float intensity) { command = new MessagePackCommand { Request = 0, MessageId = 0, Method = "simSetWeatherParameter", args = new ArrayList { weatherType, intensity } }; }
public EnableApiControl() { command = new MessagePackCommand { Request = 0, MessageId = 0, Method = "enableApiControl", args = new ArrayList { true, "" } }; }
public Takeoff() { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "takeoff", args = new ArrayList { 5, "" } }; }
public ArmDisarm(bool arm) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "armDisarm", args = new ArrayList { arm, "" } }; }
public RotateByYawRate(float yawRate, float duration) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "rotateByYawRate", args = new ArrayList { yawRate, duration, "" } }; }
public Hover(float delay) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "hover", args = new ArrayList { delay *1000 } }; }
public MultirotorState() { command = new MessagePackCommand() { Request = 0, MessageId = 1, Method = "getMultirotorState", args = new ArrayList { "" } }; }
// Need to figure out how to use current xyz as reference for moveToPosition public FlyForward(int distance) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "moveToPosition", // x y z velocity args = new ArrayList { distance, 0, -10, 5, 60, 0, new YawMode { is_rate = false, yaw_or_rate = 0 }, -1, 1, "" } }; }
public MoveByVelocity(float vx, float vy, float vz, float duration) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "moveByVelocity", // x y z velocity args = new ArrayList { vx, vy, vz, duration, 0, new YawMode { is_rate = false, yaw_or_rate = 0 }, "" } }; }
// Need to figure out how to use current xyz as reference for moveToPosition public MoveToPosition(float xposition, float yposition, float zposition) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "moveToPosition", // Setting timeout to 10 minutes for now args = new ArrayList { xposition, yposition, zposition, 5, 600, 0, new YawMode { is_rate = false, yaw_or_rate = 0 }, -1, 1, "" } }; }
// x is north, y is east, z is down public Wind(int x_vel, int y_vel, int z_vel) { command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "simSetWind", args = new ArrayList { new Dictionary <string, int>() { { "x_val", x_vel }, { "y_val", y_vel }, { "z_val", z_vel } } } }; }
public MoveByRollPitchYaw(float roll, float pitch, float yaw, float duration) { // RPY will come in as degrees but should be converted to radians per the API roll *= (float)(Math.PI / 180); // These are negative per https://github.com/microsoft/AirSim/blob/master/PythonClient/airsim/client.py#L1028 pitch *= (float)(Math.PI / 180) * -1; yaw *= (float)(Math.PI / 180) * -1; command = new MessagePackCommand { Request = 0, MessageId = 1, Method = "moveByRollPitchYawZ", // 4th param is Z and we set it to 0 for now args = new ArrayList { roll, pitch, yaw, 0, duration, "" } }; }