Skip to content

calibrate

Andy Perrett edited this page Jul 30, 2020 · 2 revisions

calibrate

Access: Public

Prototype: bool calibrate()

Parameters: None

Return Value: Boolean true for success, false for failed – always true.

Description: The wheel is forced into a central position using the function gotoAngle(0), then forced full left by findLeftLock(), returned to centre, then forced full right by findRightLock(). The wheel is then forced to 10 random positions using findJitter() to calculate the jitter before being returned to a central position. The centre point is also calculated here.

Jitter is a term used when the wheel’s position is not constant even when the wheel is stationary. The G27 does not suffer from jitter but the Sim Steering wheel does. If you repeatedly call getPosition() while the wheel is stationary the reading will sometimes vary by as much as 7 or 8 counts.

Note: This function will take time since finding the left and right most positions is done crudely at the time of writing. The wheel is forced left or right for 4.5 seconds while constantly looking for the maximum encoder count. Finding the jitter (which may not happen all the time) is a case of forcing the wheel to a position, waiting for a period so the wheel can stop moving, then taking 100 readings.

Since this is a very crude calibration function it can be reworked and enhanced. Internal variables leftLock, rightLock, jitter and centre are set by this function. Damper, Friction, Inertia and Spring effects obviously effect the forcing of the wheel position.

Related Functions: gotoAngle(), findJitter(), findLeftLock(), findRightLock(), calibrate, getAngle(), getPosition(), getCentre(), calculateAngle(), getLeftLock(), getRightLock()

Clone this wiki locally