07-17-2013 06:36 AM
I have an application theory I would like to get some input on.
Take an application like a Servo Engine.vi, it controls communication with the servo and dequeues any servo commands from the main.vi to control the servo.
Now my question is if you have multiple servos:
- Is it best to only have 1 engine running and pass the Axis number through the queue?
- Is it best to run the engines reentrant, so each one handles each servo?
I have done this both ways in the past I really don’t know which way is better.
Thanks, Doug
07-17-2013 07:40 AM
@nonecure wrote:
Now my question is if you have multiple servos:
- Is it best to only have 1 engine running and pass the Axis number through the queue?
- Is it best to run the engines reentrant, so each one handles each servo?
Having 1 engine for controlling multiple servo, it sounds simple
-> probably array of custom data-type can be used
-> Servo engine could be an action engine.
Now the only issue I see here, slight latency is expected while controlling multiple servo drives.
Now moving to, have reentrant engine (multiple clones running, dedicated to each servo), it requires somewhat more coding and is slightly complex
-> mechanism to address & communicate with the right clone (corresponding to a particular servo drive) needs to be implemented and that is an overhead
but on the other hand independent engine clones will have negligible latency.
Lets wait and listen from some of the experts available on board...
07-17-2013 08:31 AM
Both options I store the feedback data in an array, so servo #2 is index #2.
Both options I also use a “Servo Request.vi” that the main.vi uses to send queued commands, or retrieve the feedback via a global or AE. Before the global police get on my case, the servo engine is the only vi to write to the global. So the servo request.vi takes the burden off of the main code and I can switch between 1 servo engine or multiple without affecting anything.
For my current application latency is not a problem, but that is one up for the reentrant engine. Future projects will be less likely to have any latency issues.