Go to Post Innovating for the sake of innovating, reinventing the wheel is probably the second biggest pitfall you can fall into when designing an FRC robot, if the wheel is already a very optimized, good solution. - Chris is me [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 31-01-2016, 19:53
jojoguy10's Avatar
jojoguy10 jojoguy10 is offline
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Corvallis, OR
Posts: 295
jojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant future
Re: Switching between two webcams on the dashboard

Hey Teku14,

We successfully (after 5 hours!) managed to switch webcams. I will post the relevant VI snapshots and try to explain them the best I can. Here is a link to the code we tried and some annotated screenshots.
https://drive.google.com/folderview?...&usp=sha ring

Vision Processing:
We created two cameras (notice the different RefNum names ) and wired them into our new Background Loop VI.

CameraBackground Loop:
We had to create a second RefNum input for the second webcam and run two (2) Send2PC loops (one for each camera).

Send2PC:
It looks like you did the Send2PC perfectly. Just create controls for the port and the image name, and set them as inputs for the VI.

DASHBOARD:
DashboardMain:
We had to do a bit of trial and error to get this to work correctly. We have a bit of code (highlighted in the orange box) that would "refresh" the feed and the port. Without that code, we would flip the camera switcher, but the image wouldn't update with the new camera unless we switch from Camera HW to Camera SW (or vice versa). So, this little block of code automatically switches from HW to SW (or vice versa) if the port changes.

CameraRead_MJPG:
This was a tricky VI because it was a clone and you can't edit a clone. The trick I found to edit a VI is:
  • In the DashboardMain VI, do a CTRL+F (find)
  • Next, under "Select Object", click the "Add" button and go to: Objects in vi.lib and if you scroll all the way down, you will see the Camera VIs
  • Find the Dashbd MJPG VI and left-click on it
  • Next, in the "search Scope", choose the "<All VIs in Application Instance>" and make sure the "Hierarchy Window" checkbox is checked
  • Flick Find
  • Double-click on "VI Hierarchy"
  • You should be able to click and drag the VI (Dashbg MJPG) into the Dashboard Main VI so you can edit it
Now that you have that VI, you can open it up and continue on. Yay!

Inside that VI, there is a "Get On PC" VI inside the "1, 2" case in the middle case-structure. We had to edit that too :-)

Get on PC:
Since this VI is also a clone, do the same steps as above with the MJPG VI, (but, obviously, look for the Get On PC instead )

Moving on...

All we had to add was a control for the camera port and make it an input for the VI.


That's what we did. Let me know if you have any further questions at all.

Thanks again Greg for getting us on the right foot
__________________

2013 and 2014 - Student (FRC#2990), Programmer (LabVIEW)
2015 and 2016 - Mentor (FRC#2990), Programming (LabVIEW)
2017-Current - Mentor (FRC#997), Controls/Programming (Java)
2015-Current - A/V Volunteer at Oregon events
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi