Hi,
How can i send my cluster to autonomous vi from vision processing vi? To teleop I have used vi terminals but there is no terminal for Autonomous. I tried global variables but couldn’t figure out how. I’ve attached screenshot of robot main.
I see a few problems here:
Firstly, your wire going from Vision to Teleop is going the wrong direction; it is an output from teleop that is being passed into Vision. If you did want to use wires for this for some reason, you would want to reverse the direction of the wire by changing the control in Vision to an indicator and the indicator in Teleop to a control.
More importantly, you can’t use wires to pass information between parallel loops. The loop receiving the info will wait for the first loop to end before it gets only the information from the last pass from the first loop. Since you want these loops running in parallel, this method won’t work. For parallel loops you will need to use global variables. You can set them in one loop (vi) and then read them in another. FIRST gives us a global variable in the prebuilt robot framework. You can add elements to the preexisting global by adding controls to its front panel and then drag it into the vi where you want to read write it. You can find more information on global variables here.
Parallel operations cannot share data through synchronized data flow wires. If they did, they’d no longer be parallel and independent.
So there are a number of additional language constructs in LabVIEW to support the sharing of data when in a parallel, non-sequential situation. The easiest to use, and the one the framework suggests in the attached comment, is the variable. In this case, the global variable. Write to it in the Vision loop and read from it in the auto loop and it probably does what you need. The only additional consideration you may want is to initialize it so that things don’t misbehave if vision is removed or failing to function how it is supposed to.
Just to look at alternatives.
When you do not want to miss a value, you may want to use a queue. Vision would enqueue information, and autonomous would dequeue and process it. Because the information in the queue can get stale pretty quickly, I don’t think a queue is a good idea.
When you want a more event-driven form of execution, you may want to use a notifier. This is a special form of single-element-queue with overwrite. The vision loop would post a notification to auto when it sees something, and the auto would automatically sleep until something is posted.
Other data sharing mechanisms exist as well, and the functional global lets you build your own that are custom suited to your task.
But in the case of vision and auto, a simple global variable is really pretty good approach.
Greg McKaskle