Servo Component

The servo component provides an API for controlling the angular position of a servo precisely or getting its current status.

If you have a physical “RC” or “hobby” servo motor with built-in potentiometer position sensors, configure it as a servo component.

If your motor is coupled with an encoder, not a potentiometer, for position feedback, you should configure it as an encoded motor instead.

Available models

To use a hobby servo, you need to add it to your machine’s configuration.

Go to your machine’s CONFIGURE page, and add a model that supports your servo.

For additional configuration information, click on the model name:

Model
Description
ModelDescription
gpioA hobby servo.

API

The servo API supports the following methods:

Method NameDescriptionviam-micro-server Support
MoveMove the servo to the desired angle in degrees.

GetPositionGet the current set angle of the servo in degrees.

IsMovingReturns whether the servo is actively moving (or attempting to move) under its own power.

StopStop the servo from moving.

ReconfigureReconfigure this resource.

GetResourceNameGet the ResourceName for this servo with the given name.

CloseSafely shut down the resource and prevent further use.

Troubleshooting

You can find additional assistance in the Troubleshooting section.

You can also ask questions in the Community Discord and we will be happy to help.

Next steps

For general configuration and development info, see: