Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread-safe motion program
#1
Hi,

Is there a way to make a motion program thread-safe so that it can be called multiple times simultaneously from gpascii? I want to create a generic program that moves an arbitrary motor to a specified position. I want to be able to pass in the motor number, possibly using a P variable. I can easily use blocks of P variables assigned to each motor number to pass in other information (position, rate, etc), but I don't see a clean way to pass in the motor number while still maintaining thread safety (I don't want a second program invocation to step on the motor number used by the current runnning program).

The only solution I can think of is to have a separate motion program for each motor.

Thanks,

Erik
Reply
#2
Erik,

If you use CSGlobal variables (equivalent of Turbo PMAC Q variables) instead of Global variables (Equivalent of Turbo P Variables), as long as your instances of execution are in separate coordinate systems, your motion program would be thread-safe.

You can also use sub-programs and pass the motor number and parameters as arguments to it where they will be accessible inside the sub-program as local variables and each instance will have its own set and there won't be any cross-talk.

Regards,
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
Reply
#3
(01-31-2011, 10:06 AM)Sina Wrote: Erik,

If you use CSGlobal variables (equivalent of Turbo PMAC Q variables) instead of Global variables (Equivalent of Turbo P Variables), as long as your instances of execution are in separate coordinate systems, your motion program would be thread-safe.

You can also use sub-programs and pass the motor number and parameters as arguments to it where they will be accessible inside the sub-program as local variables and each instance will have its own set and there won't be any cross-talk.

Regards,

Hi Sina,

A belated thanks for this advice. I have done what you suggested and have a generic move program working. I only have one motor connected now, but we plan on testing with multiple motors soon.

regards,

Erik
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)