Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.usfirst.frc.team199.Robot2018;

import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
* Directly copied from Robot2017 - @kevinzwang
*/

public interface DashboardInterface {

/**
* Puts all desired data on SmartDashboard
*/
public default void displayData() {

}

/*
* Methods for displaying values with modified keys
*/
default void putNumber(String key, double value) {
SmartDashboard.putNumber(getKey(key), value);
}

default void putBoolean(String key, boolean value) {
SmartDashboard.putBoolean(getKey(key), value);
}

default void putString(String key, String value) {
SmartDashboard.putString(getKey(key), value);
}

default void putSendable(String key, Sendable value) {
SmartDashboard.putData(getKey(key), value);
}

/*
* Methods for reading numbers, without specifying the modified key
*/
default double getNumber(String key, double defaultValue) {
return SmartDashboard.getNumber(getKey(key), defaultValue);
}

default boolean getBoolean(String key, boolean defaultValue) {
return SmartDashboard.getBoolean(getKey(key), defaultValue);
}

default String getString(String key, String defaultValue) {
return SmartDashboard.getString(getKey(key), defaultValue);
}

default double[] getNumArray(String key, double[] defaultValue) {
return SmartDashboard.getNumberArray(getKey(key), defaultValue);
}

/**
* Converts the specified display key into one with its subsystem name appended
* as a prefix, to be compatible with the Subsystem widget on SmartDashboard for
* organizational purposes
*
* @param key The name of the original key
* @return A modified key with prefix subsystem name
*/
default String getKey(String key) {
return getClass().getSimpleName() + "/" + key;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package org.usfirst.frc.team199.Robot2018.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
* Initially run during Auto. Responsible for getting input from SmartDashboard
* and the FMS, and then calling RunAuto with the specified script.
*/
public class Autonomous extends CommandGroup implements AutonomousInterface {

public Autonomous() {
// TODO

// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.

// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.

// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}

/**
* {@inheritDoc}
*/
@Override
public Position getStartingPos() {
// TODO
return null;
}

/**
* {@inheritDoc}
*/
@Override
public Strategy[] getStrategies() {
// TODO
return null;
}

/**
* {@inheritDoc}
*/
@Override
public double getDelay() {
// TODO
return 0;
}

/**
* {@inheritDoc}
*/
@Override
public String pickScript() {
// TODO
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.usfirst.frc.team199.Robot2018.commands;

import org.usfirst.frc.team199.Robot2018.DashboardInterface;

import edu.wpi.first.wpilibj.DriverStation;

public interface AutonomousInterface extends DashboardInterface{
public enum Position {
LEFT,
CENTER,
RIGHT
}

public enum Strategy {
AUTO_LINE,
SWITCH,
SCALE,
EXCHANGE,
SWITCH_SCALE,
SWITCH_EXCHANGE,
NOTHING
}

/**
* Gets the starting position set in SmartDashboard
*
* @return an enum for the starting position
*/
public Position getStartingPos();

/**
* Gets the four strategies set in SmartDashboard
*
* @return 4 strategies, in the order of (Switch + Scale ): LL, LR, RR, RL
*/
public Strategy[] getStrategies();

/**
* Gets delay before running the specified script set in SmartDashboard
*
* @return delay in seconds
*/
public double getDelay();

/**
* Directly gets the string from FMS
*
* @return FMS data
*/
default String getFMS() {
return DriverStation.getInstance().getGameSpecificMessage();
}

/**
* Pick the script to run for Autonomous
*
* @return A String representing the name of the script
*/
public String pickScript();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.usfirst.frc.team199.Robot2018.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
* Gets the script name and runs the script.
*/
public class RunScript extends CommandGroup implements RunScriptInterface {

public RunScript(String scriptName) {
// TODO

// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.

// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.

// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.usfirst.frc.team199.Robot2018.commands;

public interface RunScriptInterface {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.usfirst.frc.team199.Robot2018.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
* Used for testing the autonomous interfaces. Runs the script specified in
* SmartDashboard
*/
public class TestAuto extends CommandGroup implements TestAutoInterface {

public TestAuto() {
// TODO

// Add Commands here:
// e.g. addSequential(new Command1());
// addSequential(new Command2());
// these will run in order.

// To run multiple commands at the same time,
// use addParallel()
// e.g. addParallel(new Command1());
// addSequential(new Command2());
// Command1 and Command2 will run in parallel.

// A command group will require all of the subsystems that each member
// would require.
// e.g. if Command1 requires chassis, and Command2 requires arm,
// a CommandGroup containing them would require both the chassis and the
// arm.
}

/**
* {@inheritDoc}
*/
@Override
public String getScriptToTest() {
// TODO
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.usfirst.frc.team199.Robot2018.commands;

import org.usfirst.frc.team199.Robot2018.DashboardInterface;

public interface TestAutoInterface extends DashboardInterface {
/**
* gets the script name that we want to run from SmartDashboard
*
* @return the script name
*/
public String getScriptToTest();
}