FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Camera getting intermittent black frames in Autonomous mode.

We have our camera set up (in LabVIEW) and running. It works fine and acquires images well during TeleOp mode. However, when it is switched into Autonomous mode, about 2/3 of the images it gets are black.

We have no clue why this is happening. Obviously, our color location code will not work with a black image.

Does anyone have any idea why this is happening, and how to fix it?

0 Kudos
Message 1 of 6
(10,802 Views)

Hi MHSRobotics,

Are you using the basic robot frame work, the advanced robot frame work, or did you make your own?  If you wrote your own, could you provide me with a screenshot of your vision loop?

Do you have a case structure in the vision loop that changes the vision properties when you are in autonomous mode?

Have a great day,

Justin

Applications Engineering

National Instruments

Justin Parker
National Instruments
Product Support Engineer
0 Kudos
Message 2 of 6
(3,069 Views)

We are using the Basic Robot Framework. No, we do not change the camera properties after the initialization.

Here's our basic setup:

1) We thought it would not be a good idea to initialize the camera (Open, Start, ..., Stop, Close) in both Basic Robot Main.vi and Autonomous Independent.vi

2) Thus, we initialize it once in Basic Robot Main.vi, set the Resolution, FPS, BW, Exposure, etc.

3) We have a global CameraDevRef, which gets set after the initialization in Basic Robot Main.vi

4) This initialization doesn't depend on the mode (Autonomous/TeleOp), as is the code is outside the case structure where the TeleOp code is put.

5) We also thought that using Get Image in both Basic Robot Main.vi and Autonomous Independent.vi would not be good (it would have to get an image for Basic Robot Main, and then another one for Autonomous Independent).

6) Thus, to get the image gotten in Basic Robot Main.vi is written to a global variable (CameraImage).

7) As the autonomous loop (in Autonomous Independent.vi) runs, it retrieves the image from the global CameraImage variable as needed.

***NOTE: I don't know if #5 makes any impact.

Also, I have a certain theory that may or may not be true, based on the internal workings of the cRIO/LabVIEW. Perhaps (PERHAPS!!!), Autonomous Independent.vi reads the CameraImage variable at the same time it is being written to. I'm not sure if that's a problem or not...

Anyway, thanks for your help.

P.S. If you still want a screenshot of our vision loop, I can provide it to you.

0 Kudos
Message 3 of 6
(3,069 Views)

Hi MHSRobotics,

You might be trying to pass too much data using the CameraImage global variable.  Your #5 should not be an issue, and is actually how I would suggest doing this.  Keep using the global CameraDevRef to bring your settings from the Robot Main.vi into the Auto Indept.vi, but use the Get Image.vi in the Auto Indept.vi to get the images.  Let me know how that works.

Have a great day,

Justin

Applications Engineering

National Instruments

Justin Parker
National Instruments
Product Support Engineer
0 Kudos
Message 4 of 6
(3,069 Views)

I'm sorry for the delay, but this is the first time we could test the camera code.

Using the CameraDevRef, and GetImage.vi did not work. It's still getting the same amount of black frames.

I'm pretty sure this isn't an issue with the camera or cRIO because it works in TeleOp.

0 Kudos
Message 5 of 6
(3,069 Views)

I would like to see you remove all the other code out of the autonomous mode beyond what is needed for vision and see if you still get the same behavior.  If you do, posting a screenshot of the most basic code that still exhibits this behavior would allow us to try and reproduce it.

Ben

National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer
0 Kudos
Message 6 of 6
(3,069 Views)