|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Best Practice for adding custom VI to Robot Main?
What is it doing?
I assume it initializes, i.e., runs once like Begin and exits immediately? |
|
#2
|
||||
|
||||
|
Re: Best Practice for adding custom VI to Robot Main?
There is a loop inside that is running at 10 msec is how my software group decided to implement this. It sequences tele-op state logic to set preset positions to a PID controller.
|
|
#3
|
||||
|
||||
|
Re: Best Practice for adding custom VI to Robot Main?
Actually it's 25 msec. But none the less, it's a loop. See a screen shot below.
|
|
#4
|
|||
|
|||
|
Re: Best Practice for adding custom VI to Robot Main?
Is there a reason not to stick this VI into the Periodic Tasks instead of Robot Main?
|
|
#5
|
||||
|
||||
|
Re: Best Practice for adding custom VI to Robot Main?
I don't think there is a reason, hence why I was asking what would be the best practice recommended, other than having it's own loop that can be adjusted. Is the recommended practice not to have a loop, and then just place the VI in the 10 msec periodic task?
|
|
#6
|
|||
|
|||
|
Re: Best Practice for adding custom VI to Robot Main?
Quote:
If you do want to leave it in Robot Main, you need to get have it be a fork off the error chain like Periodic Tasks is, what you have now will prevent the main Scheduling Loop section from running until your subVI completes which it sounds like it may never do. |
|
#7
|
||||
|
||||
|
Re: Best Practice for adding custom VI to Robot Main?
Quote:
So something like this is best practice? |
|
#8
|
|||
|
|||
|
Re: Best Practice for adding custom VI to Robot Main?
That's what I would do and have done in the past.
If you're not using the error in your subVI you don't need the chaining to maintain sequencing with the subVI placed in Periodic Tasks, if you are using it then obviously leave it. |
|
#9
|
|||||
|
|||||
|
Re: Best Practice for adding custom VI to Robot Main?
I agree, best practice is to put it in Periodic Tasks and to never modify Robot Main.
The error input is unnecessary. |
|
#10
|
||||
|
||||
|
Re: Best Practice for adding custom VI to Robot Main?
Thanks Mark!
|
|
#11
|
|||
|
|||
|
Re: Best Practice for adding custom VI to Robot Main?
As long as you understand order of operations and what the code is doing, how it will affect everything else and data flow. You can put it where you want. The robot main was constructed to make things easy for people that have never programmed before. Put this in this vi and this in this vi etc... It give a step by step to try and help you do the right things without having to understand everything about how to program.
If you are confident that you know what you are doing and how things work then making subvi's that run in parallel with the main loop is Okay. You will have to be careful that you are not talking to a motor drive, solenoid, relay, etc.. in multiple loops. My programming team has loops for different functions of our robot. When that function is required we call it from the other loops when you need them to work together. Like drive and lift. The drive is in the teleop loop but the lift is in its own loop so we can automate the steps of lifting a tote or putting it down. |
|
#12
|
|||||
|
|||||
|
Re: Best Practice for adding custom VI to Robot Main?
It was also constructed in a way that makes it possible to do everything you might need to do without modifying Robot Main itself. Any parallel loops you want to add can go in Periodic Tasks.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|