Go to Post You must have a base on which to stand. Knowledge is the base that wisdom stands on. - Steve W [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-02-2016, 22:10
robert1356 robert1356 is offline
Registered User
AKA: Robert Palmer
FRC #3824 (RoHAWKtics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Knoxville, TN
Posts: 48
robert1356 is an unknown quantity at this point
Cool USBCamera won't disconnect from camera for GRIP to run

I'm wanting to write the following code for our robot code:

Startup:
- create USBCamera object
- set the brightness and exposure from stored preferences
- disconnect from camera
- run GRIP

Currently when I try this, GRIP says that the frame grabber could not connect to the camera.

Here's what I know so far:

- I have created my own USBCamera class that is an exact copy of the WPI lib version, but gives me the ability to set the exposure with better control
- The constructor for USBCamera calls openCamera() which calls NIVision.IMAQdxOpenCamera()
- The USBCamera method closeCamera() calls NIVision.IMAQdxCloseCamera
- I do not use the autocpature feature, I call getImage() and push that to the CameraServer object so startCapture() is never called.

I assumed that NIVision.IMAQdxCloseCamera() would close the connection to the camera, but that does not seem to be the case. I am calling that and then trying to start GRIP and grip fails connecting to the frame grabber for cam0 (the same camera I just used in USBCamera).

Does anyone have any idea how to do this? Any idea why calling USBCamera.closeCamera() does not disconnect from the camera object?

Thanks in advance
  #2   Spotlight this post!  
Unread 05-02-2016, 20:54
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: USBCamera won't disconnect from camera for GRIP to run

What model camera is it? For many types of USB cameras, the driver comes with a dashboard program that lets you persistently set things like brightness and exposure while it's plugged into your laptop, then you can just move it over to the RIO.

Also, a lot of webcams have an LED that turns on when it's connected. Can you verify that IMAQdxCloseCamera causes the LED to turn off?
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #3   Spotlight this post!  
Unread 06-02-2016, 11:33
robert1356 robert1356 is offline
Registered User
AKA: Robert Palmer
FRC #3824 (RoHAWKtics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Knoxville, TN
Posts: 48
robert1356 is an unknown quantity at this point
Re: USBCamera won't disconnect from camera for GRIP to run

I'm using the LifeCamHD. I did some more digging. You're right about the light. It turns out that it IS disconnecting from the camera. GRIP is connecting to the camera. The exceptions I saw were anomalies. It turns out the real issue is this exception:

eb 06, 2016 4:27:56 PM edu.wpi.grip.core.operations.composite.PublishVide oOperation lambda$new$17
WARNING: Address already in use
java.net.BindException: Address already in use

So the closeCamera does actually disconnect (and you do see the blue light turn off). I'm going to move this discussion to a new thread that discusses the above issue.
  #4   Spotlight this post!  
Unread 08-02-2016, 11:03
robert1356 robert1356 is offline
Registered User
AKA: Robert Palmer
FRC #3824 (RoHAWKtics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Knoxville, TN
Posts: 48
robert1356 is an unknown quantity at this point
Re: USBCamera won't disconnect from camera for GRIP to run

As far as I can tell, A) there is no program that comes with the camera. It uses the USB standard camera interface. B) if you power the camera off, it loses it's settings. I do have an app for controlling the settings from my laptop, but as soon as you unplug and re-plug, you lose the settings.
Closed Thread


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 00:42.

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