Microsoft Robotics

Glossary Item Box

Robotics Common: Robotics Common Overview

Microsoft Robotics Developer StudioSend feedback on this topic


Generic Encoder

The Generic Encoder service contract enables you to access state information from encoders. The most typical use of encoders is to measure rotation of a rotational device, such as a motor, to keep track of its distance traveled and thereby the robot's relative position. It may also be used to control speed. While distance and position can also be estimated based on the elapsed time and motor power, such alternatives are not as accurate since the distance traveled may be affected by factors such the surface the wheel connected to the motor is traveling on. However, even encoders might not always be entirely accurate as a wheel may slip or the robot might be relocated by some other means.

The Generic Encoder service provides the following operations. All except the Get operation also are available as notifications.

GetReturns the entire state of the encoder service.
EncoderReplaceChanges or indicates a change to the state of the encoder service.
ResetTickCounterResets the encoder's tick count or indicates a change to the encoder's tick count.
UpdateTickCountUpdates or indicates an update to the encoder's tick count.


The encoder's state is represented by the following properties:

CurrentAngledoubleIndicates the current angle reading in radians.
CurrentReadingintIndicates the current encoder reading in ticks.
HardwareIdentifierintIdentifies the hardware port the encoder uses.
TicksPerRevolutionintIndicates the number of ticks per axle revolution.
TicksSinceResetintIndicates the number of ticks since the encoder was reset.
TimeStampDateTimeIndicates the timestamp of the encoder reading.


The generic encoder service reports its rotation readings in terms of ticks. A tick represents a small portion of the rotation of the axle (of a motor or wheel). Because encoders may vary in the number of ticks per revolution, this is a configurable option. You can use the EncoderReplace to set the TicksPerRevolution setting.

The UpdateTickCount notification provides updates as the tick count changes. You can also access the current tick count (CurrentReading) at any time by using the Get request. This will also provide the current reading as an angle in radians (if TicksPerResolution is set) and the TimeStamp for the reading. It also returns tick count since the last reset of the counter (which you can reset using ResetTickCounter).

Updated information might be available online in the MSDN Library page:

Robotics Common: Robotics Common Overview



© 2012 Microsoft Corporation. All Rights Reserved.