From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Maxon motor mulitple point inputs

Hi,

I am trying to adapt some LabView code so that I can input multiple points and let it follow that path continuously, but I'm running into the problem that either I have to delay the inputs by several seconds or the motors will receive new inputs before they finish moving. I tried to do this with a stacked sequence and just duplicating the frames, but the error outputs wouldn't wired together. Currently I just have a while loop that iterates through a 5x5 array for the 5 motor inputs after a couple seconds. 

I would appreciate either a way to force it to wait until the motors stop or a cleaner way of inputing the position data. 

Best,

Alicia

Download All
0 Kudos
Message 1 of 2
(2,441 Views)

Holy canole, you need some subVIs up in there. Your code should not span across more than 1 montior. 

 

Also, code like this is redundant.. these are all the same data, just wire them together. You can also drag down on an Index Array node to index at more indices.

SameIndex.PNG

 

The best way to do what you're trying to do is to be able to read in the positional status of your motors and act accordingly once they arrive at their desired destinations. Can you read in the current positional info? If you can't use feedback information, you will have to just add a large enough wait to account for the movement.

 

I would suggest you look in to a State Machine architecture. A state machine could give you a scaleable way of setting your motor states.

The Simple State Machine template that ships with LabVIEW is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.

Here's a broad example of how a state machine works:

  • States: Init, Idle, Exit, DoThing1, DoThing2, DoThing3
  • Each state contains code that might take some time. Ideally, not too long because that's how long your code could be unresponsive.
  • The Idle state contains an event structure for all user interaction.
  • The front panel has a button that says "Do Thing 1".
  1. Loop Iteration 0: Application begins, first state is Init. The Init state does some initialization stuff and tells the application to go to the Idle state when finished.
  2. Loop Iteration 1: Application goes to Idle state. It sits there, waiting at the event structure.
  3. Time goes by, then user presses button "Do Thing 1". There is no code, or minimal code, within this event case. The output of this event state tells the application to go to the DoThing1 state.
  4. Loop Iteration 3: Application goes to DoThing1 state. There is code here that does some stuff. The output of DoThing1 state tells the application to go back to the Idle state.
  5. Loop Iteration 4: Application goes to Idle state where it waits at the event structure again.
  • Each of the states can tell the application to go to any state they want. Want to reinitialize? Go to the Init state again. Want to end the program? Go to the Exit state. Want each state to trigger another (like a sequence)? Have DoThing1 output DoThing2, which outputs DoThing3,  which outputs Idle.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 2
(2,389 Views)