View Single Post
  #12   Spotlight this post!  
Unread 07-03-2012, 01:43
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Camera code stops recieving images

Okay, then the most logical explanation is that your reports->size() sometimes gives you zero, meaning that it can't find any target. In that case, your reference to particle 0 "reports->at(highParticle).center_mass_x_normalized;" will fault. To prove this, add something like this to your code. By switching this code, you will print out size() before you execute that centerX line that will fault. I'd bet, size() is zero.
Code:
numTargets = reports->size();
dsLCD->Clear();
dsLCD->Printf(DriverStationLCD::kUser_Line1, 1, "report width %d", convexHullImage->GetWidth());
 
//fix so is based on score
dsLCD->Printf(DriverStationLCD::kUser_Line2, 1, "size %d", reports->size());
dsLCD->UpdateLCD();
centerX = reports->at(highParticle).center_mass_x_normalized;
dsLCD->Printf(DriverStationLCD::kUser_Line3, 1, "center x %f", centerX);
dsLCD->UpdateLCD();
__________________
Reply With Quote