Motion#

Introduction#

The VEX AIR Drone features four propellors, 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 all available methods:

Actions

  • 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.

  • move_at – Moves the drone at a specified heading and velocity.

  • move_for – Moves the drone at a specific heading for a specified distance.

  • turn – Turns the drone left or right.

  • turn_for – Turns the drone a set number of degrees.

  • turn_to – Turns the drone to face a specific heading.

  • move_with_vectors – Moves the drone using vector-based x, y, z, and rotation values.

Mutators

Getters

Actions#

take_off#

take_off lifts the drone into the air. The default takeoff height is around 500 millimeters.

Usage:

drone.take_off(distance)

Parameters

Description

distance

Optional. The height at which the drone flies to from 100 to 850 mm.

# Example coming soon

land#

land lands the drone.

Usage:

drone.land(wait)

Parameters

Description

wait

Optional. The time to wait before landing in seconds.

# Example coming soon

hover#

hover makes the drone hover in the air.

Usage:
drone.hover()

Parameters

Description

This method has no parameters.

# Example coming soon

climb#

climb moves the drone in a specified vertical direction.

Usage:

drone.climb(direction, speed)

Parameters

Description

direction

The direction in which the drone will fly:

  • UP
  • DOWN

speed

Optional. The velocity at which the drone will climb as a float or integer. If the velocity is not specified, the default velocity is 50%.

# Example coming soon

climb_for#

climb_for moves the drone in a specified vertical direction for a specific distance.

Usage:

drone.climb_for(direction, altitude, speed, units, wait)

Parameters

Description

direction

The direction in which the drone will fly:

  • UP
  • DOWN

altitude

The distance the drone will fly for.

speed

Optional. The velocity at which the drone will climb as a float or integer. If the velocity is not specified, the default velocity is 50%.

units

Optional. The unit that represents the distance:

  • DistanceUnits.CM – Centimeters
  • MM (default) – Millimeters
  • INCHES

wait

Optional.

  • wait=True (default) – The drone waits until climb_for is complete before executing the next line of code.
  • wait=False – The drone starts the action and moves on to the next line of code right away, without waiting for climb_for to finish.

# Example coming soon

move_at#

move_at moves the drone at a specified heading and velocity.

Usage:

drone.move_at(direction, speed, wait)

Parameters

Description

direction

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

speed

Optional. The velocity at which the drone will move as a float or integer. If the velocity is not specified, the default velocity is 50%.

wait

Optional.

  • wait=True (default) – The drone waits until move_at is complete before executing the next line of code.
  • wait=False – The drone starts the action and moves on to the next line of code right away, without waiting for move_at to finish.

# Example coming soon

move_for#

move_for moves the drone at a specific heading for a specified distance.

Usage:

drone.move_for(direction, distance, speed, units, wait)

Parameters

Description

direction

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

distance

The distance, as an integer or float, that the drone will move, measured in millimeters (mm).

speed

Optional. The velocity at which the drone will move as a float or integer. If the velocity is not specified, the default velocity is 50%.

units

Optional. The unit that represents the distance:

  • DistanceUnits.CM – Centimeters
  • MM (default) – Millimeters
  • INCHES

wait

Optional.

  • wait=True (default) – The drone waits until move_for is complete before executing the next line of code.
  • wait=False – The drone starts the action and moves on to the next line of code right away, without waiting for move_for to finish.

# Example coming soon

turn#

turn turns the drone in a specific direction.

Usage:

drone.turn(direction, speed)

Parameters

Description

direction

The direction the drone will turn:

  • LEFT
  • RIGHT

speed

Optional. The velocity at which the drone will turn as a float or integer. If the velocity is not specified, the default velocity is 50%.

# Example coming soon

turn_for#

turn_for turns the drone in a specified direction for a specified angle relative to its current facing direction.

Usage:

drone.turn_for(direction, angle, speed, wait)

Parameters

Description

direction

The direction the drone will turn:

  • LEFT
  • RIGHT

angle

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

speed

The velocity at which the drone will turn as a float or integer. If the velocity is not specified (speed = 0), the default velocity is 50%.

wait

Optional.

  • wait=True (default) – The drone waits until turn_for is complete before executing the next line of code.
  • wait=False – The drone starts the action and moves on to the next line of code right away, without waiting for turn_for to finish.

# Example coming soon

turn_to#

turn_to turns the drone to face a specific heading.

Usage:

drone.turn_to(heading, speed, wait)

Parameters

Description

heading

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

speed

Optional. The velocity at which the drone will turn as a float or integer. If the velocity is not specified, the default velocity is 50%.

wait

Optional.

  • wait=True (default) – The drone waits until turn_to is complete before executing the next line of code.
  • wait=False – The drone starts the action and moves on to the next line of code right away, without waiting for turn_to to finish.

# Example coming soon

move_with_vectors#

move_with_vectors moves the drone using vector-based motion, combining movement on the X-axis, Y-axis, and Z-axis while having the drone rotate at the same time.

Usage:

drone.move_with_vectors(forward, rightward, upward, rotation)

Parameters

Description

forward

The drone’s velocity along the Y-axis (forward and backward movement). Accepts a value from -100 to 100 as a percent, where negative values move backward and positive values move forward.

rightward

The drone’s velocity along the X-axis (side-to-side movement). Accepts a value from -100 to 100 as a percent, where negative values move left and positive values move right.

upward

The drone’s velocity along the Z-axis (up and down movement). Accepts a value from -100 to 100 as a percent, where negative values move down and positive values move up.

