Σύστημα μετάδοσης κίνησης#
Εισαγωγή#
Το ρομπότ VEX V5 χρησιμοποιεί ένα σύστημα μετάδοσης κίνησης για την κίνηση και την περιστροφή. Ένα σύστημα μετάδοσης κίνησης αποτελείται από κινητήρες και τροχούς που συνεργάζονται για να κινούν το ρομπότ.
Ένα διαμορφωμένο σύστημα μετάδοσης κίνησης μπορεί να χρησιμοποιήσει έναν Αδρανειακό Αισθητήρα, Αισθητήρα GPS, Γυροσκοπικό Αισθητήρα ή καθόλου αισθητήρα. Όταν χρησιμοποιείται ένας αισθητήρας, το σύστημα μετάδοσης κίνησης τον χρησιμοποιεί για να βοηθήσει το ρομπότ να κινηθεί και να στρίψει με ακρίβεια. Στην αρχή κάθε έργου, το σύστημα μετάδοσης κίνησης βαθμονομεί αυτόματα τον αισθητήρα. Κρατήστε το ρομπότ ακίνητο κατά τη βαθμονόμηση, ώστε το ρομπότ να μπορεί να κινείται και να στρίβει σωστά.
There are many ways to code the drivetrain. This page uses drivetrain as the example Drivetrain name. Replace it with your own configured name as needed.
Παρακάτω είναι μια λίστα με όλες τις μεθόδους μετάδοσης κίνησης:
Ενέργειες — Μετακίνηση και περιστροφή του ρομπότ.
drive— Moves the robot forward or reverse forever.drive_for— Moves the robot forward or reverse for a specific distance.turn— Turns the robot left or right forever.turn_for— Turns the robot left or right for a specific number of degrees.turn_to_heading— Turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.turn_to_rotation— Turns the robot to a specific rotation.stop— Stops the robot’s movement.calibrate_drivetrain– Calibrates the sensor configured with the drivetrain.
Μεταλλαγμένοι — Προσαρμόστε τις ρυθμίσεις του συστήματος μετάδοσης κίνησης.
set_drive_velocity— Tells the robot how fast to drive.set_turn_velocity— Tells the robot how fast to turn.set_stopping— Tells how the robot will stop moving: by braking, coasting, or holding.set_timeout— Sets how many seconds the robot will try to finish a movement.set_heading— Changes the robot’s current heading to a new heading.set_rotation— Changes the robot’s current rotation to a new rotation.set_turn_threshold– Tells how close the robot must get to a target angle before a turn is complete.set_turn_constant– Changes how strongly the robot corrects its turns.set_turn_direction_reverse– Changes whether the smart drivetrain’s turn direction is reversed.
Getters — Ελέγξτε την κατάσταση του συστήματος μετάδοσης κίνησης.
is_done— Returns whether the robot is finished moving, as a Boolean value.is_moving— Returns whether the robot is moving, as a Boolean value.heading— Returns the robot’s current heading from 0 to 359.99 degrees.rotation— Returns the robot’s current rotation.velocity— Returns how fast the robot is driving.current— Returns how much electrical current the drivetrain is using.power— Returns how quickly the drivetrain is using energy.torque— Returns how much torque the drivetrain is using.efficiency— Returns how efficiently the drivetrain is using power.temperature— Returns how warm the drivetrain is.get_timeout– Returns the current timeout setting.
Κατασκευαστές – Δημιουργήστε και διαμορφώστε χειροκίνητα το σύστημα μετάδοσης κίνησης.
DriveTrain– Creates a drivetrain without an Inertial Sensor, GPS Sensor, or Gyro Sensor.SmartDrive– Creates a drivetrain configured with an Inertial Sensor, GPS Sensor, or Gyro Sensor.
Ενέργειες#
drive#
drive moves the robot forward or reverse forever. The robot will continue to move until it is given another action, like turning or stopping. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Usage:
drivetrain.drive(direction, velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the robot moves: |
|
Optional. The velocity to drive with from 0% to 100% when using |
|
Optional. The velocity unit: |
# Drive forward, then stop
drivetrain.drive(FORWARD)
wait(2, SECONDS)
drivetrain.stop()
# Drive forward at 360 degrees per second
drivetrain.drive(FORWARD, 360.0, VelocityUnits.DPS)
drive_for#
drive_for moves the robot forward or reverse for a specific distance. The project will wait until the robot is done moving before the next line of code runs. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Usage:
drivetrain.drive_for(direction, distance, units, velocity, units_v, wait)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the robot moves: |
|
The distance the robot drives. This can be an |
|
Optional. The distance unit: |
|
Optional. The velocity to drive with from 0% to 100% when using |
|
Optional. The velocity unit: |
|
Optional. |
# Drive forwards and backwards
drivetrain.drive_for(FORWARD, 5)
wait(1, SECONDS)
drivetrain.drive_for(REVERSE, 5)
turn#
turn turns the robot left or right forever. The robot will continue to turn until it is given another action, like driving or stopping. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Usage:
drivetrain.turn(direction, velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the robot turns: |
|
Optional. The velocity to turn with from 0% to 100% when using |
|
Optional. The velocity unit: |
# Turn right, then stop
drivetrain.turn(RIGHT)
wait(2, SECONDS)
drivetrain.stop()
turn_for#
turn_for turns the robot left or right for a specific number of degrees. The turn is relative to the current position of the robot. The project will wait until the robot is done turning before the next line of code runs. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Usage:
drivetrain.turn_for(direction, angle, units, velocity, units_v, wait)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the robot turns: |
|
The number of degrees the robot turns. This can be an |
|
Optional. The turn unit: |
|
Optional. The velocity to turn with from 0% to 100% when using |
|
Optional. The velocity unit: |
|
Optional. |
# Turn left, then turn around to the right
drivetrain.turn_for(LEFT, 90)
drivetrain.turn_for(RIGHT, 180)
turn_to_heading#
A heading is the direction the robot is facing, measured in degrees. turn_to_heading turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.
Η αρχική κατεύθυνση του ρομπότ είναι 0 μοίρες.
Το έργο θα περιμένει μέχρι να ολοκληρώσει την περιστροφή του ρομπότ προτού εκτελεστεί η επόμενη γραμμή κώδικα.
Σημείωση: Αυτή η λειτουργία είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.turn_to_heading(angle, units, velocity, units_v, wait)
Παράμετροι |
Περιγραφή |
|---|---|
|
The direction the robot should face, in degrees. This can be an |
|
Optional. The heading unit: |
|
Optional. The velocity to turn with from 0% to 100% when using |
|
Optional. The velocity unit: |
|
Optional. |
# Turn to face the cardinal directions
drivetrain.turn_to_heading(90, DEGREES)
wait(1, SECONDS)
drivetrain.turn_to_heading(180, DEGREES)
wait(1, SECONDS)
drivetrain.turn_to_heading(270, DEGREES)
wait(1, SECONDS)
drivetrain.turn_to_heading(0, DEGREES)
# Turn twice slowly
drivetrain.turn_to_heading(90, DEGREES, 20, PERCENT)
wait(1, SECONDS)
drivetrain.turn_to_heading(180, DEGREES, 20, PERCENT)
turn_to_rotation#
turn_to_rotation turns the robot to a specific rotation.
Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. Rotation can also be set using the set_rotation method.
Οι τιμές περιστροφής είναι απόλυτες. Αυτό σημαίνει ότι η κατεύθυνση της στροφής εξαρτάται από την τρέχουσα περιστροφή του ρομπότ. Η στροφή προς τα δεξιά αυξάνει την περιστροφή και η στροφή προς τα αριστερά τη μειώνει.
Για παράδειγμα, αν το ρομπότ ξεκινήσει από 0 μοίρες και στρίψετε σε περιστροφή 720 μοιρών, θα στρίψει δεξιά δύο φορές. Αν στη συνέχεια στρίψετε σε περιστροφή 360 μοιρών, θα στρίψει αριστερά μία φορά, επειδή οι 360 μοίρες είναι μικρότερες από 720 μοίρες.
Το έργο θα περιμένει μέχρι να ολοκληρώσει την περιστροφή του ρομπότ προτού εκτελεστεί η επόμενη γραμμή κώδικα.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.turn_to_rotation(angle, units, velocity, units_v, wait)
Παράμετροι |
Περιγραφή |
|---|---|
|
The rotation value, in degrees or turns, that the robot will turn to. This can be an |
|
Optional. The rotation unit: |
|
Optional. The velocity to turn with from 0% to 100% when using |
|
Optional. The velocity unit: |
|
Optional. |
# Turn left, then spin in a circle clockwise and face right
drivetrain.turn_to_rotation(-90, DEGREES)
wait(1, SECONDS)
drivetrain.turn_to_rotation(450, DEGREES)
# Turn left then slowly spin in a circle clockwise
drivetrain.turn_to_rotation(-90, DEGREES)
wait(1, SECONDS)
drivetrain.turn_to_rotation(450, DEGREES, 20, PERCENT)
stop#
stop stops the robot’s movement.
Usage:
drivetrain.stop(mode)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. How the robot will stop:
|
# Drive forward, then stop
drivetrain.drive(FORWARD)
wait(2, SECONDS)
drivetrain.stop()
calibrate_drivetrain#
calibrate_drivetrain is a built-in function that calibrates the drivetrain’s configured Inertial Sensor, GPS Sensor, or Gyro Sensor.
Η βαθμονόμηση βοηθά τον αισθητήρα να μετρήσει σωστά την κίνηση. Κρατήστε το ρομπότ ακίνητο για περίπου 2 δευτερόλεπτα κατά τη διάρκεια της βαθμονόμησης. Εάν το ρομπότ κινηθεί κατά τη διάρκεια της βαθμονόμησης, ο αισθητήρας ενδέχεται να μην μετρήσει σωστά την κίνηση.
Το έργο θα περιμένει μέχρι να ολοκληρωθεί η βαθμονόμηση πριν εκτελεστεί η επόμενη γραμμή κώδικα.
Σημείωση: Αυτή η λειτουργία είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
calibrate_drivetrain()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η συνάρτηση δεν έχει παραμέτρους. |
Μεταλλάκτες#
set_drive_velocity#
set_drive_velocity tells the robot how fast to drive. A higher percentage makes the robot drive faster and a lower percentage makes the robot drive slower. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Κάθε έργο ξεκινά με το ρομπότ να κινείται με ταχύτητα 50% από προεπιλογή.
Σημείωση: Μια υψηλότερη ταχύτητα κάνει το ρομπότ να κινείται πιο γρήγορα, αλλά μπορεί να είναι λιγότερο ακριβές. Μια χαμηλότερη ταχύτητα κάνει το ρομπότ να κινείται πιο αργά, αλλά μπορεί να είναι πιο ακριβές.
Usage:
drivetrain.set_drive_velocity(velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The velocity to drive with from 0% to 100% when using |
|
Optional. The velocity unit: |
# Drive forward at the default velocity
drivetrain.drive_for(FORWARD, 100, MM)
wait(1, SECONDS)
# Drive slower
drivetrain.set_drive_velocity(20, PERCENT)
drivetrain.drive_for(FORWARD, 100, MM)
wait(1, SECONDS)
# Drive faster
drivetrain.set_drive_velocity(100, PERCENT)
drivetrain.drive_for(FORWARD, 100, MM)
wait(1, SECONDS)
set_turn_velocity#
set_turn_velocity tells the robot how fast to turn. A higher percentage makes the robot turn faster and a lower percentage makes the robot turn slower. For RPM or degrees per second, the limit is changed by the gear ratio of the drivetrain.
Κάθε έργο ξεκινά με το ρομπότ να περιστρέφεται με ταχύτητα 50% από προεπιλογή.
Σημείωση: Μια υψηλότερη ταχύτητα κάνει το ρομπότ να περιστρέφεται πιο γρήγορα, αλλά μπορεί να είναι λιγότερο ακριβής. Μια χαμηλότερη ταχύτητα κάνει το ρομπότ να περιστρέφεται πιο αργά, αλλά μπορεί να είναι πιο ακριβής.
Usage:
drivetrain.set_turn_velocity(velocity, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The velocity to turn with from 0% to 100% when using |
|
Optional. The velocity unit: |
# Turn at the default velocity
drivetrain.turn_for(RIGHT, 100)
wait(1, SECONDS)
# Turn slower
drivetrain.set_turn_velocity(20, PERCENT)
drivetrain.turn_for(RIGHT, 100)
wait(1, SECONDS)
# Turn faster
drivetrain.set_turn_velocity(100, PERCENT)
drivetrain.turn_for(RIGHT, 100)
wait(1, SECONDS)
set_stopping#
set_stopping sets how the robot will stop moving: by braking, coasting, or holding.
Usage:
drivetrain.set_stopping(mode)
Παράμετροι |
Περιγραφή |
|---|---|
|
How the robot will stop:
|
If this method is not used, the robot will use BRAKE when stopping.
set_timeout#
set_timeout sets how many seconds the robot will try to finish a movement. If the robot cannot finish in that time, it will stop trying and move on to the next line of code. This keeps the robot from getting stuck on a movement.
Usage:
drivetrain.set_timeout(value, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The amount of time the robot can try to finish a movement. This can be a positive |
|
Optional. The unit of time: |
set_heading#
A heading is the direction the robot is facing, measured in degrees. set_heading changes the robot’s current heading to a new heading value.
Για παράδειγμα, εάν το ρομπότ έχει στραφεί προς τα δεξιά, η ρύθμιση της κατεύθυνσης σε 0 μοίρες καθιστά αυτή τη θέση προς τα δεξιά τις νέες 0 μοίρες. Στη συνέχεια, το ρομπότ μπορεί να στραφεί σε άλλες θέσεις με βάση αυτήν τη νέα κατεύθυνση.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.set_heading(heading, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The heading value, in degrees or turns, to set for the robot. This can be an |
|
Optional. The heading unit: |
# Face the new 0 degrees
drivetrain.set_heading(90, DEGREES)
drivetrain.turn_to_heading(0, DEGREES)
set_rotation#
Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. set_rotation changes the robot’s current rotation to a new value.
Για παράδειγμα, αν το ρομπότ έχει κάνει δύο πλήρεις στροφές προς τα δεξιά, η τιμή περιστροφής του θα είναι 720 μοίρες. Αν ορίσετε την περιστροφή σε 0 μοίρες, η περιστροφή θα επαναφερθεί από 720 σε 0 μοίρες. Στη συνέχεια, το ρομπότ μπορεί να στραφεί σε περιστροφές με βάση αυτήν τη νέα τιμή.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.set_rotation(rotation, units)
Παράμετροι |
Περιγραφή |
|---|---|
|
The rotation value, in degrees or turns, to set for the robot. This can be an |
|
Optional. The rotation unit: |
# Spin counterclockwise two times
drivetrain.set_rotation(720, DEGREES)
drivetrain.turn_to_rotation(0, DEGREES)
set_turn_threshold#
set_turn_threshold sets how close the robot must get to a target angle before a turn is complete.
Ένα μικρότερο κατώφλι μπορεί να κάνει τις στροφές πιο ακριβείς, αλλά το ρομπότ μπορεί να χρειαστεί περισσότερο χρόνο για να ολοκληρώσει τις στροφές. Ένα μεγαλύτερο κατώφλι μπορεί να κάνει τις στροφές να ολοκληρωθούν νωρίτερα, αλλά μπορεί να είναι λιγότερο ακριβείς.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.set_turn_threshold(value)
Παράμετροι |
Περιγραφή |
|---|---|
|
The turn threshold, in degrees. This can be an |
set_turn_constant#
set_turn_constant changes how strongly the robot corrects its turns.
Μια υψηλότερη τιμή κάνει το ρομπότ να στρέφεται σωστά πιο δυνατά. Μια χαμηλότερη τιμή κάνει το ρομπότ να στρέφεται σωστά πιο ομαλά. Η προεπιλεγμένη τιμή είναι 1,0.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.set_turn_constant(value)
Παράμετροι |
Περιγραφή |
|---|---|
|
The turn constant. This can be a decimal ( |
set_turn_direction_reverse#
set_turn_direction_reverse changes whether the smart drivetrain’s turn direction is reversed.
This can be used if the drivetrain turns the opposite direction than expected after being manually configured in code. This method works the same as setting the reverse parameter to True when constructing a SmartDrive.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.set_turn_direction_reverse(value)
Παράμετροι |
Περιγραφή |
|---|---|
|
Whether to reverse the smart drivetrain’s turn direction: |
Αποκτητές#
is_done#
is_done returns whether the robot is finished moving, as a Boolean value. This can be used to control the timing of other behaviors based on the robot’s movement.
True— The robot is finished moving.False— The robot is still moving.
This method works together with the following Drivetrain methods that have the wait parameter: drive_for, turn_for, turn_to_heading, and turn_to_rotation.
Usage:
drivetrain.is_done()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
is_moving#
is_moving returns whether the robot is moving, as a Boolean value. This can be used to control the timing of other behaviors based on the robot’s movement.
True— The robot is moving.False— The robot is not moving.
Χρήση:
drivetrain.is_moving()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
heading#
A heading is the direction the robot is facing, measured in degrees. heading returns the robot’s current heading from 0 to 359.99 degrees.
Η αρχική κατεύθυνση του ρομπότ είναι 0 μοίρες.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.heading(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return heading in: |
# Display the heading after turning
drivetrain.turn_for(RIGHT, 450, DEGREES)
brain.screen.print("Heading: ")
brain.screen.print(drivetrain.heading())
rotation#
Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. rotation returns the robot’s current rotation.
Η δεξιά στροφή αυξάνει την περιστροφή και η αριστερά τη μειώνει. Για παράδειγμα, κάνοντας δύο πλήρεις στροφές προς τα δεξιά θα επιστρέψει μια περιστροφή 720 μοιρών.
Σημείωση: Αυτή η μέθοδος είναι διαθέσιμη μόνο εάν το σύστημα μετάδοσης κίνησης έχει διαμορφωθεί με Αισθητήρα Αδράνειας, Αισθητήρα GPS ή Αισθητήρα Γυροσκοπίου στο παράθυρο Συσκευές.
Usage:
drivetrain.rotation(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return rotation in: |
# Display the rotation after turning
drivetrain.turn_for(RIGHT, 450, DEGREES)
brain.screen.print("Rotation: ")
brain.screen.print(drivetrain.rotation())
velocity#
velocity returns how fast the robot is driving.
It can return velocity as a percentage from -100% to 100%, in RPM, or in VelocityUnits.DPS (degrees per second). A positive value means the robot is driving forward. A negative value means the robot is driving in reverse.
Usage:
drivetrain.velocity(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The velocity unit: |
current#
current returns how much electrical current the drivetrain is using, measured in amps (amperes). Current is the amount of electricity flowing through the drivetrain.
Μια υψηλότερη τιμή ρεύματος σημαίνει ότι το σύστημα μετάδοσης κίνησης χρησιμοποιεί περισσότερο ηλεκτρικό ρεύμα. Αυτό μπορεί να συμβεί όταν το ρομπότ πιέζει ένα αντικείμενο ή προσπαθεί να κινηθεί όταν αυτό έχει κολλήσει.
Αυτό μπορεί να χρησιμοποιηθεί για να ελέγξετε εάν το σύστημα μετάδοσης κίνησης παρουσιάζει δυσκολίες κατά τη διάρκεια μιας κίνησης. Εάν το ρεύμα παραμείνει υψηλό, το σύστημα μετάδοσης κίνησης μπορεί να θερμανθεί ή να χρησιμοποιήσει την ισχύ λιγότερο αποτελεσματικά.
Usage:
drivetrain.current(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return current in: |
power#
power returns how much power the drivetrain is using, measured in watts. Power shows how quickly the drivetrain is using energy.
Μια υψηλότερη τιμή ισχύος σημαίνει ότι το σύστημα μετάδοσης κίνησης χρησιμοποιεί ενέργεια πιο γρήγορα. Αυτό μπορεί να συμβεί όταν το ρομπότ πιέζει ένα αντικείμενο ή προσπαθεί να κινηθεί όταν αυτό έχει κολλήσει.
Αυτό μπορεί να χρησιμοποιηθεί για να συγκρίνετε κινήσεις ή να ελέγξετε αν το σύστημα μετάδοσης κίνησης παρουσιάζει δυσκολίες. Εάν η ισχύς παραμείνει υψηλή, το σύστημα μετάδοσης κίνησης μπορεί να θερμανθεί ή να χρησιμοποιήσει την ενέργεια λιγότερο αποτελεσματικά.
Usage:
drivetrain.power()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
torque#
Η ροπή δείχνει πόσο δυνατά μπορεί να σπρώξει ή να τραβήξει το σύστημα μετάδοσης κίνησης ενώ οι τροχοί σπινάρουν.
torque returns how much torque the drivetrain is using, measured in Newton-meters (Nm) or inch-pounds (InLb).
Μια υψηλότερη τιμή ροπής σημαίνει ότι το σύστημα μετάδοσης κίνησης πιέζει ή τραβάει πιο δυνατά. Αυτό μπορεί να συμβεί όταν το ρομπότ πιέζει ένα αντικείμενο ή προσπαθεί να κινηθεί όταν αυτό έχει κολλήσει.
Αυτό μπορεί να χρησιμοποιηθεί για να ελεγχθεί εάν το σύστημα μετάδοσης κίνησης δυσκολεύεται ή για να συγκριθεί η ώθηση που χρειάζονται οι διαφορετικές κινήσεις.
Usage:
drivetrain.torque(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return torque in: |
efficiency#
efficiency returns how efficiently the drivetrain is using power, as a percentage from 0% to 100%.
Η απόδοση δείχνει πόση από την ισχύ του συστήματος μετάδοσης κίνησης χρησιμοποιείται για κίνηση. Μια υψηλότερη τιμή απόδοσης σημαίνει ότι περισσότερη από την ισχύ του συστήματος μετάδοσης κίνησης χρησιμοποιείται για κίνηση. Μια χαμηλότερη τιμή απόδοσης μπορεί να συμβεί όταν το σύστημα μετάδοσης κίνησης λειτουργεί σκληρά αλλά δεν κινείται πολύ, όπως όταν το ρομπότ έχει κολλήσει ή πιέζει ένα αντικείμενο.
Αυτό μπορεί να χρησιμοποιηθεί για τη σύγκριση κινήσεων ή για τον έλεγχο εάν το σύστημα μετάδοσης κίνησης σπαταλά ενέργεια αντί να τη χρησιμοποιεί για κίνηση.
Usage:
drivetrain.efficiency()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
temperature#
temperature returns the average temperature of the drivetrain in the selected temperature unit.
Η θερμοκρασία δείχνει πόσο ζεστοί είναι οι κινητήρες του συστήματος μετάδοσης κίνησης. Μια υψηλότερη θερμοκρασία σημαίνει ότι οι κινητήρες θερμαίνονται ενώ λειτουργούν. Οι κινητήρες θα πρέπει να παραμένουν κάτω από τους 55°C για να συνεχίσουν να λειτουργούν σε πλήρη απόδοση.
Εάν οι κινητήρες υπερθερμανθούν, θα μειώσουν το μέγιστο ρεύμα τους για να προστατευτούν. Στους 70°C, οι κινητήρες θα σταματήσουν να λειτουργούν μέχρι να κρυώσουν.
Αυτό μπορεί να χρησιμοποιηθεί για να ελέγξετε εάν το σύστημα μετάδοσης κίνησης υπερθερμαίνεται κατά τη διάρκεια επαναλαμβανόμενων κινήσεων, μεγάλων διαδρομών ή όταν πιέζει ένα αντικείμενο.
Usage:
drivetrain.temperature(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
Optional. The unit to return temperature in: |
get_timeout#
get_timeout returns the currently set timeout in milliseconds.
Usage:
drivetrain.get_timeout()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
Κατασκευαστές#
Constructors are used to manually create DriveTrain and SmartDrive objects, which are necessary for configuring a drivetrain outside of VEXcode.
At least two Motor or MotorGroup objects must be created before creating a drivetrain.
DriveTrain#
DriveTrain creates a drivetrain without an Inertial Sensor, GPS Sensor, or Gyro Sensor.
Usage:
DriveTrain(lm, rm, wheelTravel, trackWidth, wheelBase, units, externalGearRatio)
Παράμετρος |
Περιγραφή |
|---|---|
|
Ο αριστερός κινητήρας ή ομάδα κινητήρων. |
|
Ο δεξιός κινητήρας ή ομάδα κινητήρων. |
|
Προαιρετικά. Η περιφέρεια των τροχών του συστήματος μετάδοσης κίνησης. Η προεπιλογή είναι 300 χιλιοστά. |
|
Προαιρετικό. Το πλάτος μεταξύ του αριστερού και του δεξιού τροχού. Η προεπιλογή είναι 320 χιλιοστά. |
|
Προαιρετικά. Η απόσταση μεταξύ των μπροστινών και των πίσω τροχών. Η προεπιλογή είναι 320 χιλιοστά. |
|
Optional. The unit for |
|
Optional. The gear ratio used to adjust drive distances if gears are used. This can be an |
# Create the Motors
left_motor = Motor(Ports.PORT1, GearSetting.RATIO_18_1, False)
right_motor = Motor(Ports.PORT2, GearSetting.RATIO_18_1, True)
# Create a drivetrain with default values
drivetrain = DriveTrain(left_motor, right_motor)
# Create the motors
left_motor = Motor(Ports.PORT1, GearSetting.RATIO_18_1, False)
right_motor = Motor(Ports.PORT2, GearSetting.RATIO_18_1, True)
"""
Create a drivetrain with the following values:
- wheelTravel = 319.19
- trackWidth = 295
- wheelBase = 40
- units = MM (Millimeters)
- externalGearRatio - 1
"""
drivetrain = DriveTrain(left_motor, right_motor, 319.19, 295, 40, MM, 1)
SmartDrive#
SmartDrive creates a drivetrain configured with an Inertial Sensor, GPS Sensor, or Gyro Sensor.
Usage:
SmartDrive(lm, rm, g, wheelTravel, trackWidth, wheelBase, units, externalGearRatio)
Παράμετρος |
Περιγραφή |
|---|---|
|
Ο αριστερός κινητήρας ή ομάδα κινητήρων. |
|
Ο δεξιός κινητήρας ή ομάδα κινητήρων. |
|
Ο Αισθητήρας Αδράνειας, Αισθητήρας GPS ή Αισθητήρας Γυροσκοπίου που χρησιμοποιείται από το σύστημα μετάδοσης κίνησης. |
|
Προαιρετικά. Η περιφέρεια των τροχών του συστήματος μετάδοσης κίνησης. Η προεπιλογή είναι 300 χιλιοστά. |
|
Προαιρετικό. Το πλάτος μεταξύ του αριστερού και του δεξιού τροχού. Η προεπιλογή είναι 320 χιλιοστά. |
|
Προαιρετικά. Η απόσταση μεταξύ των μπροστινών και των πίσω τροχών. Η προεπιλογή είναι 320 χιλιοστά. |
|
Optional. The unit for |
|
Optional. The gear ratio used to adjust drive distances if gears are used. This can be an |
# Create the Motors
left_motor = Motor(Ports.PORT1, GearSetting.RATIO_18_1, False)
right_motor = Motor(Ports.PORT2, GearSetting.RATIO_18_1, True)
# Create a Gyro Sensor in Port A
gyro_a = Gyro(brain.three_wire_port.a)
# Create a drivetrain with default values
drivetrain = SmartDrive(left_motor, right_motor, gyro_a)
# Create the Motors
left_motor = Motor(Ports.PORT1, GearSetting.RATIO_18_1, False)
right_motor = Motor(Ports.PORT2, GearSetting.RATIO_18_1, True)
# Create a Gyro Sensor in Port A
gyro_a = Gyro(brain.three_wire_port.a)
"""
Create a drivetrain with the following values:
- wheelTravel = 319.19
- trackWidth = 295
- wheelBase = 40
- units = MM (Millimeters)
- externalGearRatio - 1
"""
drivetrain = SmartDrive(left_motor, right_motor, gyro_a, 319.19, 295, 40, MM, 1)