Add Esp32 (serial) vehicle to pycar

This commit is contained in:
Piv
2020-09-12 15:49:01 +09:30
parent fc3607316d
commit c97df7bbaa
8 changed files with 99 additions and 46 deletions

View File

@@ -10,6 +10,8 @@ The protocol specification is as follows, assuming an array of bytes:
| 0 | 0 if Calibrating a servo. Higher values indicates channel number to set duty cycle on. |
| 1 | If byte 0 = 0: number of servos to calibrate. Else, the new duty cycle value for the channel specified in byte 0. |
When setting the duty cycle, the current min angle is 0, and the max angle is 255, which allows the entire byte to be used for setting the duty cycle.
The table below describes the byte format for calibrating a servo. This array of bytes can be repeated for the given number of servos in byte 1:
| Byte Number | Value Description |
@@ -19,4 +21,8 @@ The table below describes the byte format for calibrating a servo. This array of
The min/max pulse widths are hardcoded to 1000us/2000us respectively.
At the end of each loop, the entire array will be read, to flush any data that may cause issues later.
At the end of each loop, the entire array will be read, to flush any data that may cause issues later.
Upcoming (TODO):
- Use bit shift to allow 12 bits to be used for the duty cycle range, as there can only be a max of 16 channels anyway (4 bits).
- Consider protobuf or msgpack for serialisation format, for more advanced use cases, and more maintainable communication formats (currently changing the message format will require changes to the entire protocol)