Configure a fake encoder

The fake encoder is an encoder model for testing code without any hardware.

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the encoder type, then select the fake model. Enter a name for your encoder and click Create.

Configuration of a fake encoder in the Viam app config builder.

{
  "name": "<your-encoder-name>",
  "type": "encoder",
  "model": "fake",
  "attributes": {}
}
{
  "name": "myEncoder",
  "type": "encoder",
  "model": "fake",
  "attributes": {}
}

No attributes are available for fake encoders.

Test the encoder

Once your encoder is configured and your robot is connected, go to the Control tab and click on the encoder’s drop-down panel. The ticks count is displayed.

Encoder control panel.



Have questions, or want to meet other people working on robots? Join our Community Discord.