Motion#

Introduction#

The VEX AIR Drone features four propellers, allowing it to move in any direction and rotate independently. Motion provides methods for movement, turning, speed adjustments, and position tracking.

Circular compass dial from 0-360 degrees surrounding a drone with 4 propellers. The front of the drone faces 0 degrees on the compass dial.

Below is a list of available blocks:

Actions — Move and turn the drone.

  • take off — Lifts the drone to a specified height.

  • land — Lands the drone.

  • hover — Keeps the drone at its position.

  • climb — Moves the drone in a specified vertical direction.

  • climb for — Moves the drone in a specified vertical direction for a specific distance.

  • climb to z position — Moves the drone to a specified z position.

  • move — Moves the drone forward, reverse, left, or right.

  • move at angle — Moves the drone in a specified direction using an angle.

  • move for — Moves the drone in a specific direction for a set distance.

  • move at angle for — Moves the drone at a specific angle for a set distance.

  • move to — moves the drone to a specified position.

  • turn — Rotates the drone left or right.

  • turn for — Rotates the drone for a specified number of degrees.

  • turn to heading — Rotates the drone to face a specific heading.

  • move with controller — Allows the drone to be driven using the controller.

Flight Control — Adjust flight settings.

Settings — Adjust movement and turn speeds.

Position — Track and modify the drone’s position.

Values — Check movement status.

  • flight state? — Returns the current state of the drone.

  • safe mode? — Returns the drone’s propeller lock state.

  • climb active? — Returns whether the drone is currently climbing.

  • move active? — Returns whether the drone is currently moving.

  • turn active? — Returns whether the drone is currently turning.

  • hovering? — Returns whether the drone is currently hovering.

  • taking off? — Returns whether the drone is currently taking off.

  • landing? — Returns whether the drone is currently landing.

  • landed? — Returns whether the drone has landed.

Actions#

take off#

The take off block starts the propellers and lifts the drone into the air. This block must be used before other movements can be made.

move forward stack block#
    take off to [500] [mm v] ▶

Parameters

Description

climb to

The z position the drone will climb to in millimeters.

units

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

    when started :: hat events
    [Fly for 1 second.]
    take off to [500] [mm v] ▶
    wait [1] seconds
    land ▶

land#

The land block lowers the drone to the ground. The propellers will continue to run until the project is stopped.

move forward stack block#
    land ▶

Parameters

Description

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

    when started :: hat events
    [Land after 1 second.]
    take off to (500) [mm v] ▶
    wait [1] seconds
    land ▶

hover#

The hover block stops the drone from moving in any direction and holds its current position in the air.

hover block#
    hover

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Hold current position for 3 seconds after moving forward.]
    take off to (500) [mm v] ▶
    move [forward v]
    wait [1] seconds
    hover
    wait [3] seconds
    land ▶

climb#

The climb block moves the drone in a specified vertical direction.

move forward stack block#
    climb [up v]

Parameters

Description

direction

The direction in which the drone will fly:

  • up
  • down

Example

    when started :: hat events
    [Climb upwards for 2 seconds.]
    take off to (500) [mm v] ▶
    wait [1] seconds
    climb [up v]
    wait [2] seconds
    land ▶

climb for#

The climb for block moves the drone in a specified vertical direction for a specific distance.

move forward stack block#
    climb [up v] for (500) [mm v] ▶

Parameters

Description

direction

The direction in which the drone will fly:

  • up
  • down

distance

The distance the drone will fly for.

units

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

    when started :: hat events
    [Lower drone before landing.]
    take off to [700] [mm v] ▶
    wait [1] seconds
    climb [down v] for [300] [mm v] ▶
    wait [1] seconds
    land ▶

climb to z position#

The climb to z position block moves the drone to a specified z position.

move forward stack block#
    climb to z position [500] [mm v] ▶

Parameters

Description

z position

The z position, as an integer or decimal, the drone will climb to.

units

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

    when started :: hat events
    [Reach 500 mm after takeoff.]
    take off to [300] [mm v] ▶
    wait [1] seconds
    climb to z position [500] [mm v] ▶
    wait [1] seconds
    land ▶

move#

The move block moves the drone in four specific directions using the current move velocity.

move forward stack block#
    move [forward v]

Parameters

Description

direction

Move the drone in one of the following directions:

  • forward
  • right
  • left
  • reverse

Example

    when started :: hat events
    [Move forward for 1 second.]
    take off to [500] [mm v] ▶
    move [forward v]
    wait [1] seconds
    land ▶

