Módulo#
Introducción#
El dron VEX AIR cuenta con un puerto modular que permite conectar varios módulos VEX AIR. Estos permiten al dron lanzar y transportar diferentes cargas útiles.
Nota: Solo el módulo de gancho motorizado y el módulo magnético se pueden controlar con estos métodos.
A continuación se muestra una lista de todos los métodos disponibles:
Comportamiento
drop_payload– Releases payloads.hold_payload– Allows payloads to be collected.
Conseguidores
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.
Comportamiento#
drop_payload#
drop_payload releases the currently held payload.
Uso:
drone.module.drop_payload()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
# Demonstrate the Motorized Hook Module moving
drone.take_off(climb_to=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.
Uso:
drone.module.hold()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
# Demonstrate the Motorized Hook Module moving
drone.take_off(climb_to=800)
wait(1, SECONDS)
drone.module.hold_payload()
wait(2, SECONDS)
drone.module.drop_payload()
drone.land()
Captadores#
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.
Uso:
drone.module.get_type()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
# 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.
Nota: Este método solo funciona con el módulo de gancho motorizado.
Uso:
drone.module.is_holding()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
# 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)