You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: programming/servos.md
+29-9Lines changed: 29 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@ You can read the last value a servo was set to using similar code:
50
50
print(robot.servo_board.servos[1].position)
51
51
~~~~~
52
52
53
+
53
54
Disabling servo outputs
54
55
-----------------------
55
56
@@ -61,15 +62,34 @@ This is the state all the servo outputs are in when the board turns on, where no
61
62
robot.servo_board.servos[5].position =None
62
63
~~~~~
63
64
64
-
[How the set position relates to the servo angle](#ServoAngle) {#ServoAngle}
65
-
-----------------------------------------------
65
+
66
+
Extended servo range
67
+
--------------------
68
+
69
+
For an RC servo the angle of rotation is determined by the width of an electrical pulse on the control wire.
70
+
A typical servo expects to see a pulse every 20ms, with a pulse width between 1ms and 2ms.
71
+
Our API will take the position provided (between -1 and 1) and map it to the correct pulse width.
72
+
73
+
However 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.
74
+
The API can be used to change what the limits of pulse width are for each servo.
75
+
You should experiment and find what the actual limit of your servos are but be careful not drive them past that.
76
+
77
+
| Parameter | Min value | Max value |
78
+
|-------------------|-------------|-------------|
79
+
|Pulse width default|1000 µs|2000 µs|
80
+
|Pulse width limit |500 µs |4000 µs|
81
+
82
+
This code to set the pulse width limits should be done before setting the position of the servo.
83
+
84
+
~~~~~python
85
+
# set the range of servo output 7 between 500us and 2500us
# Then move the position of the servo to the upper position
89
+
# (pulse width = 2500us)
90
+
robot.servo_board.servos[7].position =1
91
+
~~~~~
66
92
67
93
<divclass="warning">
68
-
You should be careful about forcing a servo to drive past its end stops.
69
-
Some servos are very strong and it could damage the internal gears.
94
+
You should be careful about forcing a servo to drive past its end stops as this could damage the internal gears.
70
95
</div>
71
-
72
-
The angle of an RC servo is controlled by the width of a pulse supplied to it periodically.
73
-
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.
74
-
To be able to handle the widest range of all servos our hardware outputs a very wide range of pulse widths which in some cases will force the servo to try and turn past its internal end-stops.
75
-
You should experiment and find what the actual limit of your servos are (it almost certainly won't be -1 and 1) and not drive them past that.
0 commit comments