GubiLabsAcademy

MODULE 04 / FOUNDATIONS

Sensors & feedback

Learn encoders, accelerometers, gyroscopes and orientation estimates. Build a sensor contract that includes units, axes, calibration and freshness.

75–105 min6 lab steps3 knowledge checks In progress

By the end, you can…

  • Distinguish angular position, angular rate and estimated orientation.
  • Explain why sensor mounting and timestamps affect balance.
  • Inspect a synthetic sensor packet and identify invalid assumptions.
BRING WITH YOU

Meet the robot

Forces, units & motion

INTERACTIVE BENCH / FEEDBACKA joint tries to close the gap.
ANGLE ERROR 0.262 radREQUESTED TORQUE 1.05 N·mτ = Kp(qtarget − q) − Kd·velocity
A static PD calculation with zero desired velocity, without gravity compensation, current limits or saturation. Drag the actual angle past the target: the spring term changes sign. These teaching gains are not BDX-R motor settings.
01

A measurement is not the entire state

An encoder reports rotational position or position changes at a particular shaft. If it measures the motor side of a gearbox, converting to output angle requires the ratio and an offset; an output-side encoder observes the joint more directly. Some actuators have both. A reported motor angle alone cannot reveal every flexing bracket, loose fastener or foot contact.

A gyroscope measures angular rate. An accelerometer measures specific force, which is influenced by both gravity-related support and motion. A magnetometer senses the local magnetic field. Sensor fusion combines measurements and a model to estimate orientation. An IMU is not automatically a complete position tracker: integrating tiny acceleration errors can produce growing position error.

02

Choose axes before interpreting signs

Tape a small three-axis diagram to a book standing in for the robot torso: x forward, y left, z up. Now imagine the sensor is mounted sideways inside the book. The sensor’s x axis and the body’s x axis no longer describe the same direction. A sensor-to-body rotation is needed before the controller can interpret the measurements correctly.

Roll, pitch and yaw can describe orientation, but their meaning depends on rotation order and frame convention. A quaternion uses four values to represent rotation. Libraries disagree about whether the scalar comes first or last, so [w,x,y,z] and [x,y,z,w] are not interchangeable arrays. Record both the order and which frame the rotation maps from/to. You do not need to derive quaternion algebra to recognize that contract.

03

Projected gravity is a useful balance cue

The audited walking controller uses the gravity direction expressed in the body frame. For a level body whose z axis points up, a normalized downward gravity vector is [0,0,−1]. As the body tilts, components appear on the other axes. This tells the controller about tilt without requiring a worldwide heading reference.

That vector is not the raw accelerometer reading. A stationary supported accelerometer commonly measures an upward specific-force response, while the modeled gravity vector points downward. The exact sensor output mode matters. Learn to identify whether a field means raw acceleration, gravity, linear acceleration with gravity removed, or an orientation estimate before connecting it to a policy input.

04

Freshness is part of correctness

A beautifully formatted packet can still be wrong for the current moment. Keep the time of measurement, time of receipt and age at use separate when possible. A controller running fifty decisions per second has a 20 ms decision period, but the acceptable sensor age is an engineering choice that must be tested, not automatically equal to one period.

The early BDX-R paper and current deployment code use different sensor generations. The audited later implementation expects an MTi-3-oriented serial path; the earlier BNO055 setup is not a drop-in substitution. The audit also found missing freshness checks. These observations become requirements for the later mock-hardware lab rather than excuses to guess a sensor board or orientation.

The age of a reading is the time it is used minus the time it was sampled. If sampling happened at 5.00 seconds and use happens at 5.08 seconds on the same clock, the reading is 0.08 seconds old. There are 1,000 milliseconds in one second, so that age is 80 milliseconds. Compare timestamps only after confirming they share a clock or have a known conversion.

WORDS YOU NOW KNOW

IMU
An inertial measurement unit containing motion sensors such as accelerometers and gyroscopes.
Sensor fusion
Combining measurements and a model to estimate a state such as orientation.
Bias
A systematic measurement offset that may change with conditions.
Latency
Delay between an event or measurement and its availability or effect.

YOUR CALL

Finished with this module?

0 of 6 lab steps checked. 0 of 3 questions answered. You decide when the module is complete. Revisiting or editing it will not change your decision.

You can reopen it later. Checking every box will not automatically complete it.

Go to the source

Primary references for this module. Use the version and hardware revision named in the lesson.

Bosch BNO055 sensor overviewROS coordinate conventionsBDX-R IMU implementation