Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Toggle Between Two Cameras in Vision Processing (http://www.chiefdelphi.com/forums/showthread.php?t=133771)

RoboBucs 04-02-2015 16:05

Re: Toggle Between Two Cameras in Vision Processing
 
Quote:

Originally Posted by adciv (Post 1437894)
Ok, I hacked this together in about 90 minutes and verified it works with two of our HD-3000 cams. Everything is located in the "Vision Processing.vi". It uses the "DB/Button 1" switch on the dashboard. True will give you one camera, false the other. It only runs in "HW Mode". There is a small switching delay.

*Edit* now with file.

Alright so we tried it today but with no results, is there anything in that VI that we need to edit other than the robot global data thing?

RoboBucs 04-02-2015 16:47

Re: Toggle Between Two Cameras in Vision Processing
 
Quote:

Originally Posted by RoboBucs (Post 1438325)
Alright so we tried it today but with no results, is there anything in that VI that we need to edit other than the robot global data thing?

Nevermind we got it working, we just didn't assign DB/Button 1 anything *Facepalm

adciv 04-02-2015 17:01

Re: Toggle Between Two Cameras in Vision Processing
 
It's designed to be run unmodified with the default dashboard. You shouldn't have needed to modify any globals. DB/Button 1 is one of the default buttons on the default dashboard.

pastelpony 05-02-2015 07:20

Re: Toggle Between Two Cameras in Vision Processing
 
Would this work with Axis cameras or would it need to be fine tuned?

adciv 05-02-2015 11:58

Re: Toggle Between Two Cameras in Vision Processing
 
I am now in a recursive loop WRT cameras.

Please see the thread below for some code which should work with Axis cameras. I wasn't able to test that code on a robot so it may have some issues. If so, please let me know.

http://www.chiefdelphi.com/forums/sh...d.php?t=133559

RobotMonkey 16-02-2015 15:24

Re: Toggle Between Two Cameras in Vision Processing
 
Just wanted to say that you are the man adciv. Using your code to switch between two USB cameras, and it works fine. I switched the toggle to happen on a joystick button press, to be easy for our driver. Now he has the stationary camera at the bottom of the lift, to help line up crates, and a camera at the top of the lift attached to a pan/tilt to get a better view of the field.

PhilBot 22-02-2015 22:35

Re: Toggle Between Two Cameras in Vision Processing
 
Thanks adciv.

I used your code with JS to switch cams.

The BOT Drivers were complaining about switching delay, so I tried opening two cameras and just switching the image source.

Didn't work. LV doesn't seem to like me opening two USB cameras. I get this error when I try to set the FPS on the second camera.

ERROR -1074360319 occurred at IMAQdx Start Acquisition.vi
NI-IMAQdx: (Hex 0xBFF69001) Internal error

I've included a simple example without the actual switching.
http://www.GEARSinc.org/images/cap.png

Everything work fine till I add the second cam. Any idea why LV is getting upset?

Greg McKaskle 23-02-2015 07:48

Re: Toggle Between Two Cameras in Vision Processing
 
I've definitely opened multiple USB cams on a roboRIO with no problem. I was processing them and not streaming. Are you sure that is the first call to fail?

Greg McKaskle

PhilBot 23-02-2015 09:28

Re: Toggle Between Two Cameras in Vision Processing
 
Quote:

Originally Posted by Greg McKaskle (Post 1448617)
I've definitely opened multiple USB cams on a roboRIO with no problem. I was processing them and not streaming. Are you sure that is the first call to fail?

Greg McKaskle

I don't know which/when the call fails, but I do know that if I don't make the second call to SET FPS I don't get the error. Perhaps it's a reentrancy problem.

I'll try doing one camera setup at a time.

Phil.

PhilBot 23-02-2015 10:45

Re: Toggle Between Two Cameras in Vision Processing
 
2 Attachment(s)
Still hunting this down..

Stringing all the camera setup mods in-line didn't help.
In trying to identify the point of the error, I probed all the error outs of the first and second camera setups.

Interesting to note that even though the open to the second camera works, the SET FPS does generate an error. See the attached probe sequence.

A final point. If I just swap the USB0 and USB1 constants, the second camera is successfully displayed, so I know the second cam is functional and configurable.

Phil.

PhilBot 23-02-2015 12:09

Re: Toggle Between Two Cameras in Vision Processing
 
1 Attachment(s)
Starting to get worn out...

I reduced my problem down to two camera opens....

I open and start two cameras. The second start fails...

From the FP you can see that the system has identified the cameras properly.

Any idea why the second start doesn't work?

PhilBot 23-02-2015 12:53

Re: Toggle Between Two Cameras in Vision Processing
 
Quote:

Originally Posted by Greg McKaskle (Post 1448617)
I've definitely opened multiple USB cams on a roboRIO with no problem. I was processing them and not streaming. Are you sure that is the first call to fail?

Greg McKaskle

It seems to be the WPI_CameraStartStopCount.vi that's causing the trouble.
The first call is fine, but the second call to IMAQdx Configure Grab is erroring out.

I can't tell if the "Cameras Address" is a valid input for the "Session" input of the Configure Grab function. It's being coerced.

The default "Start" action for an unopened USB cam is to open cam0. Is it trying to do this default action twice?

Phil.

Greg McKaskle 23-02-2015 18:04

Re: Toggle Between Two Cameras in Vision Processing
 
I have been able to reproduce the issue here and I'm speaking with the IMAQ group. I'll let you know what I find out.

Greg McKaskle

adciv 23-02-2015 22:23

Re: Toggle Between Two Cameras in Vision Processing
 
Sorry for taking so long to pop in, been working on the robot too many hours.

I think I saw this problem when initially developing this code (Added about 40 min or so to the dev time). It would explain why I couldn't do an instant switch like I wanted.

PhilBot 24-02-2015 09:25

Re: Toggle Between Two Cameras in Vision Processing
 
Quote:

Originally Posted by Greg McKaskle (Post 1448871)
I have been able to reproduce the issue here and I'm speaking with the IMAQ group. I'll let you know what I find out.

Greg McKaskle

Woo Hoo!!!


All times are GMT -5. The time now is 00:48.

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