catMini icon indicating copy to clipboard operation
catMini copied to clipboard

Look up table data format

Open correderadiego opened this issue 7 years ago • 1 comments

I am working on the servo controller right know and I need to comment some points. We start from the modes.h. In this file you store the position of each servo for every moment. This work as a look up table. I add one example for bd :const char bd[] PROGMEM = { 19, 93, 93, 63, 63,-36,-36, 7, 7, 83, 83, 49, 49,-41,-41, 14, 14, 73, 73, 36, 36,-41,-41, 22, 22, 63, 63, 34, 34,-36,-36, 19, 19, 52, 52, 36, 36,-28,-28, 9, 9, 45, 45, 40, 40,-19,-19, -1, -1, 41, 41, 47, 47,-11,-11,-12,-12, 41, 41, 55, 55, -4, -4,-21,-21, 47, 47, 63, 63, -1, -1,-28,-28, 54, 54, 78, 78, 4, 4,-34,-34, 57, 57, 99, 99, 15, 15,-39,-39, 56, 56,106,106, 27, 27,-36,-36, 61, 61,107,107, 26, 26,-30,-30, 69, 69,104,104, 18, 18,-21,-21, 78, 78, 99, 99, 7, 7,-11,-11, 87, 87, 91, 91, -3, -3, -2, -2, 93, 93, 83, 83,-14,-14, 4, 4, 96, 96, 78, 78,-23,-23, 5, 5, 94, 94, 66, 66,-33,-33, 6, 6, '\0'}; In this point I have one questions :

  • Which kind of data you store in this vector? Are you storing pulse width or angle ? Which are the limit values?Between 0 to 360?

correderadiego avatar Aug 19 '18 06:08 correderadiego

The table stores angle data in degrees. The range is between -128~127, same as the range of one byte. Zero angle position is defined at the calibration stage. I’m skipping 0 degree because the data is stored as character string, and '0' will be mistaken as ‘\0’ when read by the pgm_read_word() function.

The table is a 2D array stored in 1D manner. The vertical dimension indicates time. The first number is the number of rows(frames). For the mini version, it doesn’t have head, tail or shoulder(roll) servos, which would take up the first 8 columns (indexed 0~7) on the full version. The first column is the left front shoulder (pitch) servo, indexed from 8. https://github.com/borntoleave/catMini/raw/master/Images/assembled.png

For each row after the first number, it represents one static frame of the limb joint angles. Imagine the cat a a movie player. Static frames create movements when looped from top row to bottom row, and repeat as cycles.

borntoleave avatar Aug 19 '18 18:08 borntoleave