hub.imu
Motion sensor: which way the hub is tilted and turned.
pitch, roll and yaw are angles in degrees, from -180 to 180:
pitch — nose up / nose down,
roll — tilting left / right,
yaw — turning around, like a compass.
Wait until calibrated is True before trusting the values.
On some hubs yaw slowly drifts over time; call reset() to set it
back to 0.
Attributes
How hard the hub is being pushed (including gravity), in milli-g. |
|
|
|
How fast the hub is spinning around each direction, in degrees per second. |
|
Nose up (+) or down (-), in degrees. |
|
pitch measured only from gravity. Jumpy, but never drifts. Degrees. |
|
pitch measured only from rotation. Smooth, but drifts over time. Degrees. |
|
Tilt to the side, in degrees. |
|
roll measured only from gravity. Jumpy, but never drifts. Degrees. |
|
roll measured only from rotation. Smooth, but drifts over time. Degrees. |
|
Which way the hub is facing, in degrees. Use |
|
yaw measured only from rotation. Smooth, but drifts over time. Degrees. |
Functions
|
Set the current direction as yaw = 0. |
|
Remember the current calibration, so it survives a restart. |
|
Start calibrating the sensor more precisely. |
Module Contents
- hub.imu.reset() None[source]
Set the current direction as yaw = 0.
On some hubs this also re-calibrates the sensor — keep the hub still for about 2 seconds afterwards.
- hub.imu.save_calibration() bool[source]
Remember the current calibration, so it survives a restart.
Call it once
calibratedisTrue. Not every hub can store a calibration; on those this does nothing. ReturnsTrueon success.
- hub.imu.start_calibration() bool[source]
Start calibrating the sensor more precisely.
Move the hub in a figure-8, then put it down flat on each side for a few seconds. Returns
Trueif calibration started.
- hub.imu.acceleration: _vec3[source]
How hard the hub is being pushed (including gravity), in milli-g.
Lying still and flat,
zis about 1000 (that’s gravity).
- hub.imu.calibrated: bool[source]
Trueonce the sensor is ready and its readings can be trusted.Right after start-up (or after
reset()) keep the hub still for about 2 seconds until this turnsTrue.
- hub.imu.gyro_rate: _vec3[source]
How fast the hub is spinning around each direction, in degrees per second.
- hub.imu.pitch_accel: float[source]
pitch measured only from gravity. Jumpy, but never drifts. Degrees.
- Type:
Advanced
- hub.imu.pitch_gyro: float[source]
pitch measured only from rotation. Smooth, but drifts over time. Degrees.
- Type:
Advanced
- hub.imu.roll_accel: float[source]
roll measured only from gravity. Jumpy, but never drifts. Degrees.
- Type:
Advanced
- hub.imu.roll_gyro: float[source]
roll measured only from rotation. Smooth, but drifts over time. Degrees.
- Type:
Advanced