Servos

Back to docs

SERVOS

In the initial version of the firmware of the brain box the position of the servos is set to more that 100%, see here for more. which means that they try their hardest to get there and can some times burn out, and blow up. If you are not running the update (not released as of 3/2/18) then immediately set the servos to a neutral in your initialization

The servos object is used to control servo’s. Similar to motorsservos can be used like a list. To do something with the the servo you would use:

R.servos[0].something...

SETTING SERVO POSITIONS

The position of servos can range from -100 to 100 inclusive:

# R.servos[SERVO_NUMBER] = POS

# set servo 1's position to 20
R.servos[0] = 20
# set servo 4's position to -75
R.servos[3] = -75

It is important that you use integers (whole numbers, such as 10 instead of 10.0) when specifying servo positions.

You can read the last value a servo was set to using similar code:

# get the last setting of the second servo
lastSetting = R.servos[1]

While it is possible to retrieve the last position a servo was set to, this does not guarantee that the servo is currently in that position.

HOW THE SET POSITION RELATES TO THE SERVO ANGLE

You should be careful about forcing a servo to drive past its end stops. Some servos are very strong and it could damage the internal gears.

The angle of an RC servo is controlled by the width of a pulse supplied to it periodically. There is no standard for the width of this pulse and there are differences between manufacturers as to what angle the servo will turn to for a given pulse width. Our hardware outputs:

Servo settingTimer pulse/ms
-1001
01.5
1002
Start up0.5

In some cases these values will force the servo to try and turn past its internal end-stops. You should experiment and find what the actual limit of your servos are and not drive them past that.

Last Updated On February 03, 2018