Servo
Last updated
Last updated
A servo is a type of motor that can be precisely controlled to rotate to a specific position. Unlike traditional DC motors, servos have built-in feedback mechanisms that allow them to maintain their desired position. Although they have a limited rotational range, they are more precise than CR Servos and have higher holding torques.
Programming these servos are similar to setting the target position on a DC motor. There are only 2 steps, setting the position and sleeping the program.
Setting the position
What this code does is that it tells the servo what position to move to. Based on the encoder’s readings the servo will automatically rotate until it has reached the desired position.
Sleeping the program
By calling this block, the program doesn’t execute for the specified amount of milliseconds. This may seem dumb but it has an important purpose: it gives the servo in step 1 time to move the desired position. Just setting the target position of a servo doesn’t make the robot move! Instead it defines the servo’s behavior. To let the servo move the robot, you need to give it time, literally! Sleeping the program will allow the robot time to move around. When the servo has arrived at the target position, it will automatically stop moving so no further action is necessary.
Often servos will need to limit the range at which they operate. Some robotics arms, for example, cannot depress below a certain point since the servo then could no longer lift the arm back up without overloading it. Other tasks may only operate within a precise range. To prevent such incidents from occurring you can use the scaleRange block to limit the servo’s range.
This will prevent the robot from moving past a minimum and maximum range so you can rest easy when programming the robot.
Servos play an important part in controlling more precise devices unfit for motors. Their uniquely high precision, holding torque, and lightweightness make them a fantastic way to power grippers, rotate a turret, or power any number of devices.