Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Servo class: servo.write(int angle, float rotationspeed) #71

Open
dsyleixa opened this issue Jan 24, 2021 · 3 comments
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@dsyleixa
Copy link

dsyleixa commented Jan 24, 2021

feature request: Servo class: servo.write(int angle, float rotationspeed)

  • angle: degrees (endpoint)
  • rotationspeed: degrees per second

e.g.,

servo.write(90); // let the servo move to position 90° immediately
delay(1000);
servo.write(180, 10.0); // moves the servo from the current position (90°) to position 180° by a rotation speed of 10°/sec

The function must not be blocking, so that a following command can be started immediately before the further movement has been finished (simultaneous movement)

servo1.write(180, 10.0);
servo2.write(45, 5.0);
@macMikey
Copy link

macMikey commented May 4, 2024

Dumb question: I don't think we can know the position of a normal servo.
If all we can do is command the servo to move to a position, how would we control the speed?

@dclause
Copy link

dclause commented May 4, 2024

The speed is usually controlled by manually setting the change in position at a given pace.
For instance if you require positions 1°, 2°, 3°,...90° every say 100ms, you would then do a 90° move at a speed of 9sec/90°. By opposition of requiring 90° directly, the move being done at an unknown speed, depending on the servo capacity, speed, force, the power applied couple to move, etc...

@macMikey
Copy link

macMikey commented May 4, 2024

i understand what is being requested, and i love this idea. it's unclear to me how it can be done. at least at startup.
the normal servo does not have a read pin, so the arduino cannot know the servo's position, or the rate at which it is moving (or the rate at which it can move). arduino can command a move to a position, but that's it.
servo.read() only returns the last position that the servo was commanded to move to, not where it is (because the hobby servo can't share that information). at startup, for instance, that value would be undefined.
once a homing or first move has achieved, though, things are much simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants