I have found it useful and interesting to create tools that help me better understand and think about the OpenCat framework. I'd like to use this post to share those tools. Below is the first one - I will add other tools here in future updates.
Excel transform() visualizer
The transform() function (in OpenCat.h) is used to transition from a set of current joint angles to a set of target joint angles. The function calculates the number of intermediate steps (small angle changes) to use in the transition, based on the parameter speedRatio. The function then does a transformation using cosines. The Excel transform() visualizer plots this transformation and demonstrates how use of cosines gives an initial acceleration from a current angle, then a pseudo-linear range of angles and finally a deceleration to the target angle. Here is an plot of step vs. dutyAngle for current angle = 0 deg, target angle = +45 deg and speedRatio = 1 (45 steps).
This poses the question of what other transform functions we might try that give different effects (faster movement, more cat-like movement, more robotic movement,something else?), especially as we string transforms together in behaviors. What are your thoughts and what would you like to try?
I also was inspired by the transform() function, and like Len, replaced it with a linear interpolation for its simplicity and speed. My focus has been on software rather than hardware. My Nybble can now walk at 5 complete cycles per second, but loses contact with the floor at 2-3 cycles per sec. I.E. it slips. I suspect I need adaptive feedback. Sensors on the feet and software to adapt the motion are probably needed.
As for stringing motions together, I always remember the last position of each joint . Since I also use the Translate() - like motion, when a new instinct is invoked,, the software linearly interpolates from whatever the previous angle was, to the first angle of the new instinct. For me, there are typically 4 to 50 interpolated steps between each line of the instinct. (Walk has 42 lines, for example). So, it can be quite smooth.
Nice work!
As the performance limitation of ATMega328P we have to use linear interpolation to calculate the key control points for 4 legs.
We are working on more complex motion algoritm with better hardware to make our cat walking more fluently.