Go to Post I have many ideas, every last one of them involves finding something more productive to do with your time. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-04-2011, 22:11
Dacilndak's Avatar
Dacilndak Dacilndak is offline
Matt'); DROP TABLE Users; --
AKA: Matthew Haney
FRC #3729 (Red Knights)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Denver, Colorado
Posts: 12
Dacilndak is an unknown quantity at this point
C++ Camera Freeze/Crash Fix!

My team has been having issues with our Axis M1011 camera this year. Given the default FIRST-provided code:

Code:
Wait(8.0);
AxisCamera & cam = AxisCamera::GetInstance();
the camera image would appear on the DS for a few seconds, then freeze. The cRIO would crash, the RSL would either stop blinking or go off completely, and we would lose all communication to the robot UNTIL we unplugged the camera - then communications would be immediately restored.

If any of you other CD users have had this problem, today I found a solution.

I must give many, many thanks to Joe Hurler, who detected and patched a bug in the WPILib files concerning the AxisCamera and AxisCameraParams classes. Apparently, the two work together on two separate threads (or tasks), one reading MJPEG images from the camera and the other trying to update the camera settings. However, these two threads do not coordinate with each other to regulate access to the camera. As such, they often get in each other's way and both would crash. Full details can be found here.

Hurler successfully patched this problem (files downloadable here) with three files: AxisCamera.cpp, AxisCameraParams.cpp, and AxisCameraParams.h. To install these patches, simply add AxisCameraParams.cpp and AxisCamera.cpp to your WindRiver project, and in the same project open the Includes tab in the class browser. From there, expand the first (top) directory. Expand Vision. Open AxisCameraParams.h and copy all of the source from Hurler's AxisCameraParams.h into that file (overwriting the old code). Everything is now in place, but there is one important fix that must be made:

In AxisCamera.cpp and AxisCameraParams.cpp, some errors will be generated if you attempt to build your project; namely, the compiler won't be able to find some header files (I believe they're AxisCamera.h and PCVideoServer.h). Inside the quotes, add "Vision/" to the pathname (making it #include "Vision/AxisCamera.h"). Your project should now build flawlessly, and the camera image should show up on the dashboard!

Thanks again to Joe Hurler for finding this error in WPILib and coming up with a solution! I hope this helps other teams using C++ suffering from this problem!
__________________
Team 3729 - Raiders - Programming Team Co-Captain
2011 Colorado Regional Semifinalist
2011 Colorado Regional Rookie All-Star Award
2011 Colorado Regional Highest Rookie Seed Award
Reply With Quote
 


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 13:04.

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