Petoi Doc Center
🇺🇸English
Search
⌃K
🖇

Serial Protocol

We have defined a set of serial communication protocols for robots:
All the token starts with a single ASCII-encoded character to specify their parsing format. They are case-sensitive and usually in lowercase.
Some commands, like the c and m commands, can be combined.
For example:
Successive "m8 40", "m8 -35", "m 0 50" can be written as "m8 40 8 -35 0 50". You can combine up to four commands of the same type. To be exact, the length of the string should be smaller than 30 characters. You can change the limit in the code, but there might be a systematic constraint for the serial buffer.
Try the following serial commands in the serial monitor:
  • “ksit”
  • “m0 30”
  • “m0 -30”
  • “kbalance”
  • “kwkF”
  • “ktrL”
  • “d”
The quotation mark just indicates that they are character strings. Don’t type quotation marks in the serial monitor.
You can refer to the macro definitions in OpenCat.h to utilize the most updated sets of tokens.
Some more available commands for skills:
The complete set of skills in effect is defined in InstinctBittle.h or InstinctNybble.h: For example:
const char* skillNameWithType[]={"bdFI","bkI","bkLI","crFI","crLI","hlwI","mhFI","mhLI","pcFI","phFI","phLI","trFI","trLI","vtFI","vtLI","wkFI","wkLI","balanceI","buttUpI","calibI","droppedI","liftedI","restI","sitI","strI","zeroN","bfI","ckI","climbCeilI","fdI","ffI","hiI","jyI","pdI","peeI","puI","pu1I","rcI","rlLI","rtI","stpI","tsI",};
All the skill names in the list can be called by adding a 'k' to the front and deleting the suffix. For example, there's "sitI" in the list. You can send "ksit" to call the sitting posture. If a skill has "F" or "L" as the second last character, it's a gait. It means walking forward or left. Walking right is a mirror of walking left. So you can send "kwkF", "kwkL", "kwkR" to make the robot walk. Similarly, there are other gaits like trot ("tr"), crawl ("cr"), and stepping ("vt").