View Single Post
  #13   Spotlight this post!  
Unread 29-01-2013, 23:19
Justin m's Avatar
Justin m Justin m is offline
Registered User
FRC #2028 (Phantom Mentalists)
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Hampton, va
Posts: 14
Justin m is an unknown quantity at this point
Re: Java Custom Dashboard Difficulties

I am one of the programmers on my team, and it has become my little project to create a custom dashboard, using SmartDashboard. We use java to program our robot, and although I have compiled and run the code, the dashboard does not see the info., even though I loaded the smart dash board in the Driver Station. Here is what I have so far, for testing purposes.
Code:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.PhoebusHighSchool.PhoebusRobotics.UltimateAscent;

import edu.wpi.first.wpilibj.NamedSendable;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;

/**
 *
 * @author jmiller015
 */
public class DriverStation
{
    UltimateAscentBot robot;
    SmartDashboard dash; 
    
    /**
     * DriverStation
     * 
     * This constructor initializes the DriverStation and gives it an
     * UltimateAscentBot
     * 
     * @param bot 
     */
    public DriverStation(UltimateAscentBot bot)
    {
        robot = bot;
        dash = new SmartDashboard();
    }
    
    
    /**
     * updateDashboard()
     * 
     * This method will update the Driver Station to the current values for 
     * the # of discs, true/false shooter ready, distance to target, 
     * degrees to target.
     */
    public void updateDashboard()
    {
        dash.putNumber("Discs Remaining", robot.getDiscCount());
        dash.putBoolean("Shooter Ready", robot.isShooterCocked());
        dash.putNumber("Distance to target", robot.getDistanceToTarget());
        dash.putNumber("Degrees to target", robot.getDegreesToTarget());
    }
           
    
}
Reply With Quote