Go to Post Having a spare arm that you can put on in 5 minutes or less intimidates the hardware into not breaking. - ChrisH [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 26-03-2013, 10:14
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 325
fovea1959 will become famous soon enough
Updating the Dashboard

probably moving from LV to Java for 2014, starting to think about how we did some things in LV, and what the corresponding analogs in Java would be. Can't start slinging code for a while, no cRIOs to practice with (all are on bots), so asking questions right now instead of trying.

If one has put together a command based Java robot, and one wants to have continuous updates in the dashboard of critical sensors, is creating and scheduling a TimerTask to do the updates a good practice? I'm looking at Frog Force' 2013 code:

Code:
    private static final TimerTask SpeedTask = new TimerTask(){
        // ..
        public void run() {
            if(isOn()&& DriverStation.getInstance().isEnabled()){
                SmartDashboard.putNumber("Shooter Output", output);
                SmartDashboard.putNumber("gear tooth speed graph", speed);
                SmartDashboard.putNumber("gear tooth speed view", speed);
                // ...
            }
        }        
    };
    
    private static final long SPEED_TASK_PERIOD = 60;
    private static final Timer timer = new Timer();

    static{
        timer.schedule(SpeedTask, 0, SPEED_TASK_PERIOD);
    }
Are there alternative practices?
Reply With Quote
 


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 08:39.

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