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.
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
set_steering_mode – Sets the POV for steering the drone.
set_movement_mode – Sets the movement style of the drone.
set_climb_velocity – Sets the default climbing speed.
set_move_velocity – Sets the default movement speed.
set_turn_velocity - Sets the default turning speed.
set_max_altitude - Sets the maximum altitude.
set_xyz_position – Sets the drone’s current position.
Getters
get_altitude – Returns the drone’s altitude.
get_flight_state – Returns the current state of the drone.
get_x_position – Returns the drone’s x-coordinate.
get_y_position – Returns the drone’s y-coordinate.
get_z_position – Returns the drone’s z-coordinate.
get_safe_mode – Returns the drone’s propellor lock state.
is_climb_active – Returns whether the drone is currently climbing.
is_move_active – Returns whether the drone is currently moving.
is_turn_active – Returns whether the drone is currently turning.
is_hovering - Returns whether the drone is currently hovering.
is_taking_off – Returns whether the drone is currently taking off.
is_landing – Returns whether the drone is currently landing.
is_landed - Returns whether the drone is currently landed.
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 |
---|---|
|
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 |
---|---|
|
Optional. The time to wait before landing in |
# 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 |
---|---|
|
The direction in which the drone will fly:
|
|
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 |
---|---|
|
The direction in which the drone will fly:
|
|
The distance the drone will fly for. |
|
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%. |
|
Optional. The unit that represents the distance:
|
|
Optional.
|
# 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 |
---|---|
|
The heading, as an integer or float, at which the drone moves, ranging from 0 to 360 degrees. |
|
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%. |
|
Optional.
|
# 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 |
---|---|
|
The heading, as an integer or float, at which the drone moves, ranging from 0 to 360 degrees. |
|
The distance, as an integer or float, that the drone will move, measured in millimeters (mm). |
|
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%. |
|
Optional. The unit that represents the distance:
|
|
Optional.
|
# Example coming soon
turn#
turn
turns the drone in a specific direction.
Usage:
drone.turn(direction, speed)
Parameters |
Description |
---|---|
|
The direction the drone will turn:
|
|
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 |
---|---|
|
The direction the drone will turn:
|
|
The angle, as an integer or float, at which the drone turns, ranging from 0 to 360 degrees. |
|
The velocity at which the drone will turn as a float or integer. If the velocity is not specified ( |
|
Optional.
|
# Example coming soon
turn_to#
turn_to
turns the drone to face a specific heading.
Usage:
drone.turn_to(heading, speed, wait)
Parameters |
Description |
---|---|
|
The heading that the drone will turn to face from 0 to 360 degrees. |
|
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%. |
|
Optional.
|
# 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 |
---|---|
|
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. |
|
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. |
|
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. |
|
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 |
---|---|
|
Sets the POV that is used to steer the drone.
|
# Example coming soon
set_movement_mode#
set_movement_mode
sets the drone’s movement style.
Usage:
drone.set_movement_mode(style)
Parameters |
Description |
---|---|
|
Sets the speed that is used to steer the drone.
|
# 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 |
---|---|
|
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 |
---|---|
|
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 |
---|---|
|
The new x-coordinate in |
|
The new y-coordinate in |
|
The new z-coordinate in |
|
Optional. The unit that represents the distance:
|
# 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