move at angle#

The move at angle block moves the drone at a specified angle using the current move velocity.

move at 90 degrees stack block#
    move at (90) degrees

Parameters

Description

angle

The angle, as an integer or decimal, at which the drone moves, ranging from 0 to 360 degrees.

Examples

    when started :: hat events
    [Move left for 1 second.]
    take off to [500] [mm v] ▶
    move at [270] degrees
    wait [1] seconds
    land ▶

move for#

The move for block moves the drone in four specific directions for a specific distance using the current move velocity.

move forward for 200 mm stack block#
    move [forward v] for (200) [mm v] ▶

Parameters

Description

direction

Move the drone in one of the following directions:

  • forward
  • right
  • left
  • reverse

distance

The distance, as an integer or decimal, that the drone will move.

unit

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

when started :: hat events
[Move forward for 200 mm.]
take off to [500] [mm v] ▶
move [forward v] for [200] [mm v] ▶
land ▶

move at angle for#

The move at angle for block moves the drone at a specific angle for a specified distance using the current move velocity.

move at angle for stack block#
    move at (45) degrees for (200) [mm v] ▶

Parameters

Description

angle

The angle, as an integer or decimal, at which the drone moves, ranging from 0 to 359 degrees.

distance

The distance, as an integer or decimal, that the drone will move.

unit

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Examples

when started :: hat events
[Move diagonally for 500 mm.]
take off to [300] [mm v] ▶
move at [45] degrees for [500] [mm v] ▶
land ▶

move to#

The move to block moves the drone to a specified position in the air while maintaining the same heading.

move to x 1000 y 1000#
    move to x: [1000] y: [1000] z: [1000] [mm v] ▶

Top-down view of the VEX drone showing X and Y axes: X+ to the right, X− to the left, Y+ forward, Y− backward.

Parameters

Description

x

The x coordinate that the drone will move to.

y

The y coordinate that the drone will move to.

z

The z coordinate that the drone will climb to.

units

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

Examples

when started :: hat events
[Move diagonally to (300, 300, 500).]
take off to [300] [mm v] ▶
wait [2] seconds
move to x: [300] y: [300] z: [500] [mm v] ▶
wait [2] seconds
land ▶

turn#

The turn block turns the drone in a specific direction using the current turn velocity.

turn right stack block#
    turn [right v] 

Parameters

Description

direction

The direction in which the drone turns:

  • right
  • left

Example

when started :: hat events
[Turn to the right for 2 seconds.]
take off to [500] [mm v] ▶
turn [right v]
wait [2] seconds
land ▶

turn for#

The turn for block turns the drone in a specified direction for a set distance relative to its current facing direction using the current turn velocity.

turn right for 90 degrees stack block#
    turn [right v] for (90) degrees ▶

Parameters

Description

direction

The direction in which the drone turns:

  • right
  • left

angle

The angle, as an integer or decimal, at which the drone moves, ranging from 0 to 360 degrees.

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Examples

when started :: hat events
[Turn around, then land.]
take off to [500] [mm v] ▶
turn [right v] for [180] degrees ▶
land ▶

turn to heading#

The turn to heading block turns the drone to face a specific heading using the current turn velocity.

turn to heading 90 degrees stack block#
    turn to heading (270) degrees ▶

Parameters

Description

heading

The heading that the drone will turn to face from 0 to 360 degrees.

expanding arrow

By default, this is a waiting block, so the drone will finish moving before running the next block. To make the drone start moving and immediately run the next block right away, expand the block to say and don’t wait.

Examples

when started :: hat events
[Turn to face each of the cardinal headings.]
take off to [500] [mm v] ▶
turn to heading (90) degrees ▶
wait [1] seconds
turn to heading (180) degrees ▶
wait [1] seconds
turn to heading (270) degrees ▶
wait [1] seconds
turn to heading (0) degrees ▶
wait [1] seconds
land ▶

move with controller#

The move with controller block lets you control the drone using the VEX AIR Drone Controller. This block must be used inside of a loop to continuously control the drone. If the loop stops and there are no other blocks telling the drone to move, the drone will keep moving in the last direction it was moving in.

    move with controller

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Move with controller until button 7 is pressed.]
    take off to [500] [mm v] ▶
    repeat until <controller button [7 v] pressed?>
    move with controller
    end
    land ▶

Flight Control#

set steering POV#

The set steering POV block sets the viewpoint that is used when steering the drone.

move forward stack block#
    set steering POV to [standard v]

Parameters

Description

style

