Using the Axis Camera with the RoboRio

I am trying to use the Axis camera with the new control system and am having some problems. In past years, we set up the camera’s IP using the team number. For example, our team is 2102, so the Axis camera IP was set to 10.21.2.11.

However, if I plug in a camera that has that IP, I do not seem to be able to access it from my PC by connecting to http://10.21.2.11 like I used to. Now this new control system uses mDNS, and I read that the camera needs to be configured to use DCHP rather than a fixed IP, so I made that change. I then tried to connect to the camera using the url ‘axis-camera.local’, and lo and behold, it worked, and everything seemed well.

However, when I started using the camera in my program, I connected to it like this:

AxisCamera * m_pCamera = new AxisCamera(“axis-camera.local”);

However doing so caused the following error to be printed repeatedly while the program was running, and I could not reliably capture images from the camera (although it seemed to work sometimes).

Error on line 582 of AxisCamera.cpp: Network is unreachable (0x00000065): Error setting camera parameters

I noticed that the Axis camera example that was supplied was still using a fixed address, so I thought that I might need to specify the actual address instead of “axis-camera.local”. I pinged the camera from my PC and found that the address was 169.254.18.155. So I tried creating the camera using:

AxisCamera * m_pCamera = new AxisCamera(“169.254.18.155”);

and everything seem to work correctly. However, since the camera is getting it’s IP using DCHP, I am assuming that I cannot count on the IP always being this value. So I decided to try using the linux function ‘gethostbyname’ and pass in “axis-camera.local” and see what address came back.

Sure enough, the address resolved to “169.254.18.155” as expected. So all seemed well, until I found that occasionally when I ran the program I still was getting the ‘Network is unreachable’ error. Upon further investigation, I discovered that SOMETIMES ‘gethostbyname’ was returning ‘10.21.2.11’ instead of ‘169.254.18.155’. There seems to be no rhyme or reason to when it would do this.

I am hoping that someone can shed some light on this and tell me how to configure the camera so that I can count on it working properly when we are in a live compitition.

Thanks.

I finally figured out what was going wrong. The root of the problem is that the DLink router was not configured properly. Once configured correctly, I was able to reliably connect to the camera using ‘axis-camera.local’.

Thanks for updating the community with the solution! Looking forward to seeing your robot at the San Diego regional.