rotation

The drone’s rotational velocity. Accepts a value from -100 to 100 as a percent, where negative values rotate counterclockwise and positive values rotate clockwise.

# Example coming soon

Mutators#

set_steering_mode#

set_steering_mode sets the POV that is used to steer the drone with the VEX AIR Drone Controller.

Usage:

drone.set_steering_mode(style)

Parameters

Description

style

Sets the POV that is used to steer the drone.

  • HEADLESS – The drone moves relative to where it was facing at the start of the project.
  • STANDARD (default) – The drone moves relative to where it is facing.

# Example coming soon

set_movement_mode#

set_movement_mode sets the drone’s movement style.

Usage:

drone.set_movement_mode(style)

Parameters

Description

style

Sets the speed that is used to steer the drone.

  • BALANCED – The drone moves at a medium base speed.
  • PERFORMANCE – The drone moves at a faster base speed.
  • PRECISION (default) – The drone moves at a slower base speed.

# Example coming soon

set_climb_velocity#

set_climb_velocity overrides the default velocity for all subsequent climbing methods in the project.

Usage:

drone.set_climb_velocity(speed)

Parameters

Description

speed

The velocity at which the drone will climb as a float or integer. If the velocity is not specified, the default velocity is 50%.

# Example coming soon

set_move_velocity#

set_move_velocity overrides the default velocity for all subsequent movement methods in the project.

Usage:

drone.set_move_velocity(speed)

Parameters

Description

speed

The velocity at which the drone will move as a float or integer. If the velocity is not specified, the default velocity is 50%.

# Example coming soon

set_turn_velocity#

Documentation Coming Soon

set_max_altitude#

Documentation Coming Soon

set_xyz_position#

set_xyz_position sets the drone’s current position to specified values. This updates the drone’s internal coordinates.

Usage:

drone.set_xyz_position(x, y, z, units)

Parameters

Description

x

The new x-coordinate in units as a float.

y

The new y-coordinate in units as a float.

z

The new z-coordinate in units as a float.

units

Optional. The unit that represents the distance:

  • DistanceUnits.CM – Centimeters
  • MM (default) – Millimeters
  • INCHES
# Example coming soon

Getters#

get_altitude#

drone.get_altitude returns the drone’s altitude as a float in meters.

Usage:

drone.get_altitude()

Parameters

Description

This method has no parameters.

# Example coming soon

get_flight_state#

get_flight_state returns the drone’s current flying state as a DroneFlightStateType:

  • DroneFlightStateType.OFF - The drone is turned off.

  • DroneFlightStateType.CALIBRATION - The drone is calibrating its sensors.

  • DroneFlightStateType.MOTOR_START - The drone is starting its motors.

  • DroneFlightStateType.FLIGHT_READY - The drone is ready to fly.

  • DroneFlightStateType.FLIGHT - The drone is in flight.

Usage:
drone.get_flight_state()

Parameters

Description

This method has no parameters.

# Example coming soon

get_x_position#

get_x_position returns the drone’s x-coordinate as a float in meters.

Usage:

drone.get_x_position()

Parameters

Description

This method has no parameters.

# Example coming soon

get_y_position#

get_y_position returns the drone’s y-coordinate as a float in meters.

Usage:

drone.get_y_position()

Parameters

Description

This method has no parameters.

# Example coming soon

get_z_position#

get_y_position returns the drone’s z-coordinate as a float in meters.

Usage:

drone.get_z_position()

Parameters

Description

This method has no parameters.

# Example coming soon

get_safe_mode#

get_safe_mode returns the propellor lock state of the drone.

Usage:

drone.get_safe_mode()

Parameters

Description

This method has no parameters.

# Example coming soon

is_climb_active#

is_climb_active returns a Boolean indicating whether the drone is climbing.

  • True – The drone is currently climbing.

  • False – The drone is not climbing.

Usage:

drone.is_climb_active()

Parameters

Description

This method has no parameters.

# Example coming soon

is_move_active#

is_move_active returns a Boolean indicating whether the drone is currently moving.

  • True – The drone is moving.

  • False – The drone is not moving.

Usage:

drone.is_move_active()

Parameters

Description

This method has no parameters.

# Example coming soon

is_turn_active#

is_turn_active returns a Boolean indicating whether the drone is currently turning.

  • True – The drone is turning.

  • False – The drone is not turning.

Usage:

drone.is_turn_active()

Parameters

Description

This method has no parameters.

# Example coming soon

is_hovering#

is_hovering returns a Boolean indicating whether the drone is currently hovering.

  • True – The drone is hovering.

  • False – The drone is not hovering.

Usage:

drone.is_hovering()

Parameters

Description

This method has no parameters.

# Example coming soon

Documentation Coming Soon

is_taking_off#

is_taking_off returns a Boolean indicating whether the drone is currently taking off.

  • True – The drone is taking off.

  • False – The drone is not taking off.

Usage:

drone.is_taking_off()

Parameters

Description

This method has no parameters.

# Example coming soon

is_landing#

is_landing returns a Boolean indicating whether the drone is currently landing.

  • True – The drone is landing.

  • False – The drone is not landing.

Usage:

drone.is_landing()

Parameters

Description

This method has no parameters.

# Example coming soon

is_landed#

is_landed returns a Boolean indicating whether the drone is currently landed.

  • True – The drone is landed.

  • False – The drone is not landed.

Usage:

drone.is_landed()

Parameters

Description

This method has no parameters.

# Example coming soon