Μονάδα μέτρησης#
Εισαγωγή#
Το VEX AIR Drone διαθέτει μια θύρα μονάδας, η οποία μπορεί να συνδεθεί με διάφορες μονάδες VEX AIR. Αυτές επιτρέπουν στο drone να ρίχνει και να κρατάει διαφορετικά ωφέλιμα φορτία.
Σημείωση: Αυτές οι μέθοδοι λειτουργούν μόνο με τη μονάδα μηχανοκίνητου γάντζου και τη μονάδα μαγνήτη.
Παρακάτω είναι μια λίστα με όλες τις διαθέσιμες μεθόδους:
Ενέργειες
drop_payload– Releases a payload using the attached module.hold_payload– Holds a payload using the attached module.
Αποκτητές
get_type– Returns the type of module that is attached to the drone.is_holding– Returns the current state of the Motorized Hook Module.
Ενέργειες#
drop_payload#
drop_payload releases a payload using the attached module. The Motorized Hook Module opens its hook, and the Magnet Module turns its magnet off.
Σημείωση: Αυτή η μέθοδος λειτουργεί μόνο με τη μονάδα μηχανοκίνητου γάντζου και τη μονάδα μαγνήτη.
Χρήση:
drone.module.drop_payload()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# 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 holds a payload using the attached module. The Motorized Hook Module closes its hook, and the Magnet Module turns its magnet on.
Σημείωση: Αυτή η μέθοδος λειτουργεί μόνο με τη μονάδα μηχανοκίνητου γάντζου και τη μονάδα μαγνήτη.
Χρήση:
drone.module.hold_payload()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# 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()
Αποκτητές#
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.
Χρήση:
drone.module.get_type()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# 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.
Σημείωση: Αυτή η μέθοδος λειτουργεί μόνο με τη μονάδα μηχανοκίνητου γάντζου.
Χρήση:
drone.module.is_holding()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# 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)