NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Goto other thread

Solved!
Go to solution

Hi, this is my first NI post so if i get something wrong please don't flame me Smiley Wink

 

In teststand i have my mainsequence running along side another thread (the other thread is being used to look for keyboard entry)
If I push escape on my keyboard i want to use the goto command to take me to the cleanup section in the mainsequence therefore ending the test and running cleanup.

The closest i have managed to get is teststand bringing up an error telling me that the step i am trying to move to is not in the current sequence.

Here is the code:

 

While                    Locals.TestRunning
Get Input              (labview get keyboard input)
If                          Locals.keyPressed == 62

Goto     <- i want this to say goto mainsequence thread to whatever point i want (cleanup in this case)

End

End

 

Any solution or other way of doing this will be much appreciated Robot Happy

0 Kudos
Message 1 of 10
(4,477 Views)

 


@NIcurious wrote:

[...]please don't flame me [...]


I hope that you see from reading other threads that "flaming" is something rare in this forum. So if you are professional in your questions/statements, you will usually receive professional answers.

 

Reading your question let me think of two different solutions for your request:

a) Every step of your first checks if Escape is pressed. Since this is a very "random moment in time" you will have to create a module storing this information which is "asked". The module has to run separatly (hence another thread, yes).

b) If you are using a custom written user interface, your UI could handle this. Either you keep the info there for the modules (which are called in the TS sequence) or you terminate the sequence' execution by using "Terminate Execution" from the TS API. This approach needs some knowledge in TS API usage which is for example part of the TestStand II course provided by NI.

 

hope this helps,

Norbert

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(4,472 Views)

With solution A,  yes it is already in another thread running, my problem with it being in another thread is I can't use the GoTo function to move back to the mainsequence to a specific point (e.g. cleanup).

Solution B, no it is not part of a UI

0 Kudos
Message 3 of 10
(4,436 Views)

Well, what i was up about in case a) is that this "watchdog" (or whatever you want to call it) will store the info in a threadsave element which is read by each module in the main sequence. So each module can decide wether it should proceed or call a "go to functionality".....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 10
(4,427 Views)

I think i know what you are saying but this would mean putting lots more if statements and goto commands all through my mainsequence?
I was trying to avoid this because it will make the code 2-3x longer and it is already pretty long

0 Kudos
Message 5 of 10
(4,424 Views)

Nah, it does not really make the code more complex. You can simply leave the code module in this case passing a boolean to TestStand. In your step, you evaluate this value in a custom condition as a Post Action. If this condition fails (or meets it, however you define it) you will either choose to "GoTo" a certain step/sequence or simply terminate the execution.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 10
(4,419 Views)

Ok yes I see what you are saying, this the only way you know to do it? I have 50+ sequences that I want to implement the button thread for, and to have to go through every action of every sequence to do this is very long winded, I can do this if its the only way but I was looking to just drop the thread into each of them and be able to achieve this

0 Kudos
Message 7 of 10
(4,417 Views)

Any chance i can pass in a parameter like in C or something which will return a boolean which when returned can do a check, if true then call a Goto with the mainsequence not losing its place in the thread unless true?

 

Or even terminate the mainsequence from the button thread?

0 Kudos
Message 8 of 10
(4,412 Views)
Solution
Accepted by topic author NIcurious

You can pass the sequence context to this "watchdog" when starting the execution and then call Terminate Execution. This is not really the nicest solution, but maybe the best one without the need for rework those sequences and code modules....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 9 of 10
(4,407 Views)

Yeh this is what I have done thanks for your help, I just put a forced fail statement in the button thread with the post action of terminating the sequence if the button is pushed.
It works fine, i just move my data collection to the start of the cleanup since as this is still called when the sequence it terminated.

Thanks a lot for your help Smiley Very Happy

0 Kudos
Message 10 of 10
(4,388 Views)