Αδρανειακό#
Εισαγωγή#
Το ρομπότ VEX 123 διαθέτει ενσωματωμένο αδρανειακό αισθητήρα. Αυτός ο αισθητήρας μπορεί να μετρήσει τον τρόπο με τον οποίο κινείται το ρομπότ.
Ο Αισθητήρας Αδράνειας χρησιμοποιεί ένα επιταχυνσιόμετρο για να μετρήσει αλλαγές στην κίνηση, όπως επιτάχυνση, επιβράδυνση ή απότομο σταμάτημα κατά τη διάρκεια μιας σύγκρουσης.
Παρακάτω είναι μια λίστα με όλες τις αδρανειακές μεθόδους:
Getters — Επιστρέφει τον τρόπο με τον οποίο κινείται το ρομπότ.
is_crashed— Returns whether the robot has detected a crash.get_acceleration— Returns how quickly the robot is speeding up or slowing down on the selected axis.
Αποκτητές#
is_crashed#
is_crashed returns a Boolean that reports whether the robot has detected a crash — a sudden stop or impact.
True— The robot has detected a crash.False— The robot has not detected a crash.
Usage:
robot.is_crashed()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Back up after a crash.
robot.drive(FORWARD)
while not robot.is_crashed():
wait(0.05, SECONDS)
robot.drive_for(REVERSE, 200, MM)
get_acceleration#
Acceleration is how quickly the robot is speeding up or slowing down. get_acceleration returns the acceleration of the robot on the selected axis, from -4.0 G to 4.0 G.
A G is a unit used to measure acceleration. 1 G is about the acceleration you feel from gravity while sitting still.
The value can be positive or negative depending on the direction of acceleration on the selected axis. The axis options are X, Y, and Z.
Usage:
robot.inertial.get_acceleration(axis)
Παράμετροι |
Περιγραφή |
|---|---|
|
The axis to measure acceleration on: |
# Display the acceleration on the X axis
while True:
console.clear()
console.print(robot.inertial.get_acceleration(X), precision=2)
wait(0.1, SECONDS)