Team was setting up camera today. We have it configured through the cRIO. When browsing to the camera’s IP address while it is connected via ethernet, the camera displays on the page. Then, when we switch to the driver account, we connect it through the cRIO and it displays a white screen on the camera area of the driver panel. cRIO is formatted for c++.
How do we make it actually display video on the driver panel?
Did you include the DashboardDataFormat.cpp/.h code from the examples? You need to include them and it has a function sendVisionData() (or something similar, this is from my memory) that you need to call in your robot loop so it will send the camera data to the dashboard app.
If you take a look at the 2010 Camera Tracking example included in your WindRiver installation, you’ll see some camera code.
You basically need to do a few things,
// In your constructor
AxisCamera &camera = AxisCamera::GetInstance();
camera.WriteResolution(CAMERA_RESOLUTION);
camera.WriteCompression(CAMERA_COMPRESSION);
camera.WriteBrightness(CAMERA_BRIGHTNESS);
camera.WriteMaxFPS(CAMERA_MAX_FPS);
camera.WriteExposureControl(CAMERA_EXPOSURE);
camera.WriteWhiteBalance(CAMERA_WHITE_BALANCE);
// When you want to display a new image.
if (camera.IsFreshImage()) {
HSLImage *image = camera.GetImage();
}
From my experience with the new camera, WPI lib does not have support this year to change the parameters in the code (WPI lib is that bad this year). that means, you need to adjust the camera parameters by using the camera’s web interface, and you won’t be able to modify them during the match. In fact, the only way I’ve been able to stream images with the new camera without causing some sort of cataclysmic crash is by contenting myself with just one line of code:
I suspect the problem is related to changing parameters while a MJPG stream is underway. There is apparently some code that doesn’t deal appropriately with the camera returning an error and no image, and that results in a bad pointer reference.
Hopefully the error handling will be improved, but you may be able to use the API just fine by stopping the MPEG stream, changing the params, and starting it up again.
We are having similar data access crashes with our M1011 camera. There appears to be a good information in the RobotPy thread on the same problem:
There is a potential patch up at WPIforge and will require some expertise to re-build the WPILib. I guess I know what I’ll be doing at our shop this afternoon.