Go to Post You need a good BAD (*BAD = Ball Acquisition Device) - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 02-02-2015, 15:46
Emeralddragon Emeralddragon is offline
Registered User
AKA: Jonathan C.
FRC #4509 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2012
Location: Sugarhill, ga
Posts: 8
Emeralddragon is an unknown quantity at this point
DriverstationLCD

What all happened to the diverstationLCD. What did it get replaced by?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2015, 16:15
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: DriverstationLCD

Its function is taken over by Smart Dashboard variables and the Basic tab on the Dashboard.

http://wpilib.screenstepslive.com/s/...iverStationLCD
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2015, 20:01
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 468
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: DriverstationLCD

Quote:
Originally Posted by Alan Anderson View Post
Its function is taken over by Smart Dashboard variables and the Basic tab on the Dashboard.

http://wpilib.screenstepslive.com/s/...iverStationLCD
Alan is spot-on with his response that the DriverStationLCD has been removed in favor of instead using the SmartDashboard.

As a beta test team, we implemented a temporary workaround during the beta testing by updating the old control system's DriverStationLCD class, as it was far easier to port our 2014 robot code (which made heavy use of DriverStationLCD) to the new control system without having to convert all of our DriverStationLCD usage to SmartDashboard. However, our code won't be particularly helpful to you directly, as we are using Java. What more, we never intended for our implementation of DriverStationLCD.java to be anything other than a short-term temporary solution (for the 2015 robot, we are using the SmartDashboard exclusively), so it doesn't worry about being efficient -- rather, it is actually quite inefficient, printing out the buffers one character at a time. Yet, just in case it is of help to you or other teams, I have attached our "DriverStationLCD.java" that we used during beta testing. I should also add the disclaimer that I haven't tried this "DriverStationLCD.java" with the 2015 release, so it is possible (although unlikely) that something changed that makes it no longer work.

Also, during the beta testing, team 1511, which was using C++ had shared their DriverStationLCD.cpp and DriverStationLCD.h with us -- Jeff Downs of 1511 previously posted a link to their code here: http://www.chiefdelphi.com/forums/sh...67&postcount=5

Code:
DriverStationLCD.java

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2012. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package org.mayheminc.util;

import edu.wpi.first.wpilibj.SensorBase;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/*
import edu.wpi.first.wpilibj.communication.FRCControl;
import edu.wpi.first.wpilibj.communication.UsageReporting;
import edu.wpi.first.wpilibj.parsing.IInputOutput;
*/

/**
 * Provide access to "LCD" on the Driver Station.
 * This is the Messages box on the DS Operation tab. 
 *
 * Buffer the printed data locally and then send it
 * when UpdateLCD is called.
 */
public class DriverStationLCD extends SensorBase {

    private static DriverStationLCD m_instance;
    /**
     * Driver station timeout in milliseconds
     */
    public static final int kSyncTimeout_ms = 20;
    /**
     * Command to display text
     */
    public static final int kFullDisplayTextCommand = 0x9FFF;
    /**
     * Maximum line length for Driver Station display
     */
    public static final int kLineLength = 21;
    /**
     * Total number of lines available
     */
    public static final int kNumLines = 10;
    
    /**
     * Total number of characters needed for all lines
     */
    public static final int kTextBuffer = kNumLines * kLineLength;
    
    public static final String LINE_KEYS[] = {
    	"String 0", 	//"DB/String 0",
    	"String 1",		//"DB/String 1",
    	"String 2",		//"DB/String 2",
    	"String 3",    	//"DB/String 3",
    	"String 4", 	//"DB/String 4",
    	"String 5", 	//"DB/String 5",
    	"String 6", 	//"DB/String 6",
    	"String 7", 	//"DB/String 7",
    	"String 8", 	//"DB/String 8",
    	"String 9" 		//"DB/String 9",
    };
    
    /**
     * The line number on the Driver Station LCD
     */
    public static class Line {

