|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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();
}
|
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|