Go to Post You have not only joined a robotic competition, you will discover that you are becoming a member of a very large and wonderful family. The more years that you participate, the larger your FIRST family will become. - Car Nack [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-03-2016, 22:10
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:	98
Size:	65.0 KB
ID:	20244  
Reply With Quote
  #2   Spotlight this post!  
Unread 06-03-2016, 13:56
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: SmartDashboard Variable Not Updating...Sometimes

I have seen something similar to this, with a LabVIEW dashboard sending to a java robot. However, it only occurs after a long time (10s of minutes) and only affects variables being written frequently. We changed our dashboard to only write if the new value is different then the previous value, and the problem has effectively gone away.

I haven't been able to duplicate in a clean environment, yet (eg minimal code with a good connection), I've only seen it over wireless with full robot code and dashboard.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-04-2016, 22:33
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
Re: SmartDashboard Variable Not Updating...Sometimes

As to avoid


Here's the answer:

Quote:
To ensure that the SmartDashboard and TableViewer are showing exactly the same values, it is necessary to restart all of them at the same time. That way, old values that one is holding won't get replicated to the others.
If you restart robot code and not the dashboard, you will need to restart the dashboard too if this happens.

https://wpilib.screenstepslive.com/s...smartdashboard

Last edited by MikeF1617 : 20-04-2016 at 22:36. Reason: Bold things for effect
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:15.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi