LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error messages


@labview99 wrote:

So I have to get a new state to check if it has reached correct position 3 too?

 

Best regards


No, you do not have to get a new state. You have to reuse your old state. That's the purpose of a state machine. I assume that you still have not drawn your state chart as GerdW suggested on the second page of this thread. If you have then can you share what you have done? I do not believe that you are understanding the concept of a state machine. Your state machine would have a state called Go to Position with an input of Position, for instance. Only one state for all positions. In your Next Position state you might have code which checks to see if it is the last position. If not it gets next position and the next state is Go to Position. Please do write your states out by hand and share.  

Message 41 of 143
(1,497 Views)

IMG_9544.JPG

0 Kudos
Message 42 of 143
(1,480 Views)

Now imagine taking those 3 loop backs and making it one.

 

If arrive = Yes, increment a counter.  It would have started out as 1 and given you the first position and first velocity.

Now when you increment, it gives you a  2 and will give you the 2nd position and velocity.

Then loop back to the Move to position step.

 

If after incrementing, the counter is greater than 3, move to the end of your program rather than back to the Move to Position state.

 

Stop thinking of position 1, 2 and 3,  Just think of it has a position you get out of an array of positions and you keep track of where you are in the array based on a counter in a shift register!

Message 43 of 143
(1,475 Views)

I'm not where I can draw this out right now, but here is what I see as the states you need to accomplish what you're talking about (with any number of positions).

 

1. Get position

2. Go to position

3. Arrive?

          Yes => 4

           No => 2

4. Last position?

         Yes => 5

           No => 1

5. END

 

There are likely more states (Wait for user input, for example), but this should get you started. There may also be variations. For instance, the Arrive? state might be called repeatedly until a timeout occurs (be sure to put a wait timer in there).

Message 44 of 143
(1,474 Views)

Thank you, I will do it with a counter. But, know how can I do if, arrive?=No, how can I do it to make the clinder mpve again to the posiiton a want?

0 Kudos
Message 45 of 143
(1,457 Views)

I put all the positions in one array? And I take first the position of the first position of the array, then the second position of the second position of the array.....

 

Best regards

0 Kudos
Message 46 of 143
(1,461 Views)

@labview99 wrote:

Thank you, I will do it with a counter. But, know how can I do if, arrive?=No, how can I do it to make the clinder mpve again to the posiiton a want?


You've already flowcharted how you will decide if you arrive? or not.  You'll do the same thing.  Go back to a Move to Position, but with the same position from the counter.  You only increment the counter if  you need to move on to the next position.

 


@labview99 wrote:I put all the positions in one array? And I take first the position of the first position of the array, then the second position of the second position of the array.....

Yes.!

 

I have to ask, have you ever done any programing in any language before you started working with LabVIEW?

 

0 Kudos
Message 47 of 143
(1,454 Views)

Hi, 

counter.PNG

I do it like this?

0 Kudos
Message 48 of 143
(1,430 Views)

😫

 

I feel like when you start to learn something new, you forget what you've been told in the past.

 

I said the counter should be on a shift register.  (how does the next iteration of the loop know that you increased it by one before?)

 

And why have you broken your state machine aspect by not wiring the enum through shift register that is unused?

 

Please answer these questions.

1.  Have you had any experience in programming before you started working with LabVIEW?

2.  Have you done any of those online tutorials for LabVIEW that have pointed out to you dozens of times before?

3.  Have you considered attending an NI-sponsored LabVIEW training session where you learn LabVIEW in person from certified instructors?

0 Kudos
Message 49 of 143
(1,426 Views)

@labview99 wrote:

Hi, 

counter.PNG

I do it like this?


Well, even aside from the things already pointed out by RavensFan probably not. Of course we can't see what's going on in that subvi, but I'm assuming that you're still using that same one that you were using before. You need to forget about that subvi and either break it up into other subvis or move the code into the main vi. Have you gone through the previously suggested training? You appear to be making the same mistakes over and over.

0 Kudos
Message 50 of 143
(1,418 Views)