Go to Post You know it’s a tough game when you see a bearing on the floor. - D.Allred [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 24-02-2014, 23:03
ayang548 ayang548 is offline
Registered User
FRC #3663
 
Join Date: Feb 2014
Location: Snohomish,WA
Posts: 3
ayang548 is an unknown quantity at this point
Apparent Infinite Loop When Calling AxisCamera.getInstance()

We have a stripped down version of 2014VisionImageSample Project that is apparently going into an infinite loop when it reaches the AxisCamera.getInstance() call. This is our code:

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.camera.AxisCamera;

public class VisionSampleProject2014 extends SimpleRobot {

AxisCamera camera;

public void robotInit() {
System.out.println("about to be initialized... the camera");
camera = AxisCamera.getInstance();
System.out.println("camera initialization complete");
}

public void autonomous() {
}

public void operatorControl() {
}
}

When the call to AxisCamera.getInstance is made, we can trace the code into the constructor using the debugger.
When cameraStartFn.call1 is called, it never returns (this code is inside AxisCamera.java inside WPILIB)

/**
* Axis camera constructor that calls the C++ library to actually create the instance.
* @param IPAddress
*/
AxisCamera(String IPAddress) {
Pointer ptr = Pointer.createStringBuffer(IPAddress);
cameraStartFn.call1(ptr);
}

Our camera IP address is 10.36.63.100
So when we run the code above we expect to not find the camera because the default address is 10.36.63.11. The code does not find the camera as expected but it never returns and repeats the following error message.
-------------------------------------------------------------------------
Debugger output with incorrect camera IP address

Established connection to Debugger (handshake took 32700ms)
### Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt
### Excluding compile: com.sun.squawk.Method::getParameterTypes
[cRIO] about to be initialized... the camera
[cRIO] JavaCameraLib was compiled from SVN revision 2962
[cRIO] camera initialization complete
[cRIO] Default disabled() method running, consider providing your own
[cRIO]
[cRIO]
[cRIO] >>>>ERROR: S_errno_EINPROGRESS (0x00000044): Failed to connect to the camera ...in CreateCameraSocket() in C:/WindRiver/workspace/WPILib/Vision/AxisCameraParams.cpp at line 457
[cRIO]
[cRIO]
[cRIO] >>>>ERROR: S_errno_EINPROGRESS (0x00000044): Failed to connect to the camera ...in CreateCameraSocket() in C:/WindRiver/workspace/WPILib/Vision/AxisCameraParams.cpp at line 457
[cRIO]

<Error Messages repeat apparently forever>


When we pass in the correct IP address, the error messages go away but the call still never returns.
camera = AxisCamera.getInstance("10.36.63.100");
----------------------------------------------------------------------
Debugger output with correct camera IP address

Established connection to Debugger (handshake took 2315ms)
### Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt
### Excluding compile: com.sun.squawk.Method::getParameterTypes
Attached JPDA debugger to localhost:2900
[cRIO] about to be initialized... the camera
[cRIO] JavaCameraLib was compiled from SVN revision 2962

<Output stops>

----------------------------------------------------------------------
We've repeated this with 2 different cameras and 3 different computers. Does anyone have an idea what is wrong?
Thanks,
Angelique
Reply With Quote
  #2   Spotlight this post!  
Unread 25-02-2014, 13:33
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Apparent Infinite Loop When Calling AxisCamera.getInstance()

Just using a webbrower can you connect to the camera from the driverstation?


Is the camera set to enable anonymous viewing?

I don't use the WPI libraries to access the camera, but if I recall correctly, in the past (2011, 2012) the WPI library used to take about 10-12 seconds to initalize a connection to the camera, and it would block robot functionality while this was being done.

I am not sure, if this has been fixed or rectified in recent versions of WPILib.

What if you reset your camera to the default IPgiven to it using the axis camera tool. Does the code work then?
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 25-02-2014 at 13:39.
Reply With Quote
  #3   Spotlight this post!  
Unread 25-02-2014, 13:54
RedDog RedDog is offline
Registered User
AKA: Brian King
FRC #3663 (Cedar Park Robotics)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2011
Location: Bothell, WA
Posts: 3
RedDog is an unknown quantity at this point
Re: Apparent Infinite Loop When Calling AxisCamera.getInstance()

[I am Angelique's mentor]
Yes, the camera image display's fine in the DS and when browsing directly. And anonymous viewing/login is enabled.

We will try moving the camera's IP to the default tonight.

Thanks for the suggestion

Brian
Reply With Quote
  #4   Spotlight this post!  
Unread 25-02-2014, 15:38
nickmcski nickmcski is offline
Registered User
AKA: Nicholas McCurry
FRC #1482 (Grandin Ghosts)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 107
nickmcski has a spectacular aura aboutnickmcski has a spectacular aura aboutnickmcski has a spectacular aura about
Have you created an an account with the username and password "FRC"?
Reply With Quote
  #5   Spotlight this post!  
Unread 25-02-2014, 20:17
ayang548 ayang548 is offline
Registered User
FRC #3663
 
Join Date: Feb 2014
Location: Snohomish,WA
Posts: 3
ayang548 is an unknown quantity at this point
Talking Re: Apparent Infinite Loop When Calling AxisCamera.getInstance()

We moved it to the default IP address and added the FRC account and somewhere along those lines, it worked!!! Thanks for your help!
-Angelique
Reply With Quote
  #6   Spotlight this post!  
Unread 25-02-2014, 22:57
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Apparent Infinite Loop When Calling AxisCamera.getInstance()

great!
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
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 11:02.

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