without polling, is there a way to know when a motor arrives at a position?

2 years 9 months ago #29535004 by andycavatorta
I'm writing an extensive Python wrapper for the whole Roboteq command set.  I'm looking for ways to know when a command completes.  For instance, when a PID process finishes moving a motor to a position in closed-loop mode.  The completion event must be explicit in the internal state of the controller.  Is there a way for an externally-connected computer to receive this event via RS232 or CAN?  I'm aware that the computer could poll the encoder feedback and infer completion when the position stops changing and is within an expected range.  But that is inefficient and prone to ambiguities.  Is there a message that can be sent from the controller to a connected computer upon completion of a task?

Please Log in or Create an account to join the conversation.

2 years 9 months ago #29535005 by george_f
Hello andycavatorta, it is not possible to achieve the desired result and be sure that the position is reached without polling.
You must have the encoder feedback to be sure that the movement has finished with the desired result.
The following user(s) said Thank You: andycavatorta

Please Log in or Create an account to join the conversation.

1 year 10 months ago - 1 year 10 months ago #29535426 by outbound6
I’m interested in the python code, did you have success? Would you mind sharing your code examples?

Please Log in or Create an account to join the conversation.

1 year 10 months ago #29535427 by andycavatorta
You can see the current state right here.  The code is in the Macros class that starts around line 1000.  

github.com/andycavatorta/thirtybirds3.0/...q_command_wrapper.py

This Python module wraps all of the commands relevant to the SDC**** series and adds a lot of control structure.  It turns the async communication into synchronous so requests return matching responses. And it makes communicating with multiple controllers clear and reliable.  

You will see a few bits that are specific to my applications and test cases.  Those will come out with a future refactor.  

I hope it's useful for you.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.103 seconds