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

How to pass a function f(t) as position control for the motor? #51

Open
DiegoBArruda opened this issue Dec 7, 2024 · 1 comment
Open

Comments

@DiegoBArruda
Copy link

Hello everyone!

I use the library to control a servo motor (jmc ihsv57) for a space telecommunications groundstation project.

I have an orbit propagator that gives me the angular position (azimuth and elevation, understood as rotation in the plane and elevation in relation to the horizon/plane) of the satellite in relation to the space station at each time, the delta t between each position data is defined by me.

In short, I have a list that, given time t, has the angular position that each motor should be in.

The connection between the motor and the station has a large reduction ratio, since the motor is relatively fast (3000RPM) and we need, at most, something around 0.1rpm, however the necessary torque is much highe. This angular position of groundstation and motor was mapped through the configuration.

Currently, I send a certain angular position, say 10º, and I have to wait for it to get there to send the next position. However, I would like to keep sending the position that I have in the table as a function of time and the servo will "update" this position.
What is the problem with the current approach? It accelerates, reaches v max, slow down and reaches the position, then receives new data, accelerates again etc. If I could keep sending a new position before it reaches the last one, it will not slow down (unless my delta t is long).

How can I do this? Keep sending new position and the lib or servo update target position before reach the previous position.

If anyone wants to test this, generate a sinusoidal signal that represents its position in time, make the servo follow exactly this sine in its "position".

@pkerspe
Copy link
Owner

pkerspe commented Dec 7, 2024

I feel you describe a very specific use case and this library has a more generic scope in general.
I got a feeling that you need to put a bit more logic into your core program other than trying to use a library that might now be an exact fit.
Only thing I can think of is maybe that you should try the jogging function and count pulses yourself to keep track of the position rather than constantly setting a new position. But to be honest I could not completely follow your approach, so maybe the jogging function might not be the right path.
You can of course constantly set a new target position in the library (make sure not to use the blocking functions, but run it as a service!) and it will keep running, but keep in mind that the speed my not be constant if you set the new position to late and the library already goes into the deceleration phase.

In general I feel this is not an "issue" with the library itself, but more of a question for a very specific scenario this library might not be able to answer out of the box.
Thus I would like to close this "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

2 participants