I’m developing a targeting system where when movement is detected, servos target a laser pointer to the area of movement. I have a servo for the X axis (pan) and another for the Y axis (tilt). I need to find a formula that when presented with X and y co-ordinates on the screen will generate the corresponding pan and tilt values for the servos.
In attached image I have 2 points on the screen, their co-ordinates and the corresponding servo
values. [X = 42, Y = 146; corresponding servo values are Pan = 35, Tilt = 335] & [X = 542, Y = 307; corresponding servo values are Pan = 276, Tilt = 358]
.
What equation can I use to calculate servo values (pan and tilt) when presented with any other X and Y coordinates?
I tried using slope [M=(Y2-Y1)/(X2-X1)]
with the 2 X pixel values to get to the Pan value with no luck
Thanks a mill