Go to Post Well, John V-Neun still has a little bit of hair. Maybe it'll be an astroturf field? - Amanda Morrison [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 09-01-2012, 17:59
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Connecting to the Camera

I have the camera assigned to the IP 10.0.20.11 (on team 20). I have it connected to my router, along with everything else. My web browser can open the stream, and I can see the feed in the dashboard just fine. However, I am having issues accessing the camera in my code. I get an instance of the camera, but the code stops running very soon after I get the instance. Here is the code I am using:

Code:
        try {
            camera = AxisCamera.getInstance();
            for(int i=0;true;i++) {
                System.out.println(i);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
The count reaches about 15, then stops. I switch modes or disable and re-enable, but the counter does not start again, and a reboot is needed. Once, I saw an error message saying the camera was not accessible. However, this was only once; normally I do not get any error message. Does anyone have any ideas on how to start diagnosing this issue? Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 09-01-2012, 21:19
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 70
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Connecting to the Camera

The default constructor for AxisCamera used to use the default ipaddr of 192.168.0.90.

To connect to your camera you need to connect your camera by creating you're own instance:

AxisCamera camera = new AxisCamera("10.0.20.11")

Unless you supply the ip-addr of your camera, AxisCamera won't know how to connect to it.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-01-2012, 22:27
BradAMiller BradAMiller is online now
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Connecting to the Camera

For 2012 the AxisCamera class has been modified to default to using your team subnet for the camera. So if you call AxisCamera.getInstance(), you'll get an object that tries to connect to the camera on 10.x.y.11, where x.y are your team number (same as the other things on the subnet).

You can also call getInstance with a string that represents the IP address that you'd like to use. For example, AxisCamera.getInstance("10.1.90.11").

The reason for the change is to encourage teams to standardize on connecting the camera to the switch rather than port 2 of the cRIO as was done previously. The idea is to make everyone consistent so that it's easier to debug issues at events and online. Also, the new 4-slot cRIOs don't have a second ethernet port so it is not a choice.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #4   Spotlight this post!  
Unread 10-01-2012, 00:18
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Connecting to the Camera

Thanks for the advice, but it was something much sillier. I had tried both the default getInstance() and specified the IP address (I had looked at the code and saw they were both the same anyways). One issue was the router assigning my coding laptop the IP address "10.0.20.11", which makes me wonder why I was able to get any feed at all, and may explain why I got no feedback to the console after the error. The second issue was that one of the other mentors changed the password without telling me. After fixing both of these, it worked flawlessly!

I also saw the error again while working on it, and copied it so anyone else who sees this error might check those two problems for a fix

Code:
ERROR: S_errno_ECONNREFUSED (0x0000003D): Failed to connect to the camera ...in CreateCameraSocket() in C:/WindRiver/workspace/WPILib/Vision/AxisCameraParams.cpp at line 457
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 22:23.

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