Γυροσκοπικός αισθητήρας#
Εισαγωγή#
Ο Γυροσκοπικός Αισθητήρας μετρά την κατεύθυνση και την περιστροφή του ρομπότ.
Η κατηγορία Αισθητήρας Γυροσκοπίου θα εμφανίζεται μόνο όταν ο αισθητήρας έχει διαμορφωθεί ανεξάρτητα, όχι ως μέρος μιας διαμόρφωσης συστήματος μετάδοσης κίνησης, στο παράθυρο Συσκευές.
This page uses gyro_sensor as the example Gyro Sensor name. Replace it with your own configured name as needed.
Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:
calibrate– Calibrates the configured Gyro Sensor.set_heading– Changes the Gyro Sensor’s current heading to a new heading.set_rotation– Changes the Gyro Sensor’s current rotation to a new rotation.heading– Returns the Gyro Sensor’s heading angle as afloat.rotation– Returns how much the Gyro Sensor has rotated since the project started as afloat.
Κατασκευαστής – Χειροκίνητη αρχικοποίηση ενός γυροσκοπικού αισθητήρα.
Gyro– Create a Gyro Sensor.
μετρώ την διάμετρο#
calibrate calibrates the Gyro Sensor. All subsequent methods will wait for the calibration to complete before executing. Calibration is an internal procedure that measures and compensates for sensor noise and drift over a specified period. During this time, the sensor must remain completely still (i.e., on a stable surface without any external movement). Movement during calibration will produce inaccurate results.
Usage:
gyro_sensor.calibrate()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
set_heading#
A heading is the direction the sensor is facing, measured in degrees. set_heading changes the Gyro Sensor’s current heading to a new heading value.
Για παράδειγμα, εάν ο αισθητήρας έχει στραφεί προς τα δεξιά, η ρύθμιση της κατεύθυνσης σε 0 μοίρες καθιστά αυτήν τη θέση προς τα δεξιά τις νέες 0 μοίρες. Στη συνέχεια, ο αισθητήρας μπορεί να παρακολουθήσει άλλες κατευθύνσεις με βάση αυτήν τη νέα κατεύθυνση.
Usage:
gyro_sensor.set_heading(value, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Η τιμή κατεύθυνσης, σε μοίρες, που θα οριστεί για τον αισθητήρα. Αυτή μπορεί να είναι μια τιμή από 0 έως 359,99. |
μονάδες |
Optional. The heading unit: |
set_rotation#
Rotation is how much the sensor has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. set_rotation changes the Gyro Sensor’s current rotation to a new value.
Για παράδειγμα, εάν ο αισθητήρας έχει κάνει δύο πλήρεις στροφές προς τα δεξιά, η τιμή περιστροφής του θα είναι 720 μοίρες. Η ρύθμιση της περιστροφής σε 0 μοίρες θα επαναφέρει αυτήν την περιστροφή από 720 σε 0 μοίρες. Στη συνέχεια, ο αισθητήρας μπορεί να παρακολουθεί τις περιστροφές με βάση αυτήν τη νέα τιμή.
Usage:
gyro_sensor.set_rotation(value, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The rotation value, in degrees, to set for the sensor. This can be an |
μονάδες |
Optional. The rotation unit: |
επικεφαλίδα#
A heading is the direction the sensor is facing, measured in degrees. heading returns that heading as a float from 0 to 359.99 degrees.
Η αρχική κατεύθυνση είναι 0 μοίρες.
Usage:
gyro_sensor.heading(units)
Παράμετροι |
Περιγραφή |
|---|---|
μονάδες |
Optional. The heading unit: |
περιστροφή#
Rotation is how much the sensor has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. rotation returns the Gyro Sensor’s current rotation.
Η δεξιά στροφή αυξάνει την περιστροφή και η αριστερά τη μειώνει. Για παράδειγμα, κάνοντας δύο πλήρεις στροφές προς τα δεξιά θα επιστρέψει μια περιστροφή 720 μοιρών.
Usage:
gyro_sensor.rotation(units)
Παράμετροι |
Περιγραφή |
|---|---|
μονάδες |
Optional. The rotation unit: |
Κατασκευαστής#
Constructors are used to manually create Gyro objects, which are necessary for configuring a Gyro Sensor outside of VEXcode.
Gyro#
Gyro creates a Gyro Sensor.
Usage:
Gyro(port)
Παράμετρος |
Περιγραφή |
|---|---|
|
The 3-Wire Port that the Gyro Sensor is connected to:
|
# Create a Gyro Sensor in Port A
gyro_sensor = Gyro(brain.three_wire_port.a)