Wiki source code of LSS - Communication Protocol

Version 98.2 by Coleman Benson on 2019/02/05 11:13

Show last authors
1 (% class="wikigeneratedid" id="HTableofContents" %)
2 **Table of Contents**
3
4 {{toc depth="3"/}}
5
6 = Serial Protocol Concept =
7
8 The custom Lynxmotion Smart Servo (LSS) serial protocol was created in order to be as simple and straightforward as possible from a user perspective ("human readable format"), while at the same time compact and robust yet highly versatile. The protocol was based on Lynxmotion's SSC-32 RC servo controller and almost everything one might expect to be able to configure for a smart servo motor is available.
9
10 In order to have servos react differently when commands are sent to all servos in a serial bus, the first step a user should take is to assign a different ID number to each servo (explained below). Once this has been done, only the servo(s) which have been assigned to the ID sent as part of the command will follow that command. There is currently no CRC / checksum implemented as part of the protocol.
11
12 == Session ==
13
14 A "session" is defined as the time between when the servo is powered ON to when it is powered OFF or reset.
15
16 Note that for a given session, the action related to a specific commands overrides the stored value in EEPROM.
17
18 == Action Commands ==
19
20 Action commands tell the servo, within that session, to do something (i.e. "take an action"). The types of action commands which can be sent are described below, and they cannot be combined with other commands such as queries or configurations. Only one action command can be sent at a time. Action commands are session-specific, therefore once a servo is power cycled, it will not have any "memory" of previous actions or virtual positions (described below on this page). Action commands are sent serially to the servo's Rx pin and must be sent in the following format:
21
22 1. Start with a number sign # (U+0023)
23 1. Servo ID number as an integer
24 1. Action command (one to three letters, no spaces, capital or lower case)
25 1. Action value in the correct units with no decimal
26 1. End with a control / carriage return '<cr>'
27
28 (((
29 Ex: #5PD1443<cr>
30
31 This sends a serial command to all servo's Rx pins which are connected to the bus and only servo(s) with ID #5 will move to a position in tenths of degrees ("PD") of 144.3 degrees. Any servo on the bus which does not have ID 5 will take no action when receiving this command.
32
33 == Action Modifiers ==
34
35 Only two commands can be used as action modifiers: Timed Move (T) and Speed (S) described below. Action modifiers can only be used with certain action commands. The format to include a modifier is:
36
37 1. Start with a number sign # (U+0023)
38 1. Servo ID number as an integer
39 1. Action command (one to three letters, no spaces, capital or lower case)
40 1. Action value in the correct units with no decimal
41 1. Modifier command (one letter)
42 1. Modifier value in the correct units with no decimal
43 1. End with a control / carriage return '<cr>'
44
45 Ex: #5P1456T1263<cr>
46
47 This results in the servo with ID #5 rotating from the current angular position to a pulse position ("P") of 1456 in a time ("T") of 1263 milliseconds.
48 )))
49
50 == Query Commands ==
51
52 Query commands request information from the servo. They are received via the Rx pin of the servo, and the servo's reply is sent via the servo's Tx pin. Using separate lines for Tx and Rx is called "full duplex". Query commands are also similar to action and configuration commands and must use the following format:
53
54 1. Start with a number sign # (U+0023)
55 1. Servo ID number as an integer
56 1. Query command (one to three letters, no spaces, capital or lower case)
57 1. End with a control / carriage return '<cr>'
58
59 (((
60 Ex: #5QD<cr>Query position in degrees for servo #5
61 )))
62
63 (((
64 The query will return a serial string (almost instantaneously) via the servo's Tx pin with the following format:
65
66 1. Start with an asterisk * (U+002A)
67 1. Servo ID number as an integer
68 1. Query command (one to three letters, no spaces, capital letters)
69 1. The reported value in the units described, no decimals.
70 1. End with a control / carriage return '<cr>'
71
72 There is currently no option to control how fast a servo replies after it has received a query command, therefore when sending a query command to the bus, the controller should be prepared to immediately "listen" for and parse the reply. Sending multiple queries on a bus in fast succession may result in replies overlapping and giving incorrect or corrupt data. As such, the controller should receive a reply before sending a new command. A reply to the query sent above might be:
73
74 (((
75 Ex: *5QD1443<cr>
76 )))
77
78 This indicates that servo #5 is currently at 144.3 degrees (1443 tenths of degrees).
79
80 == Configuration Commands ==
81
82 Configuration commands and corresponding values affect a servo's defaults which are written to and read from the servo's EEPROM. These configurations are retained in memory after the servo is reset or power is cut / lost. Some configuration commands affect the session, while others do not. In the Command table below, the column "Session" denotes if the configuration command affects the session.. Not all action commands have a corresponding configuration command and vice versa. More information about which configuration commands are retained when in RC mode can be found on the [[LSS - RC PWM page>>doc:Lynxmotion Smart Servo (LSS).LSS - RC PWM.WebHome]]. Configuration commands are not cumulative, in that if two configurations are sent, one after the next, only the last configuration is used and stored. The format to send a configuration command is identical to that of an action command:
83
84 1. Start with a number sign # (U+0023)
85 1. Servo ID number as an integer
86 1. Configuration command (two to three letters, no spaces, capital or lower case)
87 1. Configuration value in the correct units with no decimal
88 1. End with a control / carriage return '<cr>'
89
90 Ex: #5CO-50<cr>
91
92 This configures an absolute origin offset ("CO") with respect to factory origin to servo with ID #5 and changes the offset for that session to -5.0 degrees (50 tenths of degrees). Once the servo is powered off and then powered on, zeroing the servo will cause it to move to -5.0 degrees with respect to the factory origin and report its position as 0 degrees. Configuration commands can be undone / reset either by sending the servo's default value for that configuration, or by doing a factory reset (clears all configurations) described below.
93
94 **Session vs Configuration Query**
95
96 By default, the query command returns the sessions' value. Should no action commands have been sent to change the session value, it will return the value saved in EEPROM which will either be the servo's default, or modified with a configuration command. In order to query the value stored in EEPROM (configuration), add a '1' to the query command:
97
98 Ex: #5CSR20<cr> immediately sets the maximum speed for servo #5 to 20rpm (explained below) and changes the value in memory.
99
100 After RESET, a command of #5SR4<cr> sets the session's speed to 4rpm, but does not change the configuration value in memory. Therefore:
101
102 #5QSR<cr> would return *5QSR4<cr> which represents the value for that session, whereas
103
104 #5QSR1<cr> would return *5QSR20<cr> which represents the value in EEPROM
105
106 == Virtual Angular Position ==
107
108 The ability to store a "virtual angular position" is a feature which allows for rotation beyond 360 degrees, permitting multiple rotations of the output horn, moving the center position and more. In virtual position mode, the "absolute position" would be the angle of the output shaft with respect to a 360.0 degree circle, and can be obtained by taking the modulus (with respect to 360 degrees) of the value. For example if the virtual position is reported as 15335 (or 1533.5 degrees), taking the modulus would give 93.5 degrees (3600 * 4 + 935 = 15335) as the absolute position (assuming no origin offset).
109
110 [[image:LSS-servo-positions.jpg]]
111
112 In this example, the gyre direction (explained below, a.k.a. "rotation direction") is positive (clockwise), and origin offset has not been modified. Each square represents 30 degrees. The following command is sent:
113
114 #1D-300<cr> This causes the servo to move to -30.0 degrees (green arrow)
115
116 #1D2100<cr> This second position command is sent to the servo, which moves it to 210.0 degrees (orange arrow)
117
118 #1D-4200<cr> This next command rotates the servo counterclockwise to a position of -420 degrees (red arrow), which means one full rotation of 360 degrees plus 60.0 degrees (420.0 - 360.0), with a virtual position of -420.0 degrees.
119
120 Although the final physical position would be the same as if the servo were commanded to move to -60.0 degrees, the servo is in fact at -420.0 degrees.
121
122 #1D4800<cr> This new command is sent which would then cause the servo to rotate from -420.0 degrees to 480.0 degrees (blue arrow), which would be a total of 900 degrees of clockwise rotation, or 2.5 complete rotations.
123
124 #1D3300<cr> would cause the servo to rotate from 480.0 degrees to 330.0 degrees (yellow arrow).
125
126 If / once the servo loses power or is power cycled, it also loses the virtual position associated with that session. For example, if the virtual position was 480.0 degrees before power is cycled, upon power up the servo's position will be read as +120.0 degrees from zero (assuming center position has not been modified).
127 )))
128
129 = Command List =
130
131 |= #|=Description|= Action|= Query|= Config|=Session|= RC|= Serial|= Units|=(% style="width: 510px;" %) Notes|=(% style="width: 113px;" %)Default Value
132 | 1|[[**L**imp>>||anchor="H1.Limp28L29"]]| L| | | | | ✓|none|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
133 | 2|[[**H**alt & **H**old>>||anchor="H2.Halt26Hold28H29"]]| H| | | | | ✓|none|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
134 | 3|[[**T**imed move>>||anchor="H3.Timedmove28T29"]]| T| | | | | ✓|milliseconds|(% style="width:510px" %) Modifier only for {P, D, MD}|(% style="text-align:center; width:113px" %)
135 | 4|[[**S**peed>>||anchor="H4.Speed28S29"]]| S| | | | | ✓|microseconds per second|(% style="width:510px" %) Modifier only {P}|(% style="text-align:center; width:113px" %)
136 | 5|[[**M**ove in **D**egrees (relative)>>||anchor="H5.28Relative29MoveinDegrees28MD29"]]| MD| | | | | ✓|tenths of degrees (ex 325 = 32.5 degrees)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
137 | 6|[[**O**rigin Offset>>||anchor="H6.OriginOffsetAction28O29"]]| O| QO|CO|✓| ✓| ✓|tenths of degrees (ex 91 = 9.1 degrees)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)(((
138 0
139 )))
140 | 7|[[**A**ngular **R**ange>>||anchor="H7.AngularRange28AR29"]]| AR| QAR| CAR|✓| ✓| ✓|tenths of degrees |(% style="width:510px" %) |(% style="text-align:center; width:113px" %)(((
141 1800
142 )))
143 | 8|[[Position in **P**ulse>>||anchor="H8.PositioninPulse28P29"]]| P| QP| | | | ✓|microseconds|(% style="width:510px" %)(((
144 Inherited from SSC-32 serial protocol
145 )))|(% style="text-align:center; width:113px" %)
146 | 9|[[Position in **D**egrees>>||anchor="H9.PositioninDegrees28D29"]]| D| QD| | | | ✓|tenths of degrees |(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
147 | 10|[[**W**heel mode in **D**egrees>>||anchor="H10.WheelModeinDegrees28WD29"]]| WD| QWD| | | | ✓|tenths of degrees per second (ex 248 = 24.8 degrees per second)|(% style="width:510px" %)A.K.A. "Speed mode" or "Continuous rotation"|(% style="text-align:center; width:113px" %)
148 | 11|[[**W**heel mode in **R**PM>>||anchor="H11.WheelModeinRPM28WR29"]]| WR| QWR| | | | ✓|revolutions per minute (rpm)|(% style="width:510px" %)A.K.A. "Speed mode" or "Continuous rotation"|(% style="text-align:center; width:113px" %)
149 | 12|[[Max **S**peed in **D**egrees>>||anchor="H12.SpeedinDegrees28SD29"]]| SD| QSD|CSD|✓| ✓| ✓|tenths of degrees per second |(% style="width:510px" %)(((
150 QSD: Add modifier "2" for instantaneous speed.
151
152 SD overwrites SR / CSD overwrites CSR and vice-versa.
153 )))|(% style="text-align:center; width:113px" %)Max per servo
154 | 13|[[Max **S**peed in **R**PM>>||anchor="H13.SpeedinRPM28SR29"]]| SR| QSR|CSR|✓| ✓| ✓|revolutions per minute (rpm)|(% style="width:510px" %)(((
155 QSR: Add modifier "2" for instantaneous speed
156
157 SR overwrites SD / CSR overwrites CSD and vice-versa.
158 )))|(% style="text-align:center; width:113px" %)Max per servo
159 | 14|[[**LED** Color>>||anchor="H16.RGBLED28LED29"]]| LED| QLED| CLED|✓| ✓| ✓|none (integer from 0 to 8)|(% style="width:510px" %)0=Off (black); 1=Red 2=Green; 3=Blue; 4=Yellow; 5=Cyan; 6=Magenta; 7=White;|(% style="text-align:center; width:113px" %)7
160 | 15|[[**ID** #>>||anchor="H17.IdentificationNumber"]]| | QID| CID| | | ✓|none (integer from 0 to 250)|(% style="width:510px" %)Note: ID 254 is a "broadcast" which all servos respond to. |(% style="text-align:center; width:113px" %)0
161 | 16|[[**B**aud rate>>||anchor="H18.BaudRate"]]| B| QB| CB| | | ✓|none (integer)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)9600
162 | 17|[[**G**yre direction (**G**)>>||anchor="H19.GyreRotationDirection"]]| G| QG| CG|✓| ✓| ✓|none |(% style="width:510px" %)Gyre / rotation direction: 1= CW (clockwise) -1 = CCW (counter-clockwise)|(% style="text-align:center; width:113px" %)1
163 | 18|[[**F**irst Position (**P**ulse)>>||anchor="H20.First2InitialPosition28pulse29"]]| | QFP|CFP | | ✓| ✓|none |(% style="width:510px" %)CFP overwrites CFD and vice-versa|(% style="text-align:center; width:113px" %)(((
164 Limp
165 )))
166 | 19|[[**F**irst Position (**D**eg)>>||anchor="H21.First2InitialPosition28Degrees29"]]| | QFD|CFD| | ✓| ✓|none |(% style="width:510px" %)CFD overwrites CFP and vice-versa|(% style="text-align:center; width:113px" %)Limp
167 | 20|[[**T**arget (**D**eg) **P**osition>>||anchor="H22.QueryTargetPositioninDegrees28QDT29"]]| | QDT| | | | ✓|tenths of degrees (ex 325 = 32.5 degrees)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
168 | 21|[[**M**odel **S**tring>>||anchor="H23.QueryModelString28QMS29"]]| | QMS| | | | |none (string)|(% style="width:510px" %) Returns the type of servo (ST, HS, HT)|(% style="text-align:center; width:113px" %)
169 | 22|[[Serial **N**umber>>||anchor="H24.QuerySerialNumber28QN29"]]| | QN| | | | |none (integer)|(% style="width:510px" %) Returns the unique serial number for that servo|(% style="text-align:center; width:113px" %)
170 | 23|[[**F**irmware version>>||anchor="H25.QueryFirmware28QF29"]]| | QF| | | | |none (integer)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
171 | 24|[[**Q**uery (gen. status)>>||anchor="H26.QueryStatus28Q29"]]| | Q| | | | ✓|none (integer from 1 to 8)|(% style="width:510px" %) See command description for details|(% style="text-align:center; width:113px" %)
172 | 25|[[**V**oltage>>||anchor="H27.QueryVoltage28QV29"]]| | QV| | | | ✓|millivolts (ex 5936 = 5936mV = 5.936V)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
173 | 26|[[**T**emperature>>||anchor="H28.QueryTemperature28QT29"]]| | QT| | | | ✓|tenths of degrees Celsius|(% style="width:510px" %)Max temp before error: 85°C (servo goes limp)|(% style="text-align:center; width:113px" %)
174 | 27|[[**C**urrent>>||anchor="H29.QueryCurrent28QC29"]]| | QC| | | | ✓|milliamps (ex 200 = 0.2A)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)
175 | 28|[[**RC** Mode>>||anchor="H30.RCMode28CRC29"]] - Position| | |CRC1|✓| | ✓|none|(% style="width:510px" %)(((
176 Change to RC position mode. To revert to smart mode, use the button menu.
177 )))|(% style="text-align:center; width:113px" %)Serial
178 | 29|[[**RC** Mode>>||anchor="H30.RCMode28CRC29"]] - Wheel| | |CRC2|✓| | ✓| |(% style="width:510px" %)Change to RC wheel mode. To revert to smart mode, use the button menu.|(% style="text-align:center; width:113px" %)Serial
179 | 30|[[**RESET**>>||anchor="H31.RESET"]]| | | | | | ✓|none|(% style="width:510px" %)Soft reset. See command for details.|(% style="text-align:center; width:113px" %)
180 | 31|[[**DEFAULT**>>||anchor="H32.DEFAULTA026CONFIRM"]]| | | | | |✓|none|(% style="width:510px" %)Revert to firmware default values. See command for details|(% style="text-align:center; width:113px" %)
181 | 32|[[**UPDATE**>>||anchor="H33.UPDATEA026CONFIRM"]]| | | | | |✓|none|(% style="width:510px" %)Update firmware. See command for details.|(% style="text-align:center; width:113px" %)
182
183 == Advanced ==
184
185 |= #|=Description|= Action|= Query|= Config|=Session|= RC|= Serial|= Units|=(% style="width: 510px;" %) Notes|=(% style="width: 113px;" %)Default Value
186 | A1|[[**A**ngular **S**tiffness>>||anchor="H14.AngularStiffness28AS29"]]| AS|QAS|CAS|✓| ✓| ✓|none (integer -4 to +4)|(% style="width:510px" %)Suggested values are between 0 to +4|(% style="text-align:center; width:113px" %)0
187 | A2|[[**A**ngular **H**olding Stiffness>>||anchor="H15.AngularHoldStiffness28AH29"]]|AH|QAH|CAH|✓| | ✓|none (integer -10 to +10)|(% style="width:510px" %) |(% style="text-align:center; width:113px" %)1
188 | A3|[[**A**ngular **A**cceleration>>||anchor="H15b:AngularAcceleration28AA29"]]|AA|QAA|CAA|✓| | ✓|degrees per second squared|(% style="width:510px" %)Increments of 10 degrees per second squared|(% style="text-align:center; width:113px" %)
189 | A4|[[**A**ngular **D**eceleration>>||anchor="H15c:AngularDeceleration28AD29"]]|AD|QAD|CAD|✓| | ✓|degrees per second squared|(% style="width:510px" %)Increments of 10 degrees per second squared|(% style="text-align:center; width:113px" %)
190 | A5|[[**E**nable **M**otion Control>>||anchor="H15d:MotionControl28MC29"]]|EM|QEM| | | | ✓|none|(% style="width:510px" %)EM0 to disable motion control, EM1 to enable|(% style="text-align:center; width:113px" %)
191 | A6|[[**C**onfigure **L**ED **B**linking>>||anchor="H16b.ConfigureLEDBlinking28CLB29"]]| | | CLB| | ✓| |none (integer from 0 to 63)|(% style="width:510px" %)(((
192 0=No blinking, 63=Always blink;
193
194 Blink while: 1=Limp; 2=Holding 4=Accel; 8=Decel; 16=Free 32=Travel;
195 )))|(% style="text-align:center; width:113px" %)
196
197 == Details ==
198
199 ====== __1. Limp (**L**)__ ======
200
201 Example: #5L<cr>
202
203 This action causes the servo to go "limp". The microcontroller will still be powered, but the motor will not. As an emergency safety feature, should the robot not be doing what it is supposed to or risks damage, use the broadcast ID to set all servos limp #254L<cr>.
204
205 ====== __2. Halt & Hold (**H**)__ ======
206
207 Example: #5H<cr>
208
209 This action overrides whatever the servo might be doing at the time the command is received (accelerating, moving continuously etc.) and causes it to stop immediately and hold that angular position.
210
211 ====== __3. Timed move (**T**)__ ======
212
213 Example: #5P1500T2500<cr>
214
215 Timed move can be used only as a modifier for a position (P, D, MD) actions. The units are in milliseconds, so a timed move of 2500 milliseconds would cause the servo to rotate from its current position to the desired position in 2.5 seconds. The onboard controller will attempt to ensure that the move is performed entirely at the desired velocity, though differences in torque may cause it to not be exact. This command is in place to ensure backwards compatibility with the SSC-32 / 32U protocol.
216
217 Note: If the calculated speed at which a servo must rotate for a timed move is greater than its maximum speed (which depends on voltage and load), then it will move at its maximum speed, and the time of the move may be longer than requested.
218
219 ====== __4. Speed (**S**)__ ======
220
221 Example: #5P1500S750<cr>
222
223 This command is a modifier only for a position (P) action and determines the speed of the move in microseconds per second. A speed of 750 microseconds would cause the servo to rotate from its current position to the desired position at a speed of 750 microseconds per second. This command is in place to ensure backwards compatibility with the SSC-32 / 32U protocol.
224
225 ====== __5. (Relative) Move in Degrees (**MD**)__ ======
226
227 Example: #5MD123<cr>
228
229 The relative move command causes the servo to read its current position and move the specified number of tenths of degrees in the corresponding position. For example if the servo is set to rotate CW (default) and an MD command of 123 is sent to the servo, it will cause the servo to rotate clockwise by 12.3 degrees. Negative commands would cause the servo to rotate in the opposite configured direction.
230
231 ====== __6. Origin Offset Action (**O**)__ ======
232
233 Example: #5O2400<cr>
234
235 This command allows you to temporarily change the origin of the servo in relation to the factory zero position for that session. As with all action commands, the setting will be lost upon servo reset / power cycle. Origin offset commands are not cumulative and always relate to factory zero. In the first image, the origin at factory offset '0' (centered).
236
237 [[image:LSS-servo-default.jpg]]
238
239 In the second image, the origin, and the corresponding angular range (explained below) have been shifted by +240.0 degrees:
240
241 [[image:LSS-servo-origin.jpg]]
242
243 Origin Offset Query (**QO**)
244
245 Example: #5QO<cr> Returns: *5QO-13
246
247 This allows you to query the angle (in tenths of degrees) of the origin in relation to the factory zero position. In this example, the new origin is at -1.3 degrees from the factory zero.
248
249 Configure Origin Offset (**CO**)
250
251 Example: #5CO-24<cr>
252
253 This command allows you to change the origin of the servo in relation to the factory zero position in EEPROM. The setting will be saved upon servo reset / power cycle. Origin offset configuration commands are not cumulative and always relate to factory zero. The new origin is also used in RC mode. In the example, the new origin will be at -2.4 degrees from the factory zero.
254
255 ====== __7. Angular Range (**AR**)__ ======
256
257 Example: #5AR1800<cr>
258
259 This command allows you to temporarily change the total angular range of the servo in tenths of degrees. This applies to the Position in Pulse (P) command and RC mode. The default for (P) and RC mode is 1800 (180.0 degrees total, or ±90.0 degrees). The image below shows a standard -180.0 to +180.0 range, with no offset:
260
261 [[image:LSS-servo-default.jpg]]
262
263 Below, the angular range is restricted to 180.0 degrees, or -90.0 to +90.0. The center has remained unchanged.
264
265 [[image:LSS-servo-ar.jpg]]
266
267 Finally, the angular range action command (ex. #5AR1800<cr>) and origin offset action command (ex. #5O-1200<cr>) are used to move both the center and limit the angular range:
268
269 [[image:LSS-servo-ar-o-1.jpg]]
270
271 Query Angular Range (**QAR**)
272
273 Example: #5QAR<cr> might return *5AR1800, indicating the total angular range is 180.0 degrees.
274
275 Configure Angular Range (**CAR**)
276
277 This command allows you to change the total angular range of the servo in tenths of degrees in EEPROM. The setting will be saved upon servo reset / power cycle.
278
279 ====== __8. Position in Pulse (**P**)__ ======
280
281 Example: #5P2334<cr>
282
283 The position in PWM pulses was retained in order to be backward compatible with the SSC-32 / 32U protocol. This relates the desired angle with an RC standard PWM pulse and is further explained in the SSC-32 and SSC-32U manuals found on Lynxmotion.com. Without any modifications to configuration considered, and a ±90.0 degrees standard range where 1500 microseconds is centered, a pulse of 2334 would set the servo to 165.1 degrees. Valid values for P are [500, 2500]. Values outside this range are corrected to end points.
284
285 Query Position in Pulse (**QP**)
286
287 Example: #5QP<cr> might return *5QP2334
288
289 This command queries the current angular position in PWM "units". The user must take into consideration that the response includes any angular range and origin configurations in order to determine the actual angle. 
290 Valid values for QP are {-500, [500, 2500], -2500}. Values outside the [500, 2500] range are given a negative corresponding end point value to indicate they are out of bounds (note that if the servo is physically located at one of the endpoints, it may return a negative number if it is a fraction of a degree beyond the position).
291
292 ====== __9. Position in Degrees (**D**)__ ======
293
294 Example: #5PD1456<cr>
295
296 This moves the servo to an angle of 145.6 degrees, where the center (0) position is centered. Negative values (ex. -176 representing -17.6 degrees) are used. A full circle would be from -1800 to 1800 degrees. A value of 2700 would be the same angle as -900, except the servo would move in a different direction.
297
298 Larger values are permitted and allow for multi-turn functionality using the concept of virtual position.
299
300 Query Position in Degrees (**QD**)
301
302 Example: #5QD<cr> might return *5QD132<cr>
303
304 This means the servo is located at 13.2 degrees.
305
306 ====== __10. Wheel Mode in Degrees (**WD**)__ ======
307
308 Ex: #5WD900<cr>
309
310 This command sets the servo to wheel mode where it will rotate in the desired direction at the selected speed. The example above would have the servo rotate at 90.0 degrees per second clockwise (assuming factory default configurations).
311
312 Query Wheel Mode in Degrees (**QWD**)
313
314 Ex: #5QWD<cr> might return *5QWD900<cr>
315
316 The servo replies with the angular speed in tenths of degrees per second. A negative sign would indicate the opposite direction (for factory default a negative value would be counter clockwise).
317
318 ====== __11. Wheel Mode in RPM (**WR**)__ ======
319
320 Ex: #5WR40<cr>
321
322 This command sets the servo to wheel mode where it will rotate in the desired direction at the selected rpm. Wheel mode (a.k.a. "continuous rotation") has the servo operate like a geared DC motor. The servo's maximum rpm cannot be set higher than its physical limit at a given voltage. The example above would have the servo rotate at 40 rpm clockwise (assuming factory default configurations).
323
324 Query Wheel Mode in RPM (**QWR**)
325
326 Ex: #5QWR<cr> might return *5QWR40<cr>
327
328 The servo replies with the angular speed in rpm. A negative sign would indicate the opposite direction (for factory default a negative value would be counter clockwise).
329
330 ====== __12. Max Speed in Degrees (**SD**)__ ======
331
332 Ex: #5SD1800<cr>
333
334 This command sets the servo's maximum speed for motion commands in tenths of degrees per second for that session. In the example above, the servo's maximum speed for that session would be set to 180.0 degrees per second. The servo's maximum speed cannot be set higher than its physical limit at a given voltage. The SD action command overrides CSD (described below) for that session. Upon reset or power cycle, the servo reverts to the value associated with CSD as described below. Note that SD and SR (described below) are effectively the same, but allow the user to specify the speed in either unit. The last command (either SR or SD) received is what the servo uses for that session.
335
336 Query Speed in Degrees (**QSD**)
337
338 Ex: #5QSD<cr> might return *5QSD1800<cr>
339
340 By default QSD will return the current session value, which is set to the value of CSD as reset/power cycle and changed whenever an SD/SR command is processed.
341 If #5QSD1<cr> is sent, the configured maximum speed (CSD value) will be returned instead. You can also query the current speed using "2" and the current target travel speed using "3". See the table below for an example:
342
343 |**Command sent**|**Returned value (1/10 °)**
344 |ex: #5QSD<cr>|Session value for maximum speed (set by latest SD/SR command)
345 |ex: #5QSD1<cr>|Configured maximum speed in EEPROM (set by CSD/CSR)
346 |ex: #5QSD2<cr>|Instantaneous speed (same as QWD)
347 |ex: #5QSD3<cr>|Target travel speed
348
349 Configure Speed in Degrees (**CSD**)
350
351 Ex: #5CSD1800<cr>
352
353 Using the CSD command sets the servo's maximum speed which is saved in EEPROM. In the example above, the servo's maximum speed will be set to 180.0 degrees per second. When the servo is powered on (or after a reset), the CSD value is used. Note that CSD and CSR (described below) are effectively the same, but allow the user to specify the speed in either unit. The last command (either CSR or CSD) is what the servo uses for that session.
354
355 ====== __13. Max Speed in RPM (**SR**)__ ======
356
357 Ex: #5SD45<cr>
358
359 This command sets the servo's maximum speed for motion commands in rpm for that session. In the example above, the servo's maximum speed for that session would be set to 45rpm. The servo's maximum speed cannot be set higher than its physical limit at a given voltage. SD overrides CSD (described below) for that session. Upon reset or power cycle, the servo reverts to the value associated with CSD as described below. Note that SD (described above) and SR are effectively the same, but allow the user to specify the speed in either unit. The last command (either SR or SD) received is what the servo uses for that session.
360
361 Query Speed in Degrees (**QSR**)
362
363 Ex: #5QSR<cr> might return *5QSR45<cr>
364
365 By default QSR will return the current session value, which is set to the value of CSR as reset/power cycle and changed whenever an SD/SR command is processed.
366 If #5QSR1<cr> is sent, the configured maximum speed (CSR value) will be returned instead. You can also query the current speed using "2" and the current target travel speed using "3". See the table below for an example:
367
368 |**Command sent**|**Returned value (1/10 °)**
369 |ex: #5QSR<cr>|Session value for maximum speed (set by latest SD/SR command)
370 |ex: #5QSR1<cr>|Configured maximum speed in EEPROM (set by CSD/CSR)
371 |ex: #5QSR2<cr>|Instantaneous speed (same as QWR)
372 |ex: #5QSR3<cr>|Target travel speed
373
374 Configure Speed in RPM (**CSR**)
375
376 Ex: #5CSR45<cr>
377
378 Using the CSR command sets the servo's maximum speed which is saved in EEPROM. In the example above, the servo's maximum speed will be set to 45rpm. When the servo is powered on (or after a reset), the CSR value is used. Note that CSD and CSR are effectively the same, but allow the user to specify the speed in either unit. The last command (either CSR or CSD) received is what the servo uses for that session.
379
380 ====== ======
381
382 ====== __16. RGB LED (**LED**)__ ======
383
384 Ex: #5LED3<cr>
385
386 This action sets the servo's RGB LED color for that session.The LED can be used for aesthetics, or (based on user code) to provide visual status updates. Using timing can create patterns.
387
388 0=OFF 1=RED 2=GREEN 3= BLUE 4=YELLOW 5=CYAN 6= 7=MAGENTA, 8=WHITE 
389
390 Query LED Color (**QLED**)
391
392 Ex: #5QLED<cr> might return *5QLED5<cr>
393
394 This simple query returns the indicated servo's LED color.
395
396 Configure LED Color (**CLED**)
397
398 Configuring the LED color via the CLED command sets the startup color of the servo after a reset or power cycle. Note that it also changes the session's LED color immediately as well.
399
400 ====== __17. Identification Number__ ======
401
402 A servo's identification number cannot be set "on the fly" and must be configured via the CID command described below. The factory default ID number for all servos is 0. Since smart servos are intended to be daisy chained, in order to respond differently from one another, the user must set different identification numbers. Servos with the same ID and baud rate will all receive and react to the same commands.
403
404 Query Identification (**QID**)
405
406 EX: #254QID<cr> might return *QID5<cr>
407
408 When using the query ID command, it is best to only have one servo connected and thus receive only one reply using the broadcast command (ID 254). Alternatively, pushing the button upon startup and temporarily setting the servo ID to 255 will still result in the servo responding with its "real" ID.
409
410 Configure ID (**CID**)
411
412 Ex: #4CID5<cr>
413
414 Setting a servo's ID in EEPROM is done via the CID command. All servos connected to the same serial bus will be assigned that ID. In most situations each servo must be set a unique ID, which means each servo must be connected individually to the serial bus and receive a unique CID number. It is best to do this before the servos are added to an assembly. Numbered stickers are provided to distinguish each servo after their ID is set, though you are free to use whatever alternative method you like.
415
416 ====== __18. Baud Rate__ ======
417
418 A servo's baud rate cannot be set "on the fly" and must be configured via the CB command described below. The factory default baud rate for all servos is 9600. Since smart servos are intended to be daisy chained, in order to respond to the same serial bus, all servos in that project should ideally be set to the same baud rate. Setting different baud rates will have the servos respond differently and may create issues. Available baud rates are: 9.6 kbps, 19.2 kbps, 38.4 kbps, 57.6 kbps, 115.2 kbps, 230.4 kbps, 250.0 kbps, 460.8 kbps, 500.0 kbps, 750.0 kbps*, 921.6 kbps*. Servos are shipped with a baud rate set to 9600. The baud rates are currently restricted to those above.
419 \*: Current tests reveal baud rates above 500 kbps are unstable and can cause timeouts. Please keep this in mind if using those / testing them out.
420
421 Query Baud Rate (**QB**)
422
423 Ex: #5QB<cr> might return *5QB9600<cr>
424
425 Querying the baud rate is used simply to confirm the CB configuration command before the servo is power cycled.
426
427 Configure Baud Rate (**CB**)
428
429 Important Note: the servo's current session retains the given baud rate and the new baud rate will only be in place when the servo is power cycled.
430
431 Ex: #5CB9600<cr>
432
433 Sending this command will change the baud rate associated with servo ID 5 to 9600 bits per second.
434
435 ====== __19. Gyre Rotation Direction__ ======
436
437 "Gyre" is defined as a circular course or motion. The effect of changing the gyre direction is as if you were to use a mirror image of a circle. CW = 1; CCW = -1. The factory default is clockwise (CW).
438
439 {images showing before and after with AR and Origin offset}
440
441 Query Gyre Direction (**QG**)
442
443 Ex: #5QG<cr> might return *5QG-1<cr>
444
445 The value returned above means the servo is in a counter-clockwise gyration.
446
447 Configure Gyre (**CG**)
448
449 Ex: #5CG-1<cr>
450
451 This changes the gyre direction as described above and also writes to EEPROM.
452
453 ====== __20. First / Initial Position (pulse)__ ======
454
455 In certain cases, a user might want to have the servo move to a specific angle upon power up. We refer to this as "first position". The factory default has no first position value stored in EEPROM and therefore upon power up, the servo remains limp until a position (or hold command) is assigned. FP and FD are different in that FP is used for RC mode only, whereas FD is used for smart mode only.
456
457 Query First Position in Pulses (**QFP**)
458
459 Ex: #5QFP<cr> might return *5QFP1550<cr>
460
461 The reply above indicates that servo with ID 5 has a first position pulse of 1550 microseconds. If no first position has been set, servo will respond with DIS ("disabled").
462
463 Configure First Position in Pulses (**CFP**)
464
465 Ex: #5CP1550<cr>
466
467 This configuration command means the servo, when set to RC mode, will immediately move to an angle equivalent to having received an RC pulse of 1550 microseconds upon power up. Sending a CFP command without a number results in the servo remaining limp upon power up (i.e. disabled).
468
469 ====== __21. First / Initial Position (Degrees)__ ======
470
471 In certain cases, a user might want to have the servo move to a specific angle upon power up. We refer to this as "first position". The factory default has no first position value stored in EEPROM and therefore upon power up, the servo remains limp until a position (or hold command) is assigned. FP and FD are different in that FP is used for RC mode only, whereas FD is used for smart mode only.
472
473 Query First Position in Degrees (**QFD**)
474
475 Ex: #5QFD<cr> might return *5QFD64<cr>
476
477 The reply above indicates that servo with ID 5 has a first position pulse of 1550 microseconds.
478
479 Configure First Position in Degrees (**CFD**)
480
481 Ex: #5CD64<cr>
482
483 This configuration command means the servo, when set to smart mode, will immediately move to 6.4 degrees upon power up. Sending a CFD command without a number results in the servo remaining limp upon power up.
484
485 ====== __22. Query Target Position in Degrees (**QDT**)__ ======
486
487 Ex: #5QDT<cr> might return *5QDT6783<cr>
488
489 The query target position command returns the target angle during and after an action which results in a rotation of the servo horn. In the example above, the servo is rotating to a virtual position of 678.3 degrees. Should the servo not have a target position or be in wheel mode, it will respond without a number (Ex: *5QDT<cr>).
490
491 ====== __23. Query Model String (**QMS**)__ ======
492
493 Ex: #5QMS<cr> might return *5QMSLSS-HS1cr>
494
495 This reply means the servo model is LSS-HS1, meaning a high speed servo, first revision.
496
497 ====== __23b. Query Model (**QM**)__ ======
498
499 Ex: #5QM<cr> might return *5QM68702699520cr>
500
501 This reply means the servo model is 0xFFF000000 or 100, meaning a high speed servo, first revision.
502
503 ====== __24. Query Serial Number (**QN**)__ ======
504
505 Ex: #5QN<cr> might return *5QN~_~_<cr>
506
507 The number in the response is the servo's serial number which is set and cannot be changed.
508
509 ====== __25. Query Firmware (**QF**)__ ======
510
511 Ex: #5QF<cr> might return *5QF11<cr>
512
513 The integer in the reply represents the firmware version with one decimal, in this example being 1.1
514
515 ====== __26. Query Status (**Q**)__ ======
516
517 Ex: #5Q<cr> might return *5Q6<cr>, which indicates the motor is holding a position.
518
519 |*Value returned|**Status**|**Detailed description**
520 |ex: *5Q0<cr>|Unknown|LSS is unsure
521 |ex: *5Q1<cr>|Limp|Motor driving circuit is not powered and horn can be moved freely
522 |ex: *5Q2<cr>|Free moving|Motor driving circuit is not powered and horn can be moved freely
523 |ex: *5Q3<cr>|Accelerating|Increasing speed from rest (or previous speeD) towards travel speed
524 |ex: *5Q4<cr>|Traveling|Moving at a stable speed
525 |ex: *5Q5<cr>|Decelerating|Decreasing from travel speed towards final position.
526 |ex: *5Q6<cr>|Holding|Keeping current position
527 |ex: *5Q7<cr>|Stepping|Special low speed mode to maintain torque
528 |ex: *5Q8<cr>|Outside limits|{More details coming soon}
529 |ex: *5Q9<cr>|Stuck|Motor cannot perform request movement at current speed setting
530 |ex: *5Q10<cr>|Blocked|Similar to stuck, but the motor is at maximum duty and still cannot move (i.e.: stalled)
531
532 ====== __27. Query Voltage (**QV**)__ ======
533
534 Ex: #5QV<cr> might return *5QV11200<cr>
535
536 The number returned has one decimal, so in the case above, servo with ID 5 has an input voltage of 11.2V (perhaps a three cell LiPo battery).
537
538 ====== __28. Query Temperature (**QT**)__ ======
539
540 Ex: #5QT<cr> might return *5QT564<cr>
541
542 The units are in tenths of degrees Celcius, so in the example above, the servo's internal temperature is 56.4 degrees C. To convert from degrees Celcius to degrees Farenheit, multiply by 1.8 and add 32. Therefore 56.4C = 133.52F.
543
544 ====== __29. Query Current (**QC**)__ ======
545
546 Ex: #5QC<cr> might return *5QC140<cr>
547
548 The units are in milliamps, so in the example above, the servo is consuming 140mA, or 0.14A.
549
550 ====== __30. RC Mode (**CRC**)__ ======
551
552 This command puts the servo into RC mode (position or continuous), where it will only respond to RC pulses. Note that because this is the case, the servo will no longer accept serial commands. The servo can be placed back into smart mode by using the button menu.
553
554 |**Command sent**|**Note**
555 |ex: #5CRC<cr>|Stay in smart mode.
556 |ex: #5CRC1<cr>|Change to RC position mode.
557 |ex: #5CRC2<cr>|Change to RC continuous (wheel) mode.
558 |ex: #5CRC*<cr>|Where * is any number or value. Stay in smart mode.
559
560 EX: #5CRC<cr>
561
562 ====== __31. RESET__ ======
563
564 Ex: #5RESET<cr> or #5RS<cr>
565
566 This command does a "soft reset" (no power cycle required) and reverts all commands to those stored in EEPROM (i.e. configuration commands).
567
568 ====== __32. DEFAULT & CONFIRM__ ======
569
570 Ex: #5DEFAULT<cr>
571
572 This command sets in motion the reset all values to the default values included with the version of the firmware installed on that servo. The servo then waits for the CONFIRM command. Any other command received will cause the servo to exit the DEFAULT function.
573
574 EX: #5DEFAULT<cr> followed by #5CONFIRM<cr>
575
576 Since it it not common to have to restore all configurations, a confirmation command is needed after a firmware command is sent. Should any command other than CONFIRM be received by the servo after the firmware command has been received, it will leave the firmware action.
577
578 Note that after the CONFIRM command is sent, the servo will automatically perform a RESET.
579
580 ====== __33. UPDATE & CONFIRM__ ======
581
582 Ex: #5UPDATE<cr>
583
584 This command sets in motion the equivalent of a long button press when the servo is not powered in order to enter firmware update mode. This is useful should the button be broken or inaccessible. The servo then waits for the CONFIRM command. Any other command received will cause the servo to exit the UPDATE function.
585
586 EX: #5UPDATE<cr> followed by #5CONFIRM<cr>
587
588 Since it it not common to have to update firmware, a confirmation command is needed after an UPDATE command is sent. Should any command other than CONFIRM be received by the servo after the firmware command has been received, it will leave the firmware action.
589
590 Note that after the CONFIRM command is sent, the servo will automatically perform a RESET.
591
592 ====== __A1. Angular Stiffness (**AS**)__ ======
593
594 The servo's rigidity / angular stiffness can be thought of as (though not identical to) a damped spring in which the value affects the stiffness and embodies how much, and how quickly the servo tried keep the requested position against changes.
595
596 A positive value of "angular stiffness":
597
598 * The more torque will be applied to try to keep the desired position against external input / changes
599 * The faster the motor will reach its intended travel speed and the motor will decelerate faster and nearer to its target position
600
601 A negative value on the other hand:
602
603 * Causes a slower acceleration to the travel speed, and a slower deceleration
604 * Allows the target position to deviate more from its position before additional torque is applied to bring it back
605
606 The default value is zero and the effect becomes extreme by -4, +4. There are no units, only integers between -4 to 4. Greater values produce increasingly erratic behavior.
607
608 Ex: #5AS-2<cr>
609
610 This reduces the angular stiffness to -2 for that session, allowing the servo to deviate more around the desired position. This can be beneficial in many situations such as impacts (legged robots) where more of a "spring" effect is desired. Upon reset, the servo will use the value stored in memory, based on the last configuration command.
611
612 Ex: #5QAS<cr>
613
614 Queries the value being used.
615
616 Ex: #5CAS<cr>
617
618 Writes the desired angular stiffness value to memory.
619
620 ====== __A2. Angular Holding Stiffness (**AH**)__ ======
621
622 The angular holding stiffness determines the servo's ability to hold a desired position under load. Values can be from -10 to 10, with the default being 0. Note that negative values mean the final position can be easily deflected.
623
624 Ex: #5AH3<cr>
625
626 This sets the holding stiffness for servo #5 to 3 for that session.
627
628 Query Angular Hold Stiffness (**QAH**)
629
630 Ex: #5QAH<cr> might return *5QAH3<cr>
631
632 This returns the servo's angular holding stiffness value.
633
634 Configure Angular Hold Stiffness (**CAH**)
635
636 Ex: #5CAH2<cr>
637
638 This writes the angular holding stiffness of servo #5 to 2 to EEPROM
639
640 ====== __A3: Angular Acceleration (**AA**)__ ======
641
642 {More details to come}
643
644 ====== __A4: Angular Deceleration (**AD**)__ ======
645
646 {More details to come}
647
648 ====== __A5: Motion Control (**EM**)__ ======
649
650 {More details to come}
651
652 ====== __A6. Configure LED Blinking (**CLB**)__ ======
653
654 This command allows you to control when the RGB LED will blink the user set color (see [[16. RGB LED>>||anchor="H16.RGBLED28LED29"]] for details).
655 You can turn on or off blinking for various LSS status. Here is the list and their associated value: 0=No blinking, ; 63=Always blink; Blink while: 1=Limp; 2=Holding 4=Accel; 8=Decel; 16=Free 32=Travel;
656
657 To set blinking, use CLB with the value of your choosing. To activate blinking in multiple status, simply add together the values of the corresponding status. See examples below:
658
659 Ex: #5CLB0<cr> to turn off all blinking (LED always solid)
660 Ex: #5CLB1<cr> only blink when limp
661 Ex: #5CLB2<cr> only blink when holding
662 Ex: #5CLB12<cr> only blink when accel or decel
663 Ex: #5CLB48<cr> only blink when free or travel
664 Ex: #5CLB63<cr> blink in all status
Copyright RobotShop 2018