![]() |
Robot preferences help
Hi
We're trying to get the robot preferences to work. We followed the example on the screen steps page (http://wpilib.screenstepslive.com/s/...martdashboard), but are confused with a number of things. We're doing command based programming in Java. 1) should this go in the robot init like in the example? Doesn't that mean you need to reboot the Rio every time you change the file? 2) we can't seem to get anything to show up in the preferences. The things that I have found in the forums are a couple of years old so I'm not sure if it's changed. 3) if we create a key in the preferences table that doesn't exist in the code does that have any impact? 4) we trying declaring the variables as public in our robot.java but while in other commands or subsystems it doesn't seem like we could use them. Is there something I'm missing there? Thanks for any help! Andrew |
Re: Robot preferences help
Quote:
Quote:
Quote:
Quote:
|
Re: Robot preferences help
Thanks for the suggestions! I like putting it into the disabledInit() function.
Still having some problems though. Code:
public class Robot extends IterativeRobot {Code:
value = Robot.speed;Any suggestions? |
Re: Robot preferences help
in addition to declaring
Code:
Preferences prefs;Code:
prefs = Preferences.getInstance(); |
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;Code:
"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. |
Re: Robot preferences help
Alright, I think we have it figured out enough for how we'll use it. I think the issue is that we were trying to send the value into a function in a command group for autonomous. When we try to just read it in our teleop mode, we don't have the same problem. It's weird, but I think we can work around it.
If anyone else has a similar issue, for our command based programming we did still have to declare are variable in Robot class as: public static double speed; My suspicion is that it has to do with being used in a command group. When a new command group was made for our sendableChooser, it must poll what that variable is at that point in time. Then when that command group is called later, it must not look at if the variable has changed. Thanks! |
| All times are GMT -5. The time now is 10:18. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi