I was wondering if it was possible to emulate a linear movement with a rotating servo going from left to right through programming. It is better explained with this picture:
The problem is basically to control the angle of the servo's arm so that the speed of the blue dot across the x axis remains constant in time.
This sounds like a nice trigonomical problem but it's been a while since I have studied this and I am new to programming so an help is appreciated!
The speed of the angle is more problematic, since there is no feedback on how fast the servo is moving--you have to assume the speed a particular servo moves.
What I need is that is moves more quickly at the edges of the circle as it doesn't translate to much movement in the x axis and therefore, the speed of the servo would constantly be changing, slowing down at 90degrees and speeding up at 0 and 180 degrees. I don't know if this is easy to implement through programming or I should just go buy some linear servos
You need to start by knowing the length of the green arrow in your diagram, and calculate from that the angle theta, which you will use to control the servo.
sin(theta) = adjacent / hypotenuse
The "hypotenuse" is the radius of the circle in your diagram. It doesn't actually matter what that is, so let's assume that is 1.0 to make the maths easy.
The "adjacent" is the length of the green arrow. It can be between 0.0 and 1.0.
To calculate theta:
theta = asin(adjacent / hypotenuse)
Since hypotenuse is 1.0
theta = asin(adjacent)
This angle theta will be in radians. It needs to be converted to degrees to use with the Arduino servo library.
With a continuous rotation type servo, one won't know the angle, so won't be able to compute the corresponding speed.
It would only be possible with a normal servo, and there would still be limits based on the unknown max speed (omega) of the servo.
Thinking more on the limits -- at 0 and 180 degrees, the length of the green line is cos(theta) and the x-speed of the blue dot is omega*sin(theta) and approaches 0 at the limits. With a limited RPM of a servo there isn't a way to keep the blue dot at a constant speed as it approaches 0° & 180°.
It depends on what kind of fun you like to have. And the deployment scenario.
Without knowing more, like how you plan to use the servo arm to make something else move along a line, I'd guess you'd be further along faster with a linear actuator (servo).
What is the physical use case here? What speed, distance and power is required?