Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Camera slowing down robot (http://www.chiefdelphi.com/forums/showthread.php?t=91281)

ColonelThrtyTwo 08-02-2011 18:37

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.

Code:

camera = AxisCamera.getInstance();
camera.writeResolution(AxisCamera.ResolutionT.k160x120);
camera.writeCompression(30);
camera.writeMaxFPS(1);

Any Suggestions?

kinganu123 08-02-2011 19:56

Re: Camera slowing down robot
 
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

shawkinsl 08-02-2011 22:01

Re: Camera slowing down robot
 
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).

omalleyj 09-02-2011 08:23

Re: Camera slowing down robot
 
Code:

camera = AxisCamera.getInstance();
camera.writeResolution(AxisCamera.ResolutionT.k160x120);
camera.writeCompression(30);
camera.writeMaxFPS(1);

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.

ColonelThrtyTwo 09-02-2011 16:11

Re: Camera slowing down robot
 
Quote:

Originally Posted by kinganu123 (Post 1018731)
You may want to
1. Run ALL the camera stuff in another thread

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.

Quote:

Originally Posted by kinganu123 (Post 1018731)
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

Will try that.

Quote:

Originally Posted by shawkinsl (Post 1018822)
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).

It behaves normally without retrieving the camera instance.

Quote:

Originally Posted by omalleyj (Post 1019014)
Code:

camera = AxisCamera.getInstance();
camera.writeResolution(AxisCamera.ResolutionT.k160x120);
camera.writeCompression(30);
camera.writeMaxFPS(1);

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.

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"

kinganu123 09-02-2011 22:11

Re: Camera slowing down robot
 
Quote:

Originally Posted by ColonelThrtyTwo (Post 1019299)
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.

omalleyj 10-02-2011 08:53

Re: Camera slowing down robot
 
Quote:

Originally Posted by kinganu123 (Post 1019573)
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.

ColonelThrtyTwo 11-02-2011 17:45

Re: Camera slowing down robot
 
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. :)

DCRich 12-02-2011 15:09

Re: Camera slowing down robot
 
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.


All times are GMT -5. The time now is 10:51.

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