Camera slowing down robot

Hello everyone.

I am attempting to test out the camera in Java. The default program in the cRIO had sent the camera images to the Driver station at an acceptable rate, so I was going to try the camera in java.

In my main robot class, I get an instance of the AxisCamera, set it to its minimum resolution, set it to 1 frame per second, and set the compression to 30. If I do this however, the robot experiences a 3-20 second delay between teleopPeriodic calls (tested with Timer.getFPGATimestamp() and NetConsole). It also garbles NetConsole messages horribly.

I am not doing any processing on the images; I am not even retrieving the image from the AxisCamera instance.

camera = AxisCamera.getInstance();

Any Suggestions?

You may want to

  1. Run ALL the camera stuff in another thread
  2. Hook up the camera directly to the bridge (recommended)
    I personally don’t how its done (we can’t seem to get ours to connect), but I’m fairly certain both are possible

How does the robot behave when you don’t run any camera initializing code? If it is still misbehaving, your issue probably lies somewhere else in your code. (look particularly close at your looped methods.)

I also highly recommend opening a new thread for anything that requires delays (or really handles anything graphical at all – like images from a camera).

camera = AxisCamera.getInstance();

You are doing the above only once right (e.g. in the init method or a constructor)? Not in a loop? You should be able to run the camera at a much higher frame rate and not even notice. That said, the other suggestion of running directly through the radio (if you don’t need to process images) is a good idea. A separate thread should not be necessary if you aren’t actually doing any processing, the getInstance() means you are using the camera’s own thread anyway.

I tried doing that first, but it suffered from the same problem. I thought it was because I wasn’t writing the thread right, but apparently that is not so.

Will try that.

It behaves normally without retrieving the camera instance.

Yes, just once in the robotInit function, which I know is only running once.

I don’t plan on making the main thread do camera work; running it in the main thread was simply to check if the camera was working.

EDIT: By the bridge, do you mean the wireless router, or the cRIO? It was plugged into the cRIO board, and when I connected it to the router, it gave me “[cRIO] AxisCameraParams: connect: S_errno_EHOSTDOWN”

Yes, the DLink router your team got this year in the KOP
Toy around with the settings I guess. If you get something, let me know. Our camera refuses to respond to the DS at all (both at the cRIO and at the bridge), so I’m sorry I can’t help you more.

If you aren’t seeing anything, did you update Labview (even though you are running Java)? Some of the DLLs for the dashboard changed and I had no camera view on one laptop until I realized I had updated only the DriverStation and not Labview on that machine. Once I updated the camera was fine on that one as well.
Through the bridge/router/radio if you have set the camera to the same subnet you should be able to use IE (Firefox did not work for me) and go to http://10.xx.yy.90, login as FRC, FRC, and see the image. There is nothing to program or break so that will validate the camera itself is working and the IPs are all in order.

The laptop doesn’t have LabVIEW installed, and the instillation takes way too long (It’s also hampered by the fact that it doesn’t have a CD drive).

Anyway, I think I figured out what was wrong with hooking up the camera to the router. The camera was not being assigned the correct IP address (fixed via a DHCP setting). The test display at 10.xx.yy.90 is working, and the robot is no longer slowing down, but there’s still no display, which is probably because I haven’t installed the update to the driver station.

Anyway, thanks for the help everyone. :slight_smile:

Can you please be more specific in your replies? What DHCP setting did you use? cRIO does not assign DHCP automatically so … you should cite exactly what you did to solve the problem.