Robot App Store Developer Program

robots-app-store-developer-program

Knowledge Base

How to Control AR.Drone Movements During Flight

  By Anna Sandler

Make sure you are familiar with "How to program AR.Drone remotely over WIFI" chapter before you continue to this tutorial.

AT*PCMD command

This command is used to control the flight motion of the drone while in the air such as rotation or speed.

Make sure the command AT*FTRIM has been called before taking-off for horizontal calibration; otherwise Ar.Drone won’t be able to stabilize itself when flying.

Syntax

AT*REF=[Sequence number ],[Flag bit-field],[Roll],[Pitch],[Gaz],[Yaw]<LF>

Explanation:

  • Sequence number- 1 if it is a first command, or sequence number value of previous command + 1.
  • Flag bit field- a 32 bit-wide bit-field integer. See explanation below.
  • Roll- drone left-right tilt. Floating point value in range of -1 to1; See explanation below.
  • Pitch- drone front-back tilt. Floating point value in range of -1 to1; See explanation below.
  • Gaz- drone vertical speed. Floating point value in range of -1 till 1; See explanation below.
  • Yaw- drone angular speed. Floating point value in range of -1 to1; See explanation below.

Example:

The following UDP packet will make the drone to spin clockwise with 0.75 of its configured power.

The UDP packet that is sent to AR.Drone is:
AT* PCMD =1,1,0,0,0, 1061158912<LF>

Arguments explanation

Flag bit-field argument values

This flag bit-field configures how the drone will interpret the progressive commands from the user.
Bits order is from right to left MSB first.

The flag field contains the following bits:
  • Bit 0: Enable progressive commands.
    If this bit is set to 0- progressive commands values (Roll, Pitch’ Gaz and Yaw) will be ignored and the drone will enter a hovering mode.
    Setting this bit to 1- will make AR.Drone to consider the values of the progressive commands that are passed in this command;
  • Bit 1: Enable combined yaw.
    If this bit is set to 0- Yaw argument value will be considered.
    Setting this bit to 1- will result the Yaw argument value to be ignored and to be calculated automatically according to the Roll argument value for base turns;
  • Bit 2-31: are not used. Set to 0;
The following flag field's values are valid:
  • 0- Hovering mode- the drone will stay on top of the same point above the ground;
  • 1- Progressive mode- the values of all the progressive command argument will be considered;
  • 2- Combined yaw mode only- do not use this mode;
  • 3- Progressive with combined yaw mode- the values of the progressive command arguments will be considered except the yaw argument that will be calculated automatically according to the roll argument;

Roll argument values

Roll argument value sets the percentage of the maximum inclination as configured in the drone parameters for drone’s left-right tilt.

The direction is determined by the sign of the number:
  • Negative percentage value will make the drone tilt to its left, thus flying leftward;
  • Positive percentage value will make the drone tilt to its right, thus flying rightward;
How to represent the value:
  • Convert the float number [-1, 1] to hexadecimal signed value. The explanation for the conversion will be given in future posts;
  • Convert back from hex to signed 32-bit decimal number;
The following values are mostly used:
  • -1082130432: The minimum converted value -1 will make the drone fly leftward with full power;
  • -1086324736: The converted value -0.75 will make the drone fly leftwards with 3/4 power;
  • -1090519040: The converted value -0.5 will make the drone fly leftwards with half power;
  • -1098907648: The converted value -0.25 will make the drone fly leftwards with 1/4 power;
  • 0: This value will make the drone fly horizontally;
  • 1048576000: The converted value 0.25 will make the drone fly rightwards with 1/4 power;
  • 1056964608: The converted value 0.5 will make the drone fly rightwards with half power;
  • 1061158912: The converted value 0.75 will make the drone fly rightwards with 3/4 power;
  • 1065353216: The maximum converted value 1 will make the drone fly rightward with full power;

Pitch argument values

Pitch argument value sets the percentage of the maximum inclination as configured in the drone parameters for drone’s front-back tilt.

The direction is determined by the sign of the number:
  • Negative percentage value will make the drone lower its nose, thus flying frontwards;
  • Positive percentage value will make the drone raise its nose, thus flying backwards;
How to represent the value:
  • Convert the float number [-1, 1] to hexadecimal signed value.
    The explanation for the conversion will be given in future posts;
  • Convert back from hex to signed 32-bit decimal number;
The following values are mostly used:
  • -1082130432: The minimum converted value -1 will make the drone fly frontwards with full power;
  • -1086324736: The converted value -0.75 will make the drone fly frontwards with 3/4 power;
  • -1090519040: The converted value -0.5 will make the drone fly frontwards with half power;
  • -1098907648: The converted value -0.25 will make the drone fly frontwards with 1/4 power;
  • 0: This value will make the drone fly horizontally;
  • 1048576000: The converted value 0.25 will make the drone fly backwards with 1/4 power;
  • 1056964608: The converted value 0.5 will make the drone fly backwards with half power;
  • 1061158912: The converted value 0.75 will make the drone fly backwards with 3/4 power;
  • 1065353216: The maximum converted value 1 will make the drone fly backwards with full power;

Gaz argument values

Gaz argument value sets the percentage of the maximum vertical speed as configured in the drone parameters for drone’s vertical movement up or down.

The direction is determined by the sign of the number:
  • Negative percentage value will make the drone go down, thus go downwards;
  • Positive percentage value will make the drone rise up in the air, thus go upwards;
How to represent the value:
  • Convert the float number [-1, 1] to hexadecimal signed value. The explanation for the conversion will be given in future posts;
  • Convert back from hex to signed 32-bit decimal number;
The following values are mostly used:
  • -1082130432: The minimum converted value -1 will make the drone fly downwards with full power;
  • -1086324736: The converted value -0.75 will make the drone fly downwards with 3/4 power;
  • -1090519040: The converted value -0.5 will make the drone fly downwards with half power;
  • -1098907648: The converted value -0.25 will make the drone fly downwards with 1/4 power;
  • 0: This value will make the drone stay at the same position vertically;
  • 1048576000: The converted value 0.25 will make the drone fly upwards with 1/4 power;
  • 1056964608: The converted value 0.5 will make the drone fly upwards with half power;
  • 1061158912: The converted value 0.75 will make the drone fly upwards with 3/4 power;
  • 1065353216: The maximum converted value 1 will make the drone fly upwards with full power;

Yaw argument values

Yaw argument value sets the percentage of the maximum angular speed as configured in the drone parameters for drone’s right-left spin.

The direction is determined by the sign of the number:
  • Negative percentage value will make the drone spin left;
  • Positive percentage value will make the drone spin right;
How to represent the value:
  • Convert the float number [-1, 1] to hexadecimal signed value. The explanation for the conversion will be given in future posts;
  • Convert back from hex to signed 32-bit decimal number;
The following values are mostly used:
  • -1082130432: The minimum converted value -1 will make the drone spin left with full power;
  • -1086324736: The converted value -0.75 will make the drone spin left with 3/4 power;
  • -1090519040: The converted value -0.5 will make the drone spin left with half power;
  • -1098907648: The converted value -0.25 will make the drone spin left with 1/4 power;
  • 0: This value will make the drone stay at the same position horizontally;
  • 1048576000: The converted value 0.25 will make the drone spin right with 1/4 power;
  • 1056964608: The converted value 0.5 will make the drone spin right with half power;
  • 1061158912: The converted value 0.75 will make the drone spin right with 3/4 power;
  • 1065353216: The maximum converted value 1 will make the drone spin right with full power;

wifes who cheat cheat women women who cheat on their husband







Related Robot-Apps™

Comments