Hi here I am again to have some clarifications on the software, I would like to customize the cat with new movements but first I would like to understand some lines of the program that I am not clear the first is “const char crR [] PROGMEM = {26, 0, - 5 ,
35, 37, - 48, - 53, - 23, - 28, 1, 12,
40, 34, - 47, - 59, - 24, - 27, 1, 12,
45, 31, - 46, .......... "
the first three numbers what they indicate, the first is the number of lines (or frames) that make up the movement but I don't know about the other two,
the second I would like to know the difference between these two lines:
"Const char crR [] PROGMEM = {
26, 0, - 5,
35, 37, - 48, - 53, - 23, - 28, 1, 12,
40, 34, - 47, - 59, - 24, - 27, 1, 12,
45, 31, - 46, ......... "
"Const char balance [] PROGMEM = {
1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 30, 30, - 30, - 30, 30, 30, - 30, - 30,};
because the first is composed of 8 characters for each line while the second is composed of 16, I hope I was clear.
thanks for your patience
Giuseppe
The previous demos have larger amplitude of head/tail movements which is unnatural. In this one I reduced the amplitude and did some finer tuning on calibration and other parameters. Adding background music also helps to your subjective impression of the pace.
#defines batt A0
Pin A0 is used to measure the voltage of battery. It's not in the released code but will be in effect to detect overcurrent and give the cat a break after a sprint.
hi, congratulations 🙀 I saw the new video of the change of the head-tail movement is now more natural, you could tell us the modification you made. I try to understand how the opencat.h software works and I would like to know what this battery check is for "#defines batt A0".
Thank you for your patience and availability.
Giuseppe
Fantastic, thanks again and see you soon.
We await new developments with ultrasound sensor.
Giuseppe
Just add this line. Think how jointIdx (0,1,2) is used to set the period for head's motion.
Demo:
BTW, your build of Nybble walks so well! Good job! I've added it to my DIY OpenCat playlist.
hi, thank you for your quick and comprehensive answer, if I understand correctly to move my head while walking it is enough to add the following lines in nybble.ino:
calibratedPWM (0, panAngle);
calibratedPWM (1, tiltAngle);
float panAngle = 40 * sin (timer * 2 * M_PI / motion.period);
calibratedPWM (0, panAngle);
float tiltAngle = 15 * sin (timer * 4 * M_PI / motion.period);
calibratedPWM (1, tiltAngle);
I would like to know where in the software to insert them.
Thanks again
Giuseppe
Sorry for delayed response. I was hoping to wrap up an example for rotating head collaborating with ultrasound sensor data. But it took longer than I expected, while the core code will be too difficult to follow. So below is the simplest explanation for moving the head.
If you look at the main code of Nybble.ino, the last section is a motion block. It uses
timer as frame counter and jointIdx as the iterator of joints. For a static posture, its motion.period is 1, and jointIdx loops from 0 to 15. For a gait, its motion.period is larger than 1, and jointIdx loops from 8 to 15, skipping the head and shoulder roll joints with if...else statements . You just need to add the head joints back in front of the loop.
with head pan and tilt indexed as 0 and 1, you can use
calibratedPWM(0, panAngle); calibratedPWM(1, tiltAngle);
panAngle/tiltAngle can be generated by any function of timer and motion.period. The simplest is circle or sin functions.
float panAngle = amplitude1 * sin(timer * w1 * M_PI / motion.period); calibratedPWM(0, panAngle); float tiltAngle = amplitude2 * sin(timer * w2 * M_PI / motion.period); calibratedPWM(1, tiltAngle);
where amplitude is the max angle you want to reach, and w tunes how many circles you want the head to move in one walking period.
For example,
float panAngle = 40 * sin(timer * 2 * M_PI / motion.period); calibratedPWM(0, panAngle); float tiltAngle = 15 * sin(timer * 4 * M_PI / motion.period); calibratedPWM(1, tiltAngle);
Will make the head node twice while look around once, during one walking cycle.
hi, I do not give up, you have been clear but unfortunately I am poorly prepared you would help me with a practical example where and how to insert these lines I would very much like to be able to move the head and the tail together with the movements and alone, sorry if I take advantage of your kindness and desirability but I'm fascinated by this project.
Thank you
Giuseppe
hi, thank you for the quick reply but being a beginner it is not clear to me where and how to insert these lines, thanks again for the kind availability.
This is what has been done by me thanks to your help, I published on youtube "catrobogeppo1, catrobogeppo2 and catrobogeppo3".
Congratulations on a nice job.
Giuseppe
You can do it by calculating the angles in real time. For example, if the gait has 26 frames, you could calculate the angle of head as
float angle = amplitude * sin(M_PI * 2 * t / 26);
where amplitude is the max angle you want to reach, and t is the loop counter.
Then you can send the angle to function
void calibratedPWM(byte i, float angle)
calibratedPWM(0, angle) will make joint 0 (head pan) to rotate to angle in each looping step.
Hi, but then just moving the head and the tail continued is not possible?
I'm sorry but I can't understand how to do it, thanks and I'm sorry.
Giuseppe
OpenCat takes body orientation for balancing. For some skills, the default orientation is not level. For example, when crawling, the head is lower than the tail. The two numbers {0,-5} after the frame count 26 are default {roll, pitch} angles for that skill.
crR[] has 26 frames and is a gait. On Nybble there're only 8 joints for walking, so each frame stores 8 numbers to save memory space.
balance[] has 1 frame and is a static posture. It's saving all 16 joints considering compatibility with the full version cat. Since it only has 1 frame, it won't waste too much on memory.