|
Re: No robot code after running for a while (Java VM ran out of memory)
Our vision targeting module is doing its work in a separate thread processing each video frame. It saves the processing result away for the main robot thread to retrieve when it needs the target info. Part of the processing result is the filtered image. Since the processed image is saved away for the main robot thread to access later, the vision task thread allocated another frame buffer for capturing and processing the next frame. That's the problematic allocation. We looked closer on why we need to save away the processed frame and discovered it used the frame to determine the distance to the tote (sample vision code from WPI). Looking further, the method that needs the processed image is to determine the image size. In particular, just the image width. Therefore, we can easily determine the image size right after processing the image and just save away the image size instead of passing along the entire image frame. Therefore, we no longer need to allocate another frame buffer for processing the next frame. Just re-use the previous buffer.
__________________
|