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

Get Angle #73

Closed
arnaudbore opened this issue Mar 2, 2023 · 3 comments
Closed

Get Angle #73

arnaudbore opened this issue Mar 2, 2023 · 3 comments

Comments

@arnaudbore
Copy link

Hi,

I would like to know if there is a way to query the current position (angle) of a servo. I can see there is a setter and a property but no getter. Is there another way to get this information ?

Thank you in advance
Arnaud

@caternuson
Copy link
Contributor

The property is the getter, ex:

print(servo.angle)

However, it is not the actual true current position of the servo. It is just the currently commanded position. Unless you are using a special feedback servo, like this:
https://www.adafruit.com/product/1449
there is no way to get actual current position.

@scprotz
Copy link

scprotz commented Mar 2, 2023

Depending on the servo, a trick I have used in the past was to just 'move' the servo but don't give it any time to actually perform the move. At that point the value for the angle has been set and you can read it.

I think you might be able to do something like:

servo.angle = 90
current_angle = servo.angle
servo.angle = current_angle

Been a bit since I've tried something like that, but it was a nifty workaround.

@caternuson
Copy link
Contributor

Closing since this does not appear to be a library issue. It's more like an info request or a how-to. If there is an actual issue with the library, please provide more information on the issue and example code that can be used to demonstrate the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants