Log in

View Full Version : Vision code hangs cRIO


CarrotBlasphemy
15-02-2014, 10:45
I'm using the basic sample code for detecting a hot goal and when I run it, it keeps printing out "Robot drive... Output not updated often enough" Is there a way to fix this to run the vision code but not hang? Also, in case this matters, I'm calling it from a separate class

mechanical_robot
15-02-2014, 10:49
I'm using the basic sample code for detecting a hot goal and when I run it, it keeps printing out "Robot drive... Output not updated often enough" Is there a way to fix this to run the vision code but not hang? Also, in case this matters, I'm calling it from a separate class

May I ask how did you get the hot target example code working? I'm still trying to figure out how to get vision code to work.

CarrotBlasphemy
15-02-2014, 10:54
I didn't do much, but so far I've only used the test images. But actually, I'm pretty sure I had to add something in there that printed out target.Hot. So I'm not sure why it's missed that section but I added it in and it seems to work

Tom Line
15-02-2014, 22:34
Do you a wait statement in your vision loop of perhaps 100 or 150 ms so that it allows your other code to get a shot at the cRIO's processor? If not, then the cRIO is running the vision code as fast as it can, your cpu is at 100% utilization, and your other code isn't having a chance to run in a timely manner.

Randaline
16-02-2014, 13:53
May I ask how did you get the hot target example code working? I'm still trying to figure out how to get vision code to work.

You're not alone :p our team's been using the example vision code and have gotten it working, but it takes five seconds or longer, no matter what we change. It's a problem considering the hot goals change within 5 seconds...:p

Sparkyshires
16-02-2014, 14:49
You're not alone :p our team's been using the example vision code and have gotten it working, but it takes five seconds or longer, no matter what we change. It's a problem considering the hot goals change within 5 seconds...:p

We were running into the same problem, but think we've got it working. What language and camera are you using? We're using the m1011 and C++ and what we found is that you have to initialize the camera outside of the autonomous loop, else the camera won't begin the startup sequence until you enable autonomous. If you place static AxisCamera *camera;
right after the #define's, and delete the other declaration thats right inside the autonomous loop, that should help a bit.

Also, to OP: try decreasing the fps. We found that 4 or 5 fps is more than enough, but it tries to default to something crazy like 30.

Sparkyshires
16-02-2014, 14:51
CarrotBlasphemy - that has to do with your robotDrive instance is not getting motor values. Make sure that everywhere in the code, you're sending drive values. Or if your using custom drive code, then that would also throw an issue.

Tom Line
16-02-2014, 17:33
It would also help if we knew what language you were using.

mwtidd
16-02-2014, 17:38
We found this too. We were using iterative robot. We did two things to make this easier on the crio. The first is to only call vision calls every n loops (we use 10). The second is not to use the area filter but rather a particle width filter:

cc.addCriteria(NIVision.MeasurementType.IMAQ_MT_BO UNDING_RECT_WIDTH, 8, 65535, false);

We were 100% at week zero at detecting hot correctly.