View Single Post
  #1   Spotlight this post!  
Unread 03-01-2016, 10:10 PM
MikeF1617 MikeF1617 is offline
Registered User
AKA: Michael Fischler
FRC #1124 (UberBots)
Team Role: Programmer
 
Join Date: Sep 2013
Rookie Year: 2013
Location: United States
Posts: 15
MikeF1617 is an unknown quantity at this point
Exclamation SmartDashboard Variable Not Updating...Sometimes

I have a LabVIEW dashboard running sending data to Java robot code. Most of the time it works, but sometimes the variable being read in the Java robot code as shown below stops updating and continues outputting the last value. If there is an exception, it should return -1, not the last value, so I'm not sure what's happening.

Code:
/** 
* Polls the target dimensions from the dashboard.
* If they are not present, it returns {-1, -1}.
*  
* @return an array of the {x center of mass, y center of mass}
* */
public double[] getTargetCenterOfMass(){
	double x = -1;
	double y = -1;
		
	try{
		x = SmartDashboard.getNumber("vision_target_x_cm");
		y = SmartDashboard.getNumber("vision_target_y_cm");
	}catch(Exception e){
		e.printStackTrace();
	}
	
	double data[] = {x, y};
	
	return data;
}
I attached a screenshot of the console where I was debugging our targeting when this started happening (and it has happened many times before, but only this season since we just started using Java this year).

I can see through the Network Variables tab on the LabVIEW dashboard that the values are indeed being updated, yet the Java SmartDashbord.getNumber() is not reflecting the changes. Sometimes disconnecting, waiting, and reconnecting to the robot fixes it. Other times I have to reboot the robot.

Does anyone know why this would happen?
Thanks in advance.
Attached Thumbnails
Click image for larger version

Name:	CD_bug.png
Views:	97
Size:	65.0 KB
ID:	20244  
Reply With Quote