        /**
         * The integer value representing this enumeration
         */
        public final int value;
        static final int kUser1_val = 0;
        static final int kUser2_val = 1;
        static final int kUser3_val = 2;
        static final int kUser4_val = 3;
        static final int kUser5_val = 4;
        static final int kUser6_val = 5;
        static final int kUser7_val = 6;
        static final int kUser8_val = 7;
        static final int kUser9_val = 8;
        static final int kUser10_val = 9;
        
        /**
         * Lines on the left side of default dashboard
         */
        public static final Line kUser1 = new Line(kUser1_val);
        public static final Line kUser2 = new Line(kUser2_val);
        public static final Line kUser3 = new Line(kUser3_val);
        public static final Line kUser4 = new Line(kUser4_val);
        public static final Line kUser5 = new Line(kUser5_val);
        
        /**
         * Lines on right side of default dashboard
         */
        public static final Line kUser6 = new Line(kUser6_val);
        public static final Line kUser7 = new Line(kUser7_val);
        public static final Line kUser8 = new Line(kUser8_val);
        public static final Line kUser9 = new Line(kUser9_val);
        public static final Line kUser10 = new Line(kUser10_val);
        
        private Line(int value) {
            this.value = value;
        }
    }
    
    StringBuffer[] m_textBuffer = new StringBuffer[kNumLines];

    /**
     * Get an instance of the DriverStationLCD
     * @return an instance of the DriverStationLCD
     */
    public static synchronized DriverStationLCD getInstance() {
        if (m_instance == null)
            m_instance = new DriverStationLCD();
        return m_instance;
    }

    /**
     * DriverStationLCD constructor.
     *
     * This is only called once the first time GetInstance() is called
     */
    private DriverStationLCD() {

        for (int i=0; i < kNumLines; i++) {
        	m_textBuffer[i] = new StringBuffer("                      ");   
    	}
    }

    /**
     * Send the text data to the Driver Station.
     */
    public synchronized void updateLCD() {
    	
    	for (int i = 0; i < kNumLines; ++i) {
			SmartDashboard.putString( LINE_KEYS[i], m_textBuffer[i].toString());
    	}
    }

    /**
     * Print formatted text to the Driver Station LCD text buffer.
     *
     * Use UpdateLCD() periodically to actually send the test to the Driver Station.
     *
     * @param line The line on the LCD to print to.
     * @param startingColumn The column to start printing to.  This is a 1-based number.
     * @param text the text to print
     */
    public void println(Line line, int startingColumn, String text) {
        int start = startingColumn - 1;
        int maxLength = kLineLength - start;

        if (startingColumn < 1 || startingColumn > kLineLength) {
            throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
        }

        int length = text.length();
        int finalLength = (length < maxLength ? length : maxLength);
        synchronized (this) {
            for (int i = 0; i < finalLength; i++) {
                m_textBuffer[line.value].setCharAt((i + start), text.charAt(i));  
            }
        }
    }

    /**
     * Print formatted text to the Driver Station LCD text buffer.
     *
     * Use UpdateLCD() periodically to actually send the test to the Driver Station.
     *
     * @param line The line on the LCD to print to.
     * @param startingColumn The column to start printing to.  This is a 1-based number.
     * @param text the text to print
     */
    public void println(Line line, int startingColumn, StringBuffer text) {
        int start = startingColumn - 1;
        int maxLength = kLineLength - start;

        if (startingColumn < 1 || startingColumn > kLineLength) {
            throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
        }

        int length = text.length();
        int finalLength = (length < maxLength ? length : maxLength);
        synchronized (this) {
            for (int i = 0; i < finalLength; i++) {
                m_textBuffer[line.value].setCharAt((i + start), text.charAt(i));  
            }
        }
    } 
    
    
    /**
     * Clear User Messages box on DS Operations Tab
     * 
     * This method will clear all text currently displayed in the message box
     */
    public void clear() {
        synchronized (this) {
            for (int i=0; i < kNumLines; i++) {
            	for (int j=0; j < kLineLength; j++) {
            		m_textBuffer[i].setCharAt(j, ' ');
            	}        
        	}
        }
        updateLCD();
    }
}
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"

Last edited by Ken Streeter : 02-02-2015 at 20:30.
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 02:43.

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