mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 09:37:25 +00:00
Since we changed the acceleration units to mm/s/s, the output values are fairly large. The Matrix repr function prints values up to 999, so this avoids truncating the output. It is also a good demo of scalar division for a Matrix / Vector.
16 lines
341 B
Python
16 lines
341 B
Python
# ExampleHub = TechnicHub PrimeHub
|
|
from pybricks.hubs import ExampleHub
|
|
from pybricks.tools import wait
|
|
|
|
# Initialize the hub.
|
|
hub = ExampleHub()
|
|
|
|
# Get the acceleration vector in g's.
|
|
print(hub.imu.acceleration() / 9810)
|
|
|
|
# Get the angular velocity vector.
|
|
print(hub.imu.angular_velocity())
|
|
|
|
# Wait so we can see what we printed
|
|
wait(5000)
|