Sets the viewpoint that is used to steer the drone:

  • standard — Movements are based on the direction that the drone is currently facing.
  • headless — Movements are based on the drone’s orientation at the start of a project.

Example

    when started :: hat events
    [Steer based on the drone's starting orienation until button 7 is pressed.]
    take off to [500] [mm v] ▶
    set steering POV to [headless v]
    repeat until <controller button [7 v] pressed?>
    move with controller
    end
    land ▶

set movement#

The set movement block sets the drone’s movement style.

This movement style is used when flying the drone with a controller.

move forward stack block#
    set movement to [precision v]

Parameters

Description

style

Sets the style that is used to steer the drone:

  • precision — Slow, camera-stabilized mode for accurate control and learning. This is the default movement style.
  • balanced — Faster, camera-stabilized mode for smooth, responsive flight.
  • performance — High-speed, non-stabilized mode for advanced maneuvering.

Example

    when started :: hat events
    [Control the drone with the balanced movement style.]
    take off to [500] [mm v] ▶
    set movement to [balanced v]
    repeat until <controller button [7 v] pressed?>
    move with controller
    end
    land ▶

Settings#

set climb velocity#

The set climb velocity block sets the default climbing speed as a percentage. This will affect any following blocks related to climbing. The default climb velocity is 50%.

move forward stack block#
    set climb velocity to [100] %

Parameters

Description

velocity

The speed at which the drone will climb as a percent.

Example

    when started :: hat events
    [Raise the drone quickly before landing.]
    take off to [300] [mm v] ▶
    wait [1] seconds
    set climb velocity to [100] %
    climb [up v] for (500) [mm v] ▶
    land ▶

set move velocity#

The set move velocity block sets the default movement speed as a percentage. This will affect any following blocks related to moving. The default move velocity is 50%.

set move melocity to 50% stack block#
    set move velocity to [100] %

Parameters

Description

velocity

The velocity at which the drone will move as a percent.

Example

    when started :: hat events
    [Move forward quickly, then reverse slowly.]
    take off to [500] [mm v] ▶
    set move velocity to [100] %
    move [forward v] for [500] [mm v] ▶
    wait (1) seconds
    set move velocity to [20] %
    move [reverse v] for [500] [mm v] ▶
    land ▶

set turn velocity#

The set turn velocity block sets the default movement speed as a percentage. This will affect any following blocks related to turning. The default turn velocity is 50%.

set turn velocity to 50% stack block#
    set turn velocity to [100] %

Parameters

Description

velocity

The velocity at which the drone will turn as a percent.

Example

    when started :: hat events
    [Turn clockwise quickly, then counterclockwise slowly.]
    take off to [500] [mm v] ▶
    set turn velocity to [100] %
    turn [right v] for [360] degrees ▶
    wait (1) seconds
    set turn velocity to [20] %
    turn [left v] for [360] degrees ▶
    land ▶

Position#

position#

The position block returns the drone’s current x, y, or z coordinate as an integer. At the start of a project, the drone’s current position is automatically set to (0, 0, 0).

x position in mm reporter block#
    [x v] position in [mm v]

Parameters

Description

axis

Which axis to return the coordinate of:

  • x
  • y
  • z

unit

The unit of measurement:

  • mm (millimeters)
  • inches

Example

    when started :: hat events
    [Fly to position (0, 300, 500).]
    take off to [500] [mm v] ▶
    wait [1] seconds
    move [forward v]
    wait until <([y v] position in [mm v]) [math_greater_than v] [300]>
    hover
    wait [1] seconds
    land ▶

set z ceiling#

The set set z ceiling block creates a limit to how high the drone will fly.

move forward stack block#
    set z ceiling to [2500] in [mm v]

Parameters

Description

z ceiling

The z ceiling, as an integer or decimal, that the drone will not fly above, in a range from 1000 to 5000 mm or 40 to 196 inches.

units

The unit of measurement, which can be one of the following:

  • mm (millimeters)
  • inches

Example

    when started :: hat events
    [Fly with controller under 1000 mm.]
    set z ceiling to [1000] in [mm v]
    take off to (500) [mm v] ▶
    repeat until <controller button [7 v] pressed?>
    move with controller
    end
    land ▶

set drone position#

The set drone position block sets the drone’s current position to specified coordinate values in millimeters (mm).

set position stack block#
    set drone position to x: [0] y: [0] z: [0]

Parameters

Description

x

The x coordinate to set for the drone, in mm.

y

The y coordinate to set for the drone, in mm.

z

The z coordinate to set for the drone, in mm.

Example

    when started :: hat events
    [Set a new (0, 0, 0), then fly to position (0, 0, -300).]
    take off to [800] [mm v] ▶
    set drone position to x: [0] y: [0] z: [0]
    wait [1] seconds
    climb [down v]
    wait until <([z v] position in [mm v]) [math_less_than v] [-300]>
    hover
    wait [1] seconds
    land ▶

Values#

flight state?#

The flight state? block returns a Boolean indicating whether or not the drone is in the specified flight state.

  • True — The drone is in the specified state.

  • False — The drone is not in the specified state.

move forward stack block#
    <flight state is [motors off v]?>

Parameters

Description

state

The flight state to check:

  • motors off — The drone’s motors are off.
  • calibration — The drone is calibrating its sensors.
  • motor start — The drone is starting up its motors.
  • flight ready — The drone is ready to begin flying.
  • flight — The drone is in flight.

Example

    when started :: hat events
    [Report the flight status as the drone takes off.]
    print [Preparing for flight!] on screen ◀ and set cursor to next row
    take off to [800] mm ◀ and don't wait
    wait until <flight state is [motor start v]>
    print [Motors starting...] on screen ◀ and set cursor to next row
    wait until <flight state is [flight v]>
    print [Take off!] on screen ▶

safe mode?#

The safe mode? block returns a Boolean indicating whether the Propeller Lock is enabled on the drone.

  • True — Propeller Lock is enabled.

  • False — Propeller Lock is not enabled.

move forward stack block#
    <safe mode?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Change the sound by enabling the Propeller Lock.]
    forever
    if <safe mode?> then
    play sound [fault v]
    else
    play sound [success v]

