Skip to Content
VectorLib

How parity is proven

The original C++ and VectorLib run on the same simulated robot, compared bit for bit.

The test suite compiles the original C++ (LemLib 0.5.6, LemLib-TitanTron and TitanReset, unmodified) against a mock of PROS backed by the same simulated robot. It then runs identical scripts through the C++ and through VectorLib. Every output is compared exactly: motor commands as integers, positions as raw float bits.

What was comparedValuesDifferences
LemLib pure functions: angle error, PID, drive curves, pose maths, path parsing41,5130
LemLib driver control: tank, arcade, curvature198,1350
LemLib motions on 7 sensor setups × 2 gain sets, every millisecond1,718,1320
TitanTron: early lambdas, scaled IMU, point paths, live gains, odom offsets470,2670
TitanReset: DSR maths and resets on a simulated field130,6380
Total2,558,6850

The home page replays one of these runs: LemLib's example autonomous, recorded every 10 ms from both implementations.

Where VectorLib deliberately differs

Where reproducing the C++ exactly would mean reproducing undefined behaviour, VectorLib does the defined thing:

  • cancelAllMotions while a motion is queued leaves LemLib's mutex locked, and the next motion deadlocks. VectorLib releases it.
  • TitanReset's stop_location_recording leaves a dangling task pointer, and its debug screen reads an IMU pointer that is never set. VectorLib defines both.
  • LemLib's findClosest leaves its result uninitialised when every distance is NaN. VectorLib starts it at 0.

The full list, with reasons, is in PARITY.md.

On this page