position abstract method

Future<(double, PositionType)> position({
  1. PositionType? positionType,
  2. Map<String, dynamic>? extra,
})

Report the position of the encoder in ticks or degrees, and the position type. The value returned is a tuple containing two values. The first is the position of the encoder which can either be ticks since last zeroing for a relative encoder or degrees for an absolute encoder, and the second is the type of position the encoder returns (ticks or degrees). This method will raise an exception if position reporting is not supported by the encoder.

// Get the current position of an encoder.
var position = await myEncoder.position();
// Get the current position of an encoder with ticks position type.
var position = await myEncoder.position(PositionType.POSITION_TYPE_TICKS_COUNT);

For more information, see Encoder component.

Implementation

Future<(double, PositionType)> position({PositionType? positionType, Map<String, dynamic>? extra});