Go to Post Breaking a rule just because you think it is meant to be broken is not good advice. - Andy Baker [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   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: 291
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
  #2   Spotlight this post!  
Unread 31-01-2016, 21:08
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Switching between two webcams on the dashboard

You are welcome. Glad you got it working and are willing to share the results.

Also, if you have a reentrant clone VI and need to edit it, press ctl-m, which is a shortcut for Operate >> Change to ... Mode. This lets you go between run and edit mode for any VI. Clones default to Run Mode.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2016, 01:43
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: 291
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

Quote:
Originally Posted by Greg McKaskle View Post
You are welcome. Glad you got it working and are willing to share the results.

Also, if you have a reentrant clone VI and need to edit it, press ctl-m, which is a shortcut for Operate >> Change to ... Mode. This lets you go between run and edit mode for any VI. Clones default to Run Mode.

Greg McKaskle
Glad to help out other FRC'ers :-)

And thanks for that tip. That's MUCH easier than what we had to do
__________________

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
  #4   Spotlight this post!  
Unread 01-02-2016, 22:02
teku14's Avatar
teku14 teku14 is offline
http:
FRC #2614 (MARS)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Morgantown, WV
Posts: 64
teku14 is a jewel in the roughteku14 is a jewel in the roughteku14 is a jewel in the roughteku14 is a jewel in the rough
Re: Switching between two webcams on the dashboard

Thank you all for the response! Extremely helpful. I will try this out and post how it turns out.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2016, 18:54
teku14's Avatar
teku14 teku14 is offline
http:
FRC #2614 (MARS)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Morgantown, WV
Posts: 64
teku14 is a jewel in the roughteku14 is a jewel in the roughteku14 is a jewel in the roughteku14 is a jewel in the rough
Re: Switching between two webcams on the dashboard

I'm sorry but even after following your instructions and pictures to the dot it doesn't seem to be working. Also the code you attached is trying to access the default WPI VIs that are on my computer. Can you save the modifications you made to the WPI Camera VIs into the project as new VIs and repost it?
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2016, 19:24
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Switching between two webcams on the dashboard

Glad you guys got it all working! Just a piece of advice from a former driver, though – you will probably not be looking at your driver station laptop nearly as much as you think you will. Driving is stressful and dangerous and it's hard to tear your eyes away from the field and down to your computer.

That's my experience anyway. Just something to keep in mind!
__________________
2014 IRI Quarterfinalists (Thanks 368, 1477, 233)
2014 Minnesota State Championship Winners (Thanks 2052, 4778)
2014 Archimedes Quaterfinalists (Thanks 399, 2056, 2834)
2013 Minnesota State Championship Winners (Thanks 2052, 4607)
2013 Galileo Division-Finalists (Thanks 2169, 3284)
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2016, 19:45
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: 291
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

Quote:
Originally Posted by bvisness View Post
Glad you guys got it all working! Just a piece of advice from a former driver, though – you will probably not be looking at your driver station laptop nearly as much as you think you will. Driving is stressful and dangerous and it's hard to tear your eyes away from the field and down to your computer.

That's my experience anyway. Just something to keep in mind!
Thanks for the advice! I was the driver for our team for 2 years, and I can concur, however , with how little visibility there is on the field this year, it will be difficult to see what's in front of your robot at times (e.g. a boulder behind the drawbridge).

We have tested the latency on the camera over wifi from the robot (not through the FMS, so it might vary), and it isn't that bad. We calculated it to be only about 90-100ms lag. We had our driver drive it a bit ONLY looking at the webcam image, and he said he could drive it just fine.
__________________

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
  #8   Spotlight this post!  
Unread 07-02-2016, 09:36
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: 291
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

Quote:
Originally Posted by teku14 View Post
I'm sorry but even after following your instructions and pictures to the dot it doesn't seem to be working. Also the code you attached is trying to access the default WPI VIs that are on my computer. Can you save the modifications you made to the WPI Camera VIs into the project as new VIs and repost it?
I will post the VIs. I will try to get them out before the end of the week (school, work, robotics, etc )

Also, I double-checked the rules, and we're not allowed to use port 1181. We have to use a port somewhere in between 5800 and 5810 (per R60)
__________________

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
Reply


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 01:19.

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