|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Vision Tracking Help
Greg, the images are 320 x 240 and I really only want to process one image. Shouldn't this code only be processing one image per trigger pull? It is now getting the images and giving a distance but once I pull the trigger it keeps giving me new images and never makes it to the second frame of the flat sequence structure. Also, the probe on button 1 will say "TRUE" momentarily when I pull the trigger before all of the probes that I'm running switch to "Not Executed." Also worth noting, the cRIO usage on the DS spikes to 100% when attempting to run vision. Anything you can think of so that I only get one image when i pull the trigger?
|
|
#2
|
|||||
|
|||||
|
Re: Vision Tracking Help
Quote:
Your loop in the second frame has no delays and is going to use up as many CPU cycles as it can, so that would explain the 100% usage -- but only if the sequence advanced to that frame. |
|
#3
|
|||
|
|||
|
Re: Vision Tracking Help
Alan, the SubVI in the first frame is the Rectangular Target-2013 VI found in the example code. And for whatever reason, it is taking multiple images and never advancing to the second frame.
|
|
#4
|
|||||
|
|||||
|
Re: Vision Tracking Help
Take a look at the bottom right corner of the Rectangular Target -2013.vi block diagram. It's a neverending While loop. It is designed to continuously process images and place the results on its front panel for display purposes.
It's also designed to run on the PC, not on the cRIO. You probably want the Vision Processing.vi instead. It too is a neverending While loop, but it only reads images and processes them when the Enable Vision global variable is True. I don't think it would be too difficult to make it disable itself after a single iteration -- just set the variable False inside the case that runs when it's True (preferably after the Target Info global has been set). Call Vision Processing from Robot Main where the default project has it, and communicate with it using the globals. |
|
#5
|
|||
|
|||
|
Re: Vision Tracking Help
Thanks for the help Alan. I'll give this a try this afternoon and see if it works for me.
|
|
#6
|
|||
|
|||
|
Re: Vision Tracking Help
Alan, I switched to doing the vision processing on the dashboard. In order to get just one image, I set it so that the Loop Iteration > 1, sends true to the loop condition which is stop if true. If the iteration < 1, it sends false to the loop condition. Unless I am mistaken, this should only analyze one image every time the loop runs, correct? I am also using smart dashboard variables to send the distance from Target Info[0] to the cRIO when I press button 1 on the joystick. I think I need a SD variable to send this to the dashboard also but it didn't appear to be working. For whatever reason, the cRIO keeps freezing up when i press that button.
|
|
#7
|
|||
|
|||
|
Re: Vision Tracking Help
Alan, I switched to doing the vision processing on the dashboard. In order to get just one image, I set it so that the Loop Iteration > 1, sends true to the loop condition which is stop if true. If the iteration < 1, it sends false to the loop condition. Unless I am mistaken, this should only analyze one image every time the loop runs, correct? I am also using smart dashboard variables to send the distance from Target Info[0] to the cRIO when I press button 1 on the joystick. I think I need a SD variable to send this to the dashboard also but it didn't appear to be working. For whatever reason, the cRIO CPU usage spikes when I press that button.
|
|
#8
|
|||||
|
|||||
|
Re: Vision Tracking Help
Quote:
Since you've abandoned the easily-controlled cRIO code, the small modification I would suggest is to surround the actual vision processing functions with a Case block that 1) runs when a global boolean is set True, and 2) sets that boolean False when it runs. |
|
#9
|
|||
|
|||
|
Re: Vision Tracking Help
Well, I was able to get it running on the dashboard, but i really only need the distance occasionally. Would my PID code still work if the distance is constantly changing? How would you go about implementing the code if it were for your robot?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|