climb active?#

The climb active? block returns a Boolean indicating whether the drone is climbing.

  • True — The drone is currently climbing.

  • False — The drone is not climbing.

move forward stack block#
    <climb active?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [After the drone starts to climb, play a sound and land.]
    take off to [500] [mm v] ▶
    climb [up v]
    wait [1] seconds
    if <climb active?> then
    play sound [looping v] ▶
    land ▶

move active?#

The move active? block returns a Boolean indicating whether the drone is currently using a move block.

  • True — The drone is currently using a move block.

  • False — The drone is not currently using a move block.

is move active report block#
    <move active?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [After the drone starts to move, play a sound and land.]
    take off to [500] [mm v] ▶
    move [forward v]
    wait [1] seconds
    if <move active?> then
    play sound [looping v] ▶
    land ▶

turn active?#

The turn active? block returns a Boolean indicating whether the drone is turning.

  • True — The drone is currently turning.

  • False — The drone is not turning.

turn active reporter block#
    <turn active?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [After the drone starts to turn, play a sound and land.]
    take off to (500) [mm v] ▶
    turn [right v]
    wait [1] seconds
    if <turn active?> then
    play sound [detected v] ▶
    land ▶

hovering?#

The hovering? block returns a Boolean indicating whether the drone is maintaining its position (hovering).

  • True — The drone is currently maintaining its position (hovering).

  • False — The drone is currently changing its position.

move forward stack block#
    <hovering?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Play a sound after the drone has finished taking off.]
    take off to [700] [mm v] ▶
    wait until <hovering?>
    wait [2] seconds
    play sound [pause v] ▶
    land ▶

taking off?#

The taking off? block returns a Boolean indicating whether the drone is in the process of taking off.

  • True — The drone is currently in the process of taking off.

  • False — The drone is not in the process of taking off.

move forward stack block#
    <taking off?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Play sounds while the drone is taking off.]
    take off to [700] mm ◀ and don't wait
    wait [1] seconds
    while <taking off?>
    play sound [sensing v] ▶

landing?#

The landing? block returns a Boolean indicating whether the drone is in the process of landing.

  • True — The drone is currently in the process of landing.

  • False — The drone is not in the process of landing.

move forward stack block#
    <landing?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Play sounds while the drone is landing.]
    take off to (500) [mm v] ▶
    wait [1] seconds
    land ◀ and don't wait
    wait [1] seconds
    while <landing?>
    play sound [looping v] ▶

landed?#

The landed? block returns a Boolean indicating whether the drone has landed.

  • True — The drone has landed.

  • False — The drone has not landed.

landed Boolean block#
    <landed?>

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    [Celebrate a successful landing.]
    take off to (500) [mm v] ▶
    wait (1) seconds
    land ▶
    if <landed> then
    play sound [success v] ▶