View Single Post
  #5   Spotlight this post!  
Unread 24-01-2016, 17:14
ahartnet's Avatar
ahartnet ahartnet is offline
Registered User
AKA: Andrew Hartnett
FRC #5414 (Pearadox)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2005
Location: Houston, Texas
Posts: 194
ahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant futureahartnet has a brilliant future
Re: Robot preferences help

d'oh! That was at least part of the problem.

Still having some issues that might be related to the scope or static-ness of the variable. For some reason in order to acces it in a different class, the code wants us to make it static.

Code:
public static double speed;

public void disabledInit(){
        prefs = Preferences.getInstance();
    	speed = prefs.getDouble("speed", 0.0);    
	SmartDashboard.putNumber("Pref speed", speed);
    }
Code:
     
	SmartDashboard.putNumber("Pref speed in different class", Robot.speed);
In smart dashboard we'll get
"Pref speed": # (this updates appropriately when we disable)
"Pref speed in different class": 0.0 (this stays at whatever we initially set it to no matter what this doesnt surprise me because it's declared as static).

Thanks for all the help so far.
__________________
Team 451 The Cat Attack, Student Alumni (2005)
Team 1646 Precision Guessworks, Mentor (2006-2008)
Team 2936 Gatorzillas, Mentor (2011-2014)
Team 5414 Pearadox, Mentor (2015-Present)
Reply With Quote