NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

automated sequence editing

Hello,
We have an application where we'd like the user to be able to edit/tweak certain sequences.  They are button sequences which command a robot to push a button.  We'd like them to change the order, or drag from the templates into the sequence.
We want to automate opening the sequence contents and available step types for the whole set (about 30) button sequences.  My first inclination was to just use the operator interface editing capabilities, but when looping on the sequences one by one for edit, teststand would actually be executing, so my assumption is that you cannot edit a sequence while teststand is executing (can you?).
My next thought was to use the Teststand UI controls in a seperate pop up gui, which would display the contents of the current sequence for edit, and allow the user to drag templates and step types to the sequence, much the same way as in the dev environment.  So to experiment with this ability, I added an edit substep to the buttonSequence type, so I can right-click on the button sequence step type, and initially just try to display the sequence for editing.  I read about the UI controls in the Teststand Manual, about how you need to use ConnectSequenceView to the TestStand UI SequenceView Control, to get the sequence to display in the TestStand UI SequenceView Control. I am using the SequenceContext to get an engine reference, and the GetSequenceFileEx Method to get the reference to the sequence to edit.  I have attached a diagram. I am getting an error at probe5 for "invalid pointer".
I guess my question is, is my approach even feasible?  It seems like it should be, but I am apparently not going about it the right way.  Does anyone see anything glaringly wrong with this diagram?  I'd sure appreciate some input.
Thanks
0 Kudos
Message 1 of 8
(4,298 Views)
Hello,
Updated:
After much futzing around I managed to get the sequence file and insertion pallette to display, and can even drag step templates to the sequence!  This was easier (in hindsight) than I thought it would be.
 
My only other question is, when I start the application manager in the LV gui, it gives me a teststand login prompt.  This is confusing, since I am actually already logged into teststand when I initiate the edit substep. 
 
Is there any way to tell the application manager, which is launched in an edit substep GUI, the login credentials already used when starting teststand in the first place? 
 
 
Thanks
David Jenkinson
0 Kudos
Message 2 of 8
(4,254 Views)
Hi David,

The best way to bypass the login screen is to use the Application Manager reference of the Sequence Editor.  This can be done by using the function RunState.Engine.GetInternalOption(InternalOption_ApplicationManager).

http://zone.ni.com/reference/en-XX/help/370052F-01/tsapiref/engine_getinternaloption_m/

Keep in mind this is a reference and you will need to close it.  I hope this helps!
Matt S
National Instruments
Applications Engineer
0 Kudos
Message 3 of 8
(4,230 Views)
Matt,
I take this to mean that instead of using the labview application manager control in the gui, I should get the application manager reference which is passed in from teststand, correct?  I see I can get the engine reference from sequence context, then the method you describe exists, which outputs a variant.  Use this reference instead?
 
Thanks
0 Kudos
Message 4 of 8
(4,224 Views)
Hi David,

Hope you had a good weekend!  You are correct in using the reference from TestStand.  I hope that helps!
Matt S
National Instruments
Applications Engineer
0 Kudos
Message 5 of 8
(4,201 Views)

Hi,

Believe it or not I'm just now getting back to this.  Other things on the project took priority but this is on the front seat again as a result of other developed software.

 

So when I implement your suggestion, I now get a "Error -2147467261 occurred at Invalid pointer" on the output of the step which has the "GetSequence reference" input.  But I do not get this error when using the UI Application manager reference.  I have attached a screen shot of the error and the vi.  So I tried opening the sequence reference differently, using the engine property, but I still get the same error.  I have attached the vi.  It seems like it does not like the sequence reference pointer when using the application manager from the teststand engine.  Do you see anything wrong here?  I attached the vi too.

 

thanks

 

Download All
0 Kudos
Message 6 of 8
(3,905 Views)

Hi David,

 

You are getting this error because you can not have different managers in different threads.  In general all the manager controls and all the visible UI controls must be in the same UI thread.  Using the application manager in a different thread and with controls on a different VI is not the normal use case and not something we've tested thoroughly and causes unexpected behavior as you may have noticed.  One of the TestStand developers posted about a similar issue in a different thread:

http://forums.ni.com/ni/board/message?board.id=330&message.id=22469#M22469

 

So, I think the way to go in your case is to create a new Application Manager in your code module, which you said you did get working.  One thing to keep in mind about this is that you can only have one Application Manager per process.  So, this will work if you are using the LabVIEW development environment when the code module is called. Because it is using the LabVIEW development environment's process which is different from the Sequence Editor's, it keeps the two Application Managers from conflicting.  However, if you change it so that step is run with the LabVIEW runtime you will notice that it will not work.  You could also build the VI into an executable that you call from a sequence and that will also work, since the executable will have it's own process.

 

Your original problem with this approach was that you did not want your user to have to log in again.  While you cannot programmatically log in, you can check the privileges of the current user and if they have sufficient privileges then you can set a few station options and an option of the Application Manager to suppress login.

 

So if you were to pass the SequenceContext into your code module, you can get a reference to the StationGlobals, and then use GetValBoolean with the lookup string "TS.CurrentUser.Privileges.Develop.EditSequenceFiles" to see if the user is allowed to edit sequence files.

 

 Then to suppress login:

- Set the property of the ApplicationManager, LoginOnStart, to false

- Get a reference to the StationOptions from the Engine and set StationOptions.RequireUserLogin and StationOptions.EnableUserPrivilegeChecking to false

 

 

I'll attach a couple screenshots of how to set those.  I'm also going to attach my VI which shows how I set it all up.  It is in LabVIEW 8.6, so let me know if you need an earlier version. 

 

Let me know if you have any questions or if any of this was unclear. 

Message Edited by KristenC on 12-31-2008 08:28 AM
Message Edited by KristenC on 12-31-2008 08:29 AM
Kristen
National Instruments
Message 7 of 8
(3,790 Views)

Kristen,

This does make a lot of sense, thanks for the reply on this issue.  

 

I think I may have another method in mind which I'm experimenting with.  It seems like I can have a sequence, which itself actually automates open/close of other sequences.  I can use a labview gui to control "continue/save/cancel? etc.  This way I can actually use the editing environment already initialized.   This may be simpler, wish I'd have thought of it earlier (if it works).

 

Thanks

0 Kudos
Message 8 of 8
(3,754 Views)