First of all, I just want to say that I have a very limited knowledge within robotics, but it’s an area I’m interested in and really want to learn more about. To improve my knowledge, I’m currently working on a project where I want to build an automated Zen garden, similar to this: https://ksr-ugc.imgix.net/assets/028/286/456/8eea7e0ba2d5e8d2ae55322f102dd5e8_original.gif?ixlib=rb-2.1.0&w=680&fit=max&v=1583133449&auto=format&gif-q=50&q=92&s=278c4fdf4223add71f0042f7a336fc68
The idea is to build a SCARA robot using two arms. At the end of the second arm, I’ll attach a magnet that will move the metal ball in the above gif.
The idea is to sample (x, y) coordinates from a polar equation that draw some kind of pattern (e.g. https://www.wolframalpha.com/input/?i=3+%2B+7*sin%283*theta%29%2C+polar). When I have the list of (x, y) coordinates, I’ll iterate over the (x, y) coordinates and use inverse kinematics to compute the angles of the first and second arm, to end up at the (x, y) coordinates. Then I translate that into steps of two stepper motors controling the two arms.
So far I’ve implemented it in a simulation, where I use Matplotlib animations to plot the trajectory of the arms. I’ve been able to get the end-point of the second arm to end up at the correct (x, y) coordinates, BUT I have a problem.
Every time the y-coordinate shift from being negative to positive or positive to negative (i.e. pass the x-axis), the first arm flips 180 degrees. See this gif for an example of the simulation: https://i.imgur.com/jYz88hY.gif
I have really tried analyse the math and think of a way to fix it, but haven’t come up with a solution. Can someone that has experience implementing inverse kinematics for SCARA robots using trigonometry point me in a direction of how I can fix this?
Here are the equations I’m currently using: https://i.ytimg.com/vi/IKOGwoJ2HLk/maxresdefault.jpg