Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Issues connecting cRIO 2 with Camera (http://www.chiefdelphi.com/forums/showthread.php?t=101728)

matthewfl 01-02-2012 17:51

Issues connecting cRIO 2 with Camera
 
We are having a lot of issues getting the cRIO to grab images from the camera. We have configured our camera to 10.6.87.11 and are able to see the view from a web browser on the same network.
In our code we have: AxisCamera::GetInstance("10.6.87.11");
Before we were getting errors that stated that the symbol AxisCamera::GetInstance was not resolving and we were able to fix this by recompiling the WPILib.

Has anyone else had such terrible luck with the camera and has anyone found any way to fix this, also is there anything in the code that I might be missing with respect to the camera.

DjScribbles 02-02-2012 14:40

Re: Issues connecting cRIO 2 with Camera
 
Be sure you are calling AxisCamera::GetInstance each time you go through the function it's used in (as apposed to getting the pointer to it and saving it in a attribute during init), because the CRIO boots faster than the camera, and (I believe) you need to call the get instance after the camera is booted (green lights).

Also, be sure to keep an eye on the little reset button on the back of the camera, if it's depressed during boot, it will wipe your configuration and IP settings. So it's a good idea to call camera.WriteBrightnessLevel(##) for whatever you want your values to be, and mount it solidly so it doesn't get pressed and reset your IP.

mikets 02-02-2012 20:04

Re: Issues connecting cRIO 2 with Camera
 
Quote:

Originally Posted by DjScribbles (Post 1118561)
Be sure you are calling AxisCamera::GetInstance each time you go through the function it's used in (as apposed to getting the pointer to it and saving it in a attribute during init), because the CRIO boots faster than the camera, and (I believe) you need to call the get instance after the camera is booted (green lights).

Are you sure about this? According to the source code of AxisCamera.cpp, GetInstance will just instantiate the AxisCamera class if it's not already done so. And the constructor of AxisCamera is just creating a semaphore, creating a camera task and starting it. The camera task is a forever loop reading images from the camera. If the camera is not ready, it will sleep for 1 second before trying again. Regardless of whether the camera is ready or not, GetInstance() will give you a pointer to the camera object. So I don't see why I cannot save the camera pointer instead of having to call GetInstance() over and over again.

matthewfl 04-02-2012 03:03

Re: Issues connecting cRIO 2 with Camera
 
I have been going through some of the WPILib source code as well, and I believe that the GetInstance returns the same camera object the whole time.

As far as code goes, the relevant camera lines are:
AxisCamera &camera = AxisCamera::GetInstance("10.06.87.11");
HSLImage *image = new HSLImage();
// this inside the loop
cout << camera.GetImage(image) << endl; // This prints out 0 meaning that no image was returned.

I think what I am basically asking are other teams having similar problems, have you fixed it and how. (We have been working on this for over a week now with no image coming through on the dashboard or the cRIO getting any note of the camera being there, the best that we got is we can ping the camera from the cRIO)


All times are GMT -5. The time now is 17:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi