Skip to content

Commit

Permalink
Update 2018-compatible code
Browse files Browse the repository at this point in the history
  • Loading branch information
blai00 committed Jan 29, 2018
1 parent 4a30e03 commit bf869e0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/com/stuypulse/frc2017/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ private void setupSmartDashboardFields() {

}

// As of 2018, OrderedSendableChooser functionality has been affected
// due to the deprecation of "import edu.wpi.first.wpilibj.tables.ITable;
private void setupAutonChooser() {

autonChooser = new OrderedSendableChooser<Command>();
autonChooser.addObject("Do Nothing", new CommandGroup());
autonChooser.addObject("Minimal Mobility", new MobilityMinimalCommand());
Expand Down
35 changes: 32 additions & 3 deletions src/com/stuypulse/frc2017/util/OrderedSendableChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.tables.ITable;
Expand All @@ -35,6 +36,7 @@
* @param <V>
* The type of the values to be stored
*/

public class OrderedSendableChooser<V> implements Sendable {

/**
Expand Down Expand Up @@ -118,14 +120,12 @@ public V getSelected() {
return m_map.getOrDefault(selected, m_map.get(m_defaultChoice));
}

@Override
public String getSmartDashboardType() {
return "String Chooser";
}

private ITable m_table;

@Override
public void initTable(ITable table) {
m_table = table;
if (table != null) {
Expand All @@ -136,8 +136,37 @@ public void initTable(ITable table) {
}
}

@Override
public ITable getTable() {
return m_table;
}

@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}

@Override
public void setName(String name) {
// TODO Auto-generated method stub

}

@Override
public String getSubsystem() {
// TODO Auto-generated method stub
return null;
}

@Override
public void setSubsystem(String subsystem) {
// TODO Auto-generated method stub

}

@Override
public void initSendable(SendableBuilder builder) {
// TODO Auto-generated method stub

}
}

0 comments on commit bf869e0

Please sign in to comment.