Note: As of the end of December 2018, our site has changed hosts and some architecture. As a result, all tutorials are now have a /tutorials in their paths. You will need to update bookmarks.
Our Future . . .
When I initially created this site in 2014, it was to serve two primary purposes.
To document the tips, tricks, and other higher level development practices that make programming for FRC in LabVIEW easier.
Provide a common place for LabVIEW teams to find resources.
At first, this meant documenting the architectural and similar tools that I had learned on my way to becoming a Certified LabVIEW Developer, that had been put to use by the team I was currently mentoring (#3937, Breakaway). (This had the added bonus of helping the senior programmer that had been soaking all this up document it for his successor.)
Since then, this site has had a few additions and updates (mostly by me).
While I have often invited other teams (I am no longer in the AR area and have pretty much lost contact with Breakaway) on CD and at the regionals I've been at to write tutorials for specific topics that they had solved, I was rarely met with a response (specifically once - shout out to the Huskie Robotics 3061 for actually following through, but they were the only ones).
In recent years, I have found myself going through some family changes and needing to dial back my commitment to other activities.
This leaves this site both:
Looking for a new champion/curator, that is willing to:
maintain the back end,
make sure material that becomes obsolete is either updated, or moved to the archives section of the menu,
and either write content or get other teams to write content to help this site remain relevant.
Looking for a new source of funding/hosting. (I have been personall providing the $36/yr that it costs to maintain it using Google Domains for the domain name - and email - and Hosting24 for the hosting; I have thought about using some sort of a Donate button, but have not been able to find a platform that allows for *only* raising the target amount). (With moving to Github's gh-pages for hosting, the cost has been reduced to $12/yr, mitigating this need).
If you have any interest in seeing the continuation of this site, please let me know.
FRC LabVIEW Tutorials - Cameras - Switching
This tutorial was written in the 2015-16 FRC season Stronghold. The shipping vision code has changed so much since then that this method is obsolete.
A common desire among FRC teams has been to have multiple cameras on a robot that can easily be switched between, however coding a solution has not been trivial. As a result, my teammate James and I (Dillon), from FRC team 3061, Huskie Robotics, came up with this relatively simple solution.
The basic concept is that we are modifying two WPI camera VIs that handle sending a camera image to the PC. The modification involves changing the VIs to accept multiple camera Device Refs and then iterating the necessary code over the camera Device Reference whose image is needed at that time.
Begin by making a personal and renamed copy of two WPI libraries, which can be found by searching in the LabVIEW project window.
Make a copy of WPI_CameraBackground Loop.vi and call it WPI_DualCameraBackground Loop.vi. Also, make a copy of WPI_CameraSend Images To PC Loop.vi and call it WPI_DualCameraSend Images To PC Loop.vi
Save these somewhere convenient and accessible.
Here is the original Vision Processing.vi for reference:
And now the modified version:
As you can see, several changes were made:
Duplicate the generic camera set-up code for “USB 0” and “USB 1”
Run both Device References through the WPI_CameraUpdate Camera Status.vi (This step is critical, otherwise the camera feed will appear to try and change, but it will revert to the same camera)
The while loop can be left alone and used for actual processing of images
Call the custom made WPI_DualCameraBackground Loop.vi. Note that creating the second camera Device Reference input for this VI is part of the next step.
Very little needs to be modified in this VI, as the cameras are always USB and therefore no modification of the case structure is required. Simply add a second Device Reference for your new camera and pass both these Device References to WPI_DualCamerSend Images To PC Loop.vi. Note that creating the second camera Device Reference input for this VI is part of the next step.
Relevant part of original VI:
WPI_DualCameraSend Images To PC Loop.vi
This VI is the most change-heavy, although it is still not very complex. Simply follow the instructions and utilize the snippets to prevent bugs:
First for reference, the original VI:
And the modified version we will achieve:
The list of changes should be easy to follow, but if you are unsure, you can always refer to the snippets above for visual comparisons.
Add input for second camera Device Reference
Create an array from the two Device References
Remove case structure in center of diagram (keeping the True case), you should be left with the while loop containing a single case structure
Wrap WPI_CameraSet Frame Rate.vi through to WPI_CameraOpenAndSetVideoMode.vi in a for loop that indexes the array of camera Device References
In the pre-existing while loop:
Open the array up with Index Array
Pass the two Device References into a Select with a boolean (easy if using a global variable) that gives T/F for switching cameras and gives output Device Reference to the inner case structure
In the inner case structure:
Keep the same code but draw a case structure around Safe Image Get Image.vi’s “Image Out” output. This case structure can be used to rotate an image, if necessary, and then pass output to IMAQ Flatten Image To String.vi like normal
Some important notes:
Because only one camera is ever active at a time, this method will still use the same bandwidth as a Robot with only 1 camera attached.
No changes need to be made to the Dashboard. Simply make sure to change the “Camera Off” Drop down menu to “USB Camera SW”. If you have an active and working camera feed, then when the appropriate trigger is set to switch cameras, the display on the Dashboard will automatically update to reflect the change.
And that is all, you can now easily switch between two camera inputs. In addition, this method should be extendable to even more cameras, and with more effort possibly IP Cameras as well.
If this tutorial inadvertently leaves some details out, please tell us about it and we will update it.
May we use Google Analytics to collect anonymized data on your use of the site?May we use Google Analytics to collect anonymized data on your use of this site such as browser type and size, what site referred you, and country of use?
We use this to help us understand how we are doing on getting the word out, and what browsers we should be testing against to make sure the site works for all our readers.