Κωδικοποιητής#
Εισαγωγή#
Ο Οπτικός Κωδικοποιητής Άξονα μετρά τη θέση περιστροφής και την ταχύτητα ενός άξονα. Χρησιμοποιεί εσωτερικούς οπτικούς αισθητήρες για να ανιχνεύσει πόσο μακριά και πόσο γρήγορα περιστρέφεται ο άξονας, καθιστώντας τον χρήσιμο για την παρακολούθηση της περιστροφής του τροχού, της θέσης του βραχίονα ή άλλων μηχανισμών.

This page uses encoder_a as the example Optical Shaft Encoder name. Replace it with your own configured name as needed.
Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:
set_position– Sets the encoder’s current position to a specific value.reset_position– Sets the encoder’s current position to 0.position– Returns how far the encoder has rotated.velocity– Returns the current rotational velocity of the encoder.
Κατασκευαστής – Μη αυτόματη αρχικοποίηση και διαμόρφωση ενός κωδικοποιητή οπτικού άξονα.
Encoder– Create an Optical Shaft Encoder.
ορισμός_θέσης#
set_position sets the encoder’s current position to a specified value. This can be used to manually set the tracked position without rotating a motor or other mechanism.
Usage:
encoder_a.set_position(position, units)
Παράμετρος |
Περιγραφή |
|---|---|
|
Η θέση του κωδικοποιητή που θα οριστεί ως αριθμός. |
|
Optional. The unit to set the position with: |
# Set the encoder's position to 3 turns
encoder_a.set_position(3, TURNS)
επαναφορά_θέσης#
reset_position sets the encoder’s current position to 0.
Usage:
encoder_a.reset_position()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
θέση#
position returns how far the shaft connected to the encoder has rotated.
Usage:
encoder_a.position(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return the position with: |
ταχύτητα#
velocity returns the rotational velocity of the encoder as a decimal float.
Usage:
encoder_a.velocity(units)
Παράμετρος |
Περιγραφή |
|---|---|
|
Optional. The unit to return the velocity with: |
Κατασκευαστής#
Constructors are used to manually create Encoder objects, which are necessary for configuring an Optical Shaft Encoder outside of VEXcode.
Encoder#
Encoder creates an Optical Shaft Encoder.
Usage:
Encoder(port)
Παράμετρος |
Περιγραφή |
|---|---|
|
The first of the two 3-Wire Ports that the Optical Shaft Encoder is connected to:
|
# Create an Optical Shaft Encoder in Port A and B
encoder_a = Encoder(brain.three_wire_port.a)