Module#
Introduction#
The VEX AIR Drone features a module port, which can connect to various VEX AIR Modules. These allow the drone to drop and hold different payloads.
Note: Only the Motorized Hook Module and the Magnet Module can be controlled with these methods.
Below is a list of all available methods:
Actions
drop_payload – Releases payloads.
hold_payload – Allows payloads to be collected.
Getters
get_type – Returns the type of module that is attached to the drone.
is_holding – Returns the current state of the Motorized Hook Module as a Boolean.
Actions#
drop_payload#
drop_payload
releases the currently held payload.
Usage:
drone.module.drop_payload()
Parameters |
Description |
---|---|
This method has no parameters. |
# Demonstrate the Motorized Hook Module moving
drone.take_off(starting_altitude=800)
wait(1, SECONDS)
drone.module.hold_payload()
wait(2, SECONDS)
drone.module.drop_payload()
drone.land()
hold_payload#
hold_payload
picks up the payload.
Usage:
drone.module.hold()
Parameters |
Description |
---|---|
This method has no parameters. |
# Demonstrate the Motorized Hook Module moving
drone.take_off(starting_altitude=800)
wait(1, SECONDS)
drone.module.hold_payload()
wait(2, SECONDS)
drone.module.drop_payload()
drone.land()
Getters#
get_type#
get_type
returns one of the following based on the module currently attached to the drone:
DroneModuleType.HOOK
– The Motorized Hook Module is attached.DroneModuleType.MAGNET
– The Magnet Module is attached.DroneModuleType.PASSIVE
– The Passive Hook Module is attached or no module is attached.
Usage:
drone.module.get_type()
Parameters |
Description |
---|---|
This method has no parameters. |
# Display what module is attached to the drone
# Change the module with Propeller Lock on during project
while True:
clear_console()
print(drone.module.get_type())
wait(0.2,SECONDS)
is_holding#
is_holding
returns a Boolean indicating whether the Motorized Hook Module is currently in the hold state, or in the drop state.
True
– The Motorized Hook Module is lowered.False
– The Motorized Hook Module is raised.
Note: This method only works with the Motorized Hook Module.
Usage:
drone.module.is_holding()
Parameters |
Description |
---|---|
This method has no parameters. |
# Create a custom button to toggle the Motorized Hook Module
def hook_toggle():
if drone.module.is_holding():
drone.module.drop_payload()
else:
drone.module.hold_payload()
controller.button5.pressed(hook_toggle)