It was a long long time ago. I don’t remember how I found it.
I do remember being frustrated by the endless papers on SCARA and the importance of the inverse kinematics but no mention of what they actually were. So here they are. (I just checked now, and there seem to be at least a few papers online with the derivation. Times have changed)
I also have this:
def do(self, (x, y), (dx, dy)):
""" Calculate o derivative (do1, do2) given position (x, y) and desired movement derivative (dx, dy)
"""
xy2 = x**2 + y**2
ll2 = self.L1**2 + self.L2**2
lld2 = self.L1**2 - self.L2**2
# do1
N = x*dy - y*dx
M = xy2
P1 = x**4 + 2 * x**2 * (y**2 - ll2) + y**4
P2 = -2 * ll2 * y**2 + lld2**2
P = P1 + P2
Q = xy2
PQ = math.sqrt(-P/Q)
R = (xy2 - lld2) * (x*dx + y*dy)
S1 = math.sqrt(xy2)
S2 = P
S = S1*S2
# do2
T = 2 * (x * dx + y * dy)
U1 = (2*self.L1*self.L2)**2 - (x**2 + y**2 - ll2)**2
U = math.sqrt(U1)
return -(PQ*R)/S + N/M, -T/U
For this I used a symbolic solver but I don’t remember what it was. I also don’t remember if it was a meaningful improvement over a simple interpolation between angles.
BTW if memory serves, parsing basic SVG is pretty easy. Though, these days it may be more useful to implement a gcode parser as there are so many freely available gcode generation tools.
I am currently doing something similar for an off-the-shelf drawing robot with two arms, each with a shoulder and an elbow joint - load svg, convert layers to numpy arrays, then get the angle configuration for each point and save them to a format the robot can read and draw. However, I am finding that the time required to compute the points is quite long.
The fastest way I have right now is a large look-up table (ie. precompute angles for each point of a canvas with a sufficient precision, then use the table to do fast searches for the nearest point).
ipv6ipv4|1 year ago
I do remember being frustrated by the endless papers on SCARA and the importance of the inverse kinematics but no mention of what they actually were. So here they are. (I just checked now, and there seem to be at least a few papers online with the derivation. Times have changed)
I also have this:
For this I used a symbolic solver but I don’t remember what it was. I also don’t remember if it was a meaningful improvement over a simple interpolation between angles.BTW if memory serves, parsing basic SVG is pretty easy. Though, these days it may be more useful to implement a gcode parser as there are so many freely available gcode generation tools.
imp0cat|1 year ago
The fastest way I have right now is a large look-up table (ie. precompute angles for each point of a canvas with a sufficient precision, then use the table to do fast searches for the nearest point).