Hi everybody !!
We are two french student and we have to program an Hexapod robots ! We have to program 18 servomotors.
We made a simulation with a DAO software and found the angle of each servo in a very large EXCEL matrix !! (18 columns and 2000 lines !!!!!)
Is it possible to copy paste that matrix in our program ??
Thanks for your answer !!
System information :
Arduino ATmega 1280
18 ervo futaba 3003
I'd guess your best route would be to export it to a CSV with quotes and then use some clever search/replace to get it into array format so you can define it in code.
Someone else might come up with a better solution though but that's what I'd do.
18 columns by 2000 rows is 36000 values. Even if they are all bytes, that is NOT going to fit in SRAM.
Your best bet is to save the data as a csv file, on an SD card, and add an SD card reader to the robot. Read a record, move the servos. Repeat until you get to the end of the file.
Then what? Does the robot just stop?
At the end of the values the robot just stop.
So, on our arduino, SRAM is egual to 8Ko and 8Ko of EEPROM and 128Ko of flash memory.
If we take values with only 3 numbers (angle from 0 to 180°)...we can use 8000 values ?
((8ko of memory * octets)/8 bytes to code the three number of angle value ?)
Sorry for that stupid question but we are in mechanical design and we are novice in C language...
Thanks for your reply !!
We try to convert our EXCEL values with a basic software (transform columns in rows…) and withe the half of our values we occupe only 40% of the memory…
I attach a screen shot of the program…
The number you highlighted there is the amount of program memory you are using, NOT the amount of SRAM you are using. Screen shots are a lousy way to show code, but those float arrays seem to be quite large, and will not fit in the amount of SRAM that you have.
Of course, since the data is never going to change, you could use PROGMEM to store the data, rather than SRAM. Not too difficult, but not quite as easy as accessing the data in SRAM.
Is there symmetry in the table you can use to fold it and make it smaller?
Or are some servo's just phase shifted version of others?
If so you can do with less tables (and a small shift formula)
- I expect this is the case too
Or can you find a formula for the movements as a function of f(time)?
Find a function of time to describe the mouvement are too difficult !! ( we tried !)
But we probably find a solution…
Firstly we write a program on matlab to extract the minimum and maximum of each increasing and decreasing phase of each columns…this operation reduce the size of the matrix from 2000 values to 10 or 15 values !!!
So it’s right that we lost a big part of the information but when we load the totality of the value, the servomotors describes a very very jerk movement.
Secondly we don’t load every values for every servomotors…we load the values of each movement ( stand up phase / walk phase / rotation phase ) in 18 matrix of 10 to 20 values ( 300 < values < 400 to control the 18 servomotors ) and we programm each servomotors with loop…
Actually we extract the good data…
We think that is a good idea to program our hexapod spider…But maybe you have others idea ?
thanks a lot for your help !