We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to use processing to communicate in real time with an arduino which is driving a 3d printer via serial communication. The problem I am having is that some calculations I am doing in processing are giving me the wrong answer. The below code is a simple calculation of the inverse kinematic solution of a 3PUU delta robot. I give it the cartesian coordinates (x, y, and z) and it is supposed to give me L1, L2, and L3 (the height of each carriage on the printer) in order to achieve that position. The L1 it is giving me is correct, but the L2 and L3 are off by 6-7mm which is huge for this application. I thought it might have been a problem with my code, but I used the same formulas in matlab and the answer was correct far past 4 decimal places. Are any of the functions that I am using causing loss of precision or rounding errors maybe? Possibly the sqrt() function or pow(bla, bla) function? Can anyone tell me why my answers are incorrect with this code?
If anyone is curious about the source of the formulas it is here: http://www.ohio.edu/people/williar4/html/pdf/DeltaKin.pdf pages 27 and 28
//variables (lengths, etc) (mm)
//input coordinates (desired position)
//both solutions for each length (elbow up, and elbow down)
println("actual answer: 241");