Go to Post I hope that 50 years from now, FIRST is no longer required. - Lil' Lavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2011, 18:37
ColonelThrtyTwo's Avatar
ColonelThrtyTwo ColonelThrtyTwo is offline
Registered User
FRC #3676
 
Join Date: Jan 2011
Location: Somewhere in Texas
Posts: 13
ColonelThrtyTwo is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 08-02-2011, 19:56
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
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
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 08-02-2011, 22:01
shawkinsl shawkinsl is offline
Registered User
FRC #3735
 
Join Date: Feb 2011
Location: Texas
Posts: 2
shawkinsl is an unknown quantity at this point
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).
Reply With Quote
  #4   Spotlight this post!  
Unread 09-02-2011, 08:23
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 09-02-2011, 16:11
ColonelThrtyTwo's Avatar
ColonelThrtyTwo ColonelThrtyTwo is offline
Registered User
FRC #3676
 
Join Date: Jan 2011
Location: Somewhere in Texas
Posts: 13
ColonelThrtyTwo is an unknown quantity at this point
Re: Camera slowing down robot

Quote:
Originally Posted by kinganu123 View Post
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 View Post
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 View Post
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 View Post
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"

Last edited by ColonelThrtyTwo : 09-02-2011 at 16:38.
Reply With Quote
  #6   Spotlight this post!  
Unread 09-02-2011, 22:11
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: Camera slowing down robot

Quote:
Originally Posted by ColonelThrtyTwo View Post
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.
__________________
Reply With Quote
  #7   Spotlight this post!  
Unread 10-02-2011, 08:53
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Camera slowing down robot

Quote:
Originally Posted by kinganu123 View Post
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 11-02-2011, 17:45
ColonelThrtyTwo's Avatar
ColonelThrtyTwo ColonelThrtyTwo is offline
Registered User
FRC #3676
 
Join Date: Jan 2011
Location: Somewhere in Texas
Posts: 13
ColonelThrtyTwo is an unknown quantity at this point
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.
Reply With Quote
  #9   Spotlight this post!  
Unread 12-02-2011, 15:09
DCRich DCRich is offline
Mentor
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2006
Location: Steinert H.S., Hamilton NJ
Posts: 21
DCRich is an unknown quantity at this point
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.
Reply With Quote
Reply


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 12:34.

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