This might be a simple question, but what would be the best practice in Labview 2015 in adding your own custom VI from the Team Code tree in the Robot Main.VI?
Is this acceptable?
This might be a simple question, but what would be the best practice in Labview 2015 in adding your own custom VI from the Team Code tree in the Robot Main.VI?
Is this acceptable?
What is it doing?
I assume it initializes, i.e., runs once like Begin and exits immediately?
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.
Is there a reason not to stick this VI into the Periodic Tasks instead of 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?
Personally I think the VI is fine to help keep things organized. I would stick it in Periodic Tasks as is, outside the pre-populated loops in there.
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.
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.
I agree, best practice is to put it in Periodic Tasks and to never modify Robot Main.
The error input is unnecessary.
Thanks Mark!
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.
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.