Unit 06 · lesson

Sensors Turn Physical State into Data

A robot cannot control what it cannot observe.

Sensors turn physical conditions into data the program can read: position, rotation, speed, orientation, contact, distance, light, image features, current, and more.

The sensor value is not the physical world. It is a measurement of the physical world.

That gap matters.

Measurement has units and reference frames

An encoder may report counts, rotations, radians, degrees, distance, or velocity depending on configuration and conversion.

A gyro may report orientation relative to some zero.

A limit switch may report only two states.

A camera may estimate where a target is relative to the camera, not necessarily relative to the robot center or the field.

Before using a sensor value, answer:

  • What quantity is measured?
  • In what units?
  • Relative to what reference?
  • What range is valid?
  • How often does it update?
  • What happens when it fails?

Example: encoder conversion

Suppose an encoder measures motor rotations, but you care about wheel rotations.

With a 10:1 reduction:

10 motor rotations = 1 wheel rotation

If the motor-side encoder reports 25 rotations:

25 / 10 = 2.5 wheel rotations

If the software forgets the gear ratio, the data can be perfectly consistent and still represent the wrong physical quantity.

Calibration and zero

Many measurements need a known reference.

An elevator encoder may need a known home position. A gyro may need a defined heading. A mechanism may use a limit switch to establish zero.

If the reference is wrong, closed-loop control can confidently drive toward the wrong state.

Sensor evidence table

Pick one sensor and document:

QuestionAnswer
physical quantity
raw reading
converted units
reference/zero
expected range
update/use rate
likely noise or error
safe failure response

Failure modes

Disconnected sensor
Reading may freeze, disappear, default, or fault.

Wrong units
Values change but control behaves incorrectly.

Wrong sign
Moving positive produces negative measurement.

Bad zero
Everything is offset.

Noise
Measurement changes even when the physical state is nearly constant.

Mechanical slip
The sensor reports shaft motion that no longer matches the mechanism.

That last one is important. A sensor can work perfectly while measuring the wrong thing because the mechanical relationship changed.

Test before control

Move the mechanism through a safe known range and observe sensor behavior before closing the feedback loop.

Predict what the value should do.

If the sensor does not make sense in open-loop testing, adding PID will not rescue it.

Keep the sensor table. Lesson 2 will turn the measurement into feedback control.

process flow

Robot Programming with WPILib: FRC Evidence Flow

  1. Plan

    Name the role, rule, criterion, constraint, and safety condition.

  2. Model

    Trace the subsystem or match decision and its dependencies.

  3. Test

    Use a bounded approved test or simulation and record evidence.

  4. Review

    Document correction, limitation, and next team action.

Read this concept flow as plain text
  1. Plan. Name the role, rule, criterion, constraint, and safety condition.
  2. Model. Trace the subsystem or match decision and its dependencies.
  3. Test. Use a bounded approved test or simulation and record evidence.
  4. Review. Document correction, limitation, and next team action.