Βραχίονας 6 αξόνων#
Εισαγωγή#
Ο ρομποτικός βραχίονας 6 αξόνων της VEX μπορεί να μετακινήσει έναν ακραίο ενεργοποιητή σε τρισδιάστατο χώρο, να ελέγξει τον προσανατολισμό του χρησιμοποιώντας περιστροφές εκτροπής, κύλισης και κλίσης, και να χρησιμοποιήσει προσαρτημένα εργαλεία όπως το εργαλείο συλλογής μαγνήτη ή το εργαλείο θήκης στυλό.
The 6-Axis Arm is not configured as a device in VEXcode V5. To use it in a VEX V5 Python project, manually create an Arm object in code with the Smart Port that the 6-Axis Arm is connected to.
The examples on this page use a manually constructed 6-Axis Arm named arm1.
Παρακάτω είναι μια λίστα με όλες τις διαθέσιμες μεθόδους:
Ενέργειες — Μετακινήστε τον βραχίονα 6 αξόνων σε θέσεις ή προσανατολισμούς.
move_to— Moves the end effector to a specified x, y, and z coordinate.move_inc— Moves the end effector by a specified distance from its current position.move_end_effector_to— Rotates the end effector to a specified yaw, roll, and pitch orientation.move_end_effector_inc— Rotates the end effector by a specified yaw, roll, and pitch amount.
Μεταλλαγμένοι — Διαμορφώστε τις ρυθμίσεις κίνησης, εργαλείων και ελέγχου.
set_speed— Sets the movement speed used by the 6-Axis Arm.set_end_effector_type— Sets the type of end effector attached to the 6-Axis Arm.set_end_effector_magnet— Engages or releases the Magnet Pickup Tool.set_pen_offset— Sets the z-axis offset used with the Pen Holder Tool.set_control_stop— Enables control stop for the 6-Axis Arm.set_timeout— Sets the timeout used by 6-Axis Arm movement methods.
Λήπτες — Επιστρέφουν τιμές κατάστασης κίνησης, θέσης, προσανατολισμού και σύνδεσης.
is_done— Returns whether the 6-Axis Arm has finished moving.is_crashed— Returns whether the 6-Axis Arm has crashed while moving.get_x— Returns the current x position of the end effector.get_y— Returns the current y position of the end effector.get_z— Returns the current z position of the end effector.get_pitch— Returns the current pitch of the end effector.get_roll— Returns the current roll of the end effector.get_yaw— Returns the current yaw of the end effector.can_arm_reach_to— Returns whether the 6-Axis Arm can reach a specified position.can_arm_reach_inc— Returns whether the 6-Axis Arm can move by a specified distance.can_end_effector_reach_to— Returns whether the end effector can reach a specified orientation.can_end_effector_reach_inc— Returns whether the end effector can rotate by a specified amount.get_timeout— Returns the current timeout value used by movement methods.is_connected— Returns whether the 6-Axis Arm is connected to the V5 Brain.
Επανακλήσεις — Εκτέλεση συναρτήσεων όταν συμβαίνουν συμβάντα όπλισης.
control_stopped— Registers a function to run when control stop is enabled.crashed— Registers a function to run when a crash is detected.
Κατασκευαστής — Δημιουργήστε χειροκίνητα ένα αντικείμενο βραχίονα 6 αξόνων.
Arm— Creates a 6-Axis Arm object.
Ενέργειες#
move_to#
move_to moves the 6-Axis Arm to a specified x, y, and z coordinate.
The x, y, and z coordinates describe the position of the end effector in three-dimensional space. Use can_arm_reach_to before this method if the target position may be outside the 6-Axis Arm’s reachable workspace.
Usage:
arm1.move_to(x, y, z, wait)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η συντεταγμένη x της θέσης-στόχου σε χιλιοστά. |
|
Η συντεταγμένη y της θέσης-στόχου σε χιλιοστά. |
|
Η συντεταγμένη z της θέσης-στόχου σε χιλιοστά. |
|
Optional. |
# Move the 6-Axis Arm to (40, 140, 210)
arm1.move_to(40, 140, 210)
# Start moving, then print the y-position while the arm moves
arm1.move_to(-100, 200, 100, wait=False)
while not arm1.is_done():
brain.screen.print(arm1.get_y())
brain.screen.next_row()
wait(0.25, SECONDS)
move_inc#
move_inc moves the 6-Axis Arm by a specified distance from its current position along the x, y, and z axes.
Use this method to move relative to where the end effector is now. Use can_arm_reach_inc before this method if the movement may place the 6-Axis Arm outside its reachable workspace.
Usage:
arm1.move_inc(x, y, z, wait)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η απόσταση που απαιτείται για την κίνηση κατά μήκος του άξονα x σε χιλιοστά. |
|
Η απόσταση που απαιτείται για να κινηθεί κανείς κατά μήκος του άξονα y σε χιλιοστά. |
|
Η απόσταση που απαιτείται για την κίνηση κατά μήκος του άξονα z σε χιλιοστά. |
|
Optional. |
# Move the 6-Axis Arm 100 millimeters along the y-axis
arm1.move_inc(0, 100, 0)
move_end_effector_to#
move_end_effector_to rotates the 6-Axis Arm’s end effector to a specified yaw, roll, and pitch orientation.
Orientation describes how the end effector is rotated. yaw rotates around the z-axis, roll rotates around the x-axis, and pitch rotates around the y-axis.
Usage:
arm1.move_end_effector_to(yaw, roll, pitch, wait)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η γωνία εκτροπής του στόχου, σε μοίρες. |
|
Η γωνία κύλισης του στόχου, σε μοίρες. |
|
Η γωνία βήματος του στόχου, σε μοίρες. |
|
Optional. |
# Rotate the end effector to 90 degrees of roll
arm1.move_end_effector_to(0, 90, 0)
move_end_effector_inc#
move_end_effector_inc rotates the 6-Axis Arm’s end effector by a specified yaw, roll, and pitch amount from its current orientation.
Χρησιμοποιήστε αυτήν τη μέθοδο για περιστροφή σε σχέση με την τρέχουσα εκτροπή, κύλιση ή βήμα του τελικού ενεργοποιητή.
Usage:
arm1.move_end_effector_inc(yaw, roll, pitch, wait)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η αλλαγή στην εκτροπή, σε μοίρες. |
|
Η αλλαγή στην κύλιση, σε μοίρες. |
|
Η αλλαγή στο ύψος της φωνής, σε μοίρες. |
|
Optional. |
# Rotate the end effector -50 degrees in pitch
arm1.move_end_effector_inc(0, 0, -50)
Μεταλλάκτες#
set_speed#
set_speed sets the movement speed used by the 6-Axis Arm for movement methods.
Η ταχύτητα του βραχίονα 6 αξόνων έχει οριστεί στο 50% στην αρχή ενός έργου.
Usage:
arm1.set_speed(speed)
Παράμετρος |
Περιγραφή |
|---|---|
|
The movement speed of the 6-Axis Arm, from |
# Set the 6-Axis Arm speed to 30%
arm1.set_speed(30)
set_end_effector_type#
set_end_effector_type sets the type of end effector attached to the 6-Axis Arm.
When the end effector type is changed, the 6-Axis Arm automatically adjusts its z-offset to match the selected tool. The end effector type is set to MAGNET at the start of a project.
Usage:
arm1.set_end_effector_type(type)
Παράμετρος |
Περιγραφή |
|---|---|
|
The tool attached to the 6-Axis Arm: |
# Set the end effector type to the Pen Holder Tool
arm1.set_end_effector_type(PEN)
set_end_effector_magnet#
set_end_effector_magnet engages or releases the Magnet Pickup Tool.
The magnet state stays active until another set_end_effector_magnet method changes it. The magnet state is reset to False at the start of a project.
Usage:
arm1.set_end_effector_magnet(state)
Παράμετρος |
Περιγραφή |
|---|---|
|
The Magnet Pickup Tool state: |
# Pick up objects and then drop them
arm1.set_end_effector_type(MAGNET)
arm1.set_end_effector_magnet(True)
wait(2, SECONDS)
arm1.set_end_effector_magnet(False)
set_pen_offset#
set_pen_offset sets the z-axis offset used when the Pen Holder Tool is attached to the 6-Axis Arm.
Set the end effector type to PEN before using this method. If the Pen Holder Tool is not selected, this method has no effect.
The pen offset is the distance from the top of the Pen Holder Tool to the tip of the Dry-Erase Marker. At the start of a project, the pen offset is set to 0. A pen offset of 0 places the arm’s z-axis origin at the point where the Pen Holder Tool connects to the 6-Axis Arm.
Usage:
arm1.set_pen_offset(zOffset)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η τιμή μετατόπισης της πένας σε χιλιοστά. |
# Set the end effector type to the Pen Holder Tool and set the pen offset
arm1.set_end_effector_type(PEN)
arm1.set_pen_offset(25)
set_control_stop#
set_control_stop enables control stop for the 6-Axis Arm.
Όταν ενεργοποιηθεί η διακοπή ελέγχου, ο βραχίονας 6 αξόνων σταματά αμέσως οποιαδήποτε κίνηση και δεν θα εκτελέσει περαιτέρω μεθόδους κίνησης βραχίονα μέχρι να επανεκκινηθεί το έργο.
Usage:
arm1.set_control_stop(state)
Παράμετρος |
Περιγραφή |
|---|---|
|
Optional. |
# Stop the 6-Axis Arm and prevent further movement
arm1.set_control_stop()
set_timeout#
set_timeout sets the timeout value used when moving the 6-Axis Arm.
Εάν μια κίνηση δεν ολοκληρωθεί πριν από τη λήξη του χρονικού ορίου, το έργο συνεχίζει στην επόμενη γραμμή κώδικα.
Usage:
arm1.set_timeout(timeout, units)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η νέα τιμή χρονικού ορίου. |
|
Optional. The time unit: |
# Set the 6-Axis Arm timeout to 2 seconds
arm1.set_timeout(2, SECONDS)
Αποκτητές#
is_done#
is_done returns whether the 6-Axis Arm has finished moving.
This method is useful after a movement method is called with wait=False.
True— The 6-Axis Arm has finished moving.False— The 6-Axis Arm is still moving.
Usage:
arm1.is_done()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Display the 6-Axis Arm's y-position while it moves
arm1.move_to(-100, 200, 100, wait=False)
while not arm1.is_done():
brain.screen.print(arm1.get_y())
brain.screen.next_row()
wait(0.25, SECONDS)
is_crashed#
is_crashed returns whether the 6-Axis Arm has crashed while moving.
Όταν ανιχνευθεί σύγκρουση, ο βραχίονας 6 αξόνων σταματά την κίνηση του κινητήρα και μπορεί να φαίνεται ότι χαλαρώνει. Αυτό μειώνει την καταπόνηση και βοηθά στην προστασία των κινητήρων από τυχαίες ζημιές.
True— The 6-Axis Arm has crashed.False— The 6-Axis Arm has not crashed.
Usage:
arm1.is_crashed()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Quickly move to a new location
arm1.set_speed(100)
arm1.move_to(-30, 240, 40, wait=False)
# While moving, check for a crash
while True:
if arm1.is_crashed():
# Indicate a crash with the Brain screen
brain.screen.print("Crash Detected")
break
wait(5, MSEC)
get_x#
get_x returns the current x position of the end effector in millimeters.
Χρησιμοποιήστε αυτήν τη μέθοδο για να διαβάσετε πού βρίσκεται τη δεδομένη στιγμή ο τελικός τελεστής κατά μήκος του άξονα x.
Usage:
arm1.get_x()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current x position of the 6-Axis Arm
brain.screen.print(arm1.get_x())
get_y#
get_y returns the current y position of the end effector in millimeters.
Χρησιμοποιήστε αυτήν τη μέθοδο για να διαβάσετε πού βρίσκεται ο τελικός τελεστής κατά μήκος του άξονα y.
Usage:
arm1.get_y()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current y position of the 6-Axis Arm
brain.screen.print(arm1.get_y())
get_z#
get_z returns the current z position of the end effector in millimeters.
Χρησιμοποιήστε αυτήν τη μέθοδο για να διαβάσετε πού βρίσκεται τη δεδομένη στιγμή ο τελικός τελεστής κατά μήκος του άξονα z.
Usage:
arm1.get_z()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current z position of the 6-Axis Arm
brain.screen.print(arm1.get_z())
get_pitch#
get_pitch returns the current pitch of the end effector in degrees.
Usage:
arm1.get_pitch()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current pitch of the end effector
brain.screen.print(arm1.get_pitch())
get_roll#
get_roll returns the current roll of the end effector in degrees.
Usage:
arm1.get_roll()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current roll of the end effector
brain.screen.print(arm1.get_roll())
get_yaw#
get_yaw returns the current yaw of the end effector in degrees.
Usage:
arm1.get_yaw()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current yaw of the end effector
brain.screen.print(arm1.get_yaw())
can_arm_reach_to#
can_arm_reach_to returns whether the 6-Axis Arm can move the end effector to a specified x, y, and z coordinate.
Use this method to check a target position before using move_to.
True— The 6-Axis Arm can reach the requested position.False— The 6-Axis Arm cannot reach the requested position.
Usage:
arm1.can_arm_reach_to(x, y, z)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η συντεταγμένη x της θέσης-στόχου σε χιλιοστά. |
|
Η συντεταγμένη y της θέσης-στόχου σε χιλιοστά. |
|
Η συντεταγμένη z της θέσης-στόχου σε χιλιοστά. |
# Move the 6-Axis Arm to (100, -20, 50) if it can reach
if arm1.can_arm_reach_to(100, -20, 50):
arm1.move_to(100, -20, 50)
can_arm_reach_inc#
can_arm_reach_inc returns whether the 6-Axis Arm can move the end effector by a specified x, y, and z distance from its current position.
Use this method to check a relative movement before using move_inc.
True— The 6-Axis Arm can make the requested movement.False— The 6-Axis Arm cannot make the requested movement.
Usage:
arm1.can_arm_reach_inc(x, y, z)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η απόσταση που απαιτείται για την κίνηση κατά μήκος του άξονα x σε χιλιοστά. |
|
Η απόσταση που απαιτείται για να κινηθεί κανείς κατά μήκος του άξονα y σε χιλιοστά. |
|
Η απόσταση που απαιτείται για την κίνηση κατά μήκος του άξονα z σε χιλιοστά. |
# Increment the 6-Axis Arm 100 mm along the x-axis if possible
if arm1.can_arm_reach_inc(100, 0, 0):
arm1.move_inc(100, 0, 0)
can_end_effector_reach_to#
can_end_effector_reach_to returns whether the end effector can rotate to a specified yaw, roll, and pitch orientation.
Use this method to check a target orientation before using move_end_effector_to.
True— The end effector can reach the requested orientation.False— The end effector cannot reach the requested orientation.
Usage:
arm1.can_end_effector_reach_to(yaw, roll, pitch)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η γωνία εκτροπής του στόχου, σε μοίρες. |
|
Η γωνία κύλισης του στόχου, σε μοίρες. |
|
Η γωνία βήματος του στόχου, σε μοίρες. |
# Rotate the end effector to 90 degrees of roll if possible
if arm1.can_end_effector_reach_to(0, 90, 0):
arm1.move_end_effector_to(0, 90, 0)
can_end_effector_reach_inc#
can_end_effector_reach_inc returns whether the end effector can rotate by a specified yaw, roll, and pitch amount from its current orientation.
Use this method to check a relative orientation movement before using move_end_effector_inc.
True— The end effector can make the requested rotation.False— The end effector cannot make the requested rotation.
Usage:
arm1.can_end_effector_reach_inc(yaw, roll, pitch)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η αλλαγή στην εκτροπή, σε μοίρες. |
|
Η αλλαγή στην κύλιση, σε μοίρες. |
|
Η αλλαγή στο ύψος της φωνής, σε μοίρες. |
# Increment the end effector by 10 degrees of pitch if possible
if arm1.can_end_effector_reach_inc(0, 0, 10):
arm1.move_end_effector_inc(0, 0, 10)
get_timeout#
get_timeout returns the timeout value used by 6-Axis Arm movement methods in milliseconds.
Usage:
arm1.get_timeout()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print the current movement timeout in milliseconds
brain.screen.print(arm1.get_timeout())
is_connected#
is_connected returns whether the 6-Axis Arm is connected to the V5 Brain.
True— The 6-Axis Arm is connected to the V5 Brain.False— The 6-Axis Arm is not connected to the V5 Brain.
Usage:
arm1.is_connected()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Print whether the 6-Axis Arm is connected
brain.screen.print(arm1.is_connected())
Επανακλήσεις#
control_stopped#
control_stopped registers a function that runs when control stop is enabled.
This method returns an instance of the Event class.
Usage:
arm1.control_stopped(callback, arg)
Παράμετρος |
Περιγραφή |
|---|---|
|
Μια προηγουμένως καθορισμένη συνάρτηση που εκτελείται όταν είναι ενεργοποιημένη η διακοπή ελέγχου. |
|
Προαιρετικό. Μια πλειάδα που περιέχει ορίσματα για να μεταβιβαστούν στη συνάρτηση επανάκλησης. Δείτε Χρήση Συναρτήσεων με Παραμέτρους για περισσότερες πληροφορίες. |
# Define a function to run when control stop is enabled
def when_control_stopped():
brain.screen.print("The arm has been control stopped")
# Run when_control_stopped when the 6-Axis Arm is control stopped
arm1.control_stopped(when_control_stopped)
crashed#
crashed registers a function that runs when the 6-Axis Arm has crashed while moving.
Όταν ανιχνευθεί σύγκρουση, ο βραχίονας 6 αξόνων σταματά την κίνηση του κινητήρα και μπορεί να φαίνεται ότι χαλαρώνει. Αυτό μειώνει την καταπόνηση και βοηθά στην προστασία των κινητήρων από τυχαίες ζημιές.
Usage:
arm1.crashed(callback)
Παράμετρος |
Περιγραφή |
|---|---|
|
Μια προηγουμένως καθορισμένη συνάρτηση που εκτελείται όταν ανιχνεύεται σφάλμα. |
# Define what happens if a crash is detected
def arm_crash():
brain.screen.print("Crash Detected")
# Run arm_crash when the 6-Axis Arm crashes
arm1.crashed(arm_crash)
Κατασκευαστές#
Arm#
Arm creates a 6-Axis Arm object. The 6-Axis Arm must be manually constructed in VEXcode V5 before it can be used in a project.
Usage:
Arm(smartport)
Παράμετρος |
Περιγραφή |
|---|---|
|
The Smart Port that the 6-Axis Arm is connected to, written as |
# Construct a 6-Axis Arm named arm1 with the Arm class
arm1 = Arm(Ports.PORT1)