Matt is making a drawing machine. A robot which will live on a wall and plot out paths which are an algorithmic solution to the artistic seeds that Matt feeds it. I’m helping Matt, but we’re stuck with a bit of the maths.
Due to artistic and practical constraints, this is how the robot will work: there will be two motors, top left and top right, from which a ‘pen’ is suspended. Our problem is about how to change the length of the chains from which the pen is suspended to draw a straight line between two points. I’ve done a diagram to make this easier to explain. The crudely drawn black circles are the two motors. There is a small blue circle (a start point), and the two chains in green (with lengths l1 and r1 respectively. The target endpoint is show as a red cross, with the chains shown in purple (with lengths l2 and r2 respectively (obviously there are only ever two chains, one right and one left, not four).
Calculating the length of the chains at the start and the end is fairly trivial. The problem is at what rate to turn the motors to lengthen or draw in the chains to get between the start and the end points drawing a straight line. For artistic reasons it is absolutely essential that the line drawn between two points is straight.
I had a go at solving this. You can have a look at this python code (incidentally, my first ever python script!). The problem is, my solution makes curved lines, like this (points along the path shown as blue dots)
The chains need to be tightened by some amount during travel to stop a curve being described, but I know enough maths to know that I don’t have a hope of solving this one. Can you help?