Hi
I am in the process of adding some Raspberry PI controlled automation. The automation is a python program running on the RP and uses the pyserial interface from the RP to the Nybble_v0.2. I have observed Nybble performing a 'jerky' erratic motion at the end of a "Instinct" movement. The file attached is a video of the following motions (with a three second fixed gap between each motion):
Balance
Stretch
Balance
Pee
Balance
Sit
Hi
Meow
Sit
Rest
The video displays two types of irregularities:
- At the end of most "Instinct" movements there is a significant jerky movement of the servos. From using an oscilloscope I have confirmed the servos are being instructed to move to a new setting (a change in the duty cycle) after the instinct appears to be finished.
- Steps 7 does not complete and step 9 appears to be ignored all together.
I am looking to see if anyone else is observing these jerky motions at the end of an instinct movement and any clues as to why these may be occurring.
Best regards
D L
Hi Li, thanks for your answer. I have a question regarding the part of the code if you can please explain. You said that the adjustment is reduced by applying a smaller coefficient > can I remove this coefficient to get a quicker response? (if yes how - is this the one LARGE_PITCH?) - is it wise to remove coefficient?
What is meant with this "hold" variable?
Yes, the adjustment is reduced by appling a smaller coefficient, which is defined in the OpenCat.h.
You can print out the angles in the motion section of Nybble.ino. The angles are
calibratedPWM(jointIdx, motion.dutyAngles[dutyIdx]
calibratedPWM(jointIdx, motion.dutyAngles[dutyIdx] #ifdef GYRO + adjust(jointIdx) #endif );
motion.dutyAngles are static joint angles, and adjust() calculates the angle adjustment.
Hi the balance during the walk is not that strong as with "balance" mode. I somehow see only head and tail move to different sides as I try to unbalance the kitty but not feet movement - feet keep going :). If I place it on the elevated surface under the angle it will not show as good balance as with the balance mode as well.
Is there any way that I can plot joint angles to serial in order to avoid optical error.
If I can plot them out and then observer them during the local walk, the angles should be always the same. If I change the angle, angles should change as well.
Is kitty trying to balance during the walk as well or just during the balance command? Somehow I don't see that kitty is trying to balance during the walk, crouch or run.
Hi Rongzhong,
I am doing a test and have commented out the #define GYRO in OpenCat.h, disabling the use of the MPU6050.
So far all abnormal jerking is gone, include quite aggressive movements in some Postures. In many ways this is a superior execution for the movements I need Nybble to be able to complete (I won't be asking the robot to walk up stairs of any significant incline movements in the short term).
Two questions.
- Now that the MPU is disabled, the walking, trot and crawl gaits are quite fast. Is there a location to define these to slow down.
- Is there any plan to re-write the GYRO routines to address the post transform movement jerkiness.
Overall I like your work. Well done. I do recommend though, as a general comment, if you are considering a faster CPU, then a re-write/clean-up of the code is possibly in order, especially to remove compiler directives intermixed within the code lines. These, and the use of interrupt processing mixed in with the general procedural nature in the code, makes the code difficult to read and troubleshoot.
Once again, well done so far. I hope the project succeeds to your best wishes.
Best regards
D L
If it's commented out, Nybble won't adjust to body rotation or keep balance. If all the joints are calculated in one loop, it will be slower than the sampling rate of MPU6050, resulting FIFO overflow.
Hi Rongzhong,
Thanks for that. Is this the code in Nybble.ino lines 725-741 that implements the +m in B => B + m.
if (jointIdx < firstMotionJoint && motion.period > 1) { calibratedPWM(jointIdx, (jointIdx != 1 ? offsetLR : 0) //look left or right + 10 * sin(timer * (jointIdx + 2) * M_PI / motion.period) //look around # ifdef GYRO + (checkGyro ? adjust(jointIdx) : 0)# endif ); } else if (jointIdx >= firstMotionJoint) { int dutyIdx = timer * WALKING_DOF + jointIdx - firstMotionJoint; calibratedPWM(jointIdx, motion.dutyAngles[dutyIdx] # ifdef GYRO + adjust(jointIdx)# endif ); }
jointIdx++;
If it is, what happens if the line in red is removed? Could it be replaced with a series of steps calling calibratedPWM() in a loop?
Best regards
D L
The jerky movement comes from the imperfection of algorithm:
When Nybble is holding an instinct posture, it will load the angle array (A) plus the MPU rotation adjustment (m) to keep balance. While during the transition between posture A and B, it uses only the interpolation between A and B.
So the jerky movements happens at the end of transition:
A + m => interpolation(A , B) => B => B + m.
I updated the code of "Hi" in July. The previous version only lifts its paw without waving. And The following two Meows is the result of your command 8.