borntoleave / catMini

This is the course repository for catMini.
52 stars 39 forks source link

Servo movement explanation #7

Open correderadiego opened 6 years ago

correderadiego commented 6 years ago

Hello, I already have a basic structure where I could make work together :

borntoleave commented 6 years ago

Gaits are periodical movements of limbs. The limb movements are divided to frames with short time intervals. Each frame defines the joints' angles and will be converted to PWM signals sent to the servos.

Currently the gaits are stored in PROGMEM(slow flash momory) as character strings. One character has 1 byte, which can hold integers ranging -128~127. Number 0, however, is confusing as '\0'(the termination symbol of C type string) so I shifted all 0 angles to 1.

The gait list is stored in modes.h, formatted as (taking bound as example)

const char bd[] PROGMEM = { 19, //number of frames
 93, 93, 63, 63,-36,-36,  7,  7, //frame1
 83, 83, 49, 49,-41,-41, 14, 14, //frame2
....
'\0'};

Depending on the control token in catMini.ino, the dutyAng will copy those information from PROGMEM to SRAM(faster memory). The robot will "display" those frames with it's limb servos, to perform walking.