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
Show all changes
42 commits
Select commit Hold shift + click to select a range
f24457b
removed autonomous stuff
kevinzwang Jan 15, 2018
4e54b1c
force the branch to not include autonomous code
kevinzwang Jan 15, 2018
e0c0cfa
First commit of DavidRobot2018 (#5)
dfang314 Jan 15, 2018
dbf634b
Finished initialization of RobotMap, finished getting Drivetrain to i…
dfang314 Jan 15, 2018
1b3045f
Merge pull request #18 from doawelul/testing-no-auto
kevinzwang Jan 15, 2018
a7f9146
:sweatsmile: fixed initialization in robotMap for moveController
dfang314 Jan 15, 2018
e610d3c
organized smartdashboard keys
dfang314 Jan 15, 2018
cf97abb
Merge remote-tracking branch 'upstream/testing-no-auto' into testing-…
dfang314 Jan 15, 2018
8183e18
fixed convoluted code in Robot for boolean preferences and fixed an i…
dfang314 Jan 18, 2018
e81583c
Moved magic activation time numbers to SmartDashboard
dfang314 Jan 18, 2018
fee15e9
changed setDistancePerPulse in Drivetrain to current standard
dfang314 Jan 18, 2018
e55f737
made buttons private as per request by dean and fixed getButton
dfang314 Jan 19, 2018
45465e9
finished adding javadoc, fixed getPort, and fixed default port values…
dfang314 Jan 19, 2018
f09460b
bugfix in shiftDriveType
dfang314 Jan 19, 2018
3e21592
added javadoc and clearer names for shifting drivetrain gear
dfang314 Jan 19, 2018
82a0615
added javadoc and removed extraneous methods in drivetrain
dfang314 Jan 19, 2018
88efe63
added end() to the interrupted() in the commands as per request
dfang314 Jan 19, 2018
ae89def
removed extra comments and variables in drivetrain
dfang314 Jan 19, 2018
344904a
cleaned imports in oi and added update pid constants functionality
dfang314 Jan 19, 2018
99141aa
implemented realtime distperpulse update
dfang314 Jan 20, 2018
b21e3f1
changed setSetpoint methods' names
dfang314 Jan 20, 2018
2e48242
whoops forgot this file :)
dfang314 Jan 20, 2018
4090b5b
moved initDefaultCommand to top of drivetrain as per request
dfang314 Jan 20, 2018
02439d7
consistency
dfang314 Jan 20, 2018
72e7eb5
more consistent naming and being to port libraries to project
dfang314 Jan 20, 2018
bcb70aa
Removed old USER_LIBS from classpath
dfang314 Jan 20, 2018
a778e54
finished porting jars
dfang314 Jan 20, 2018
848a8eb
Merge pull request #19 from doawelul/testing-no-auto
lhmcgann Jan 20, 2018
6710863
changed slave controllers to VictorSPX
dfang314 Jan 20, 2018
5c362c1
Merge remote-tracking branch 'blue/testing-no-auto' into HEAD
dfang314 Jan 20, 2018
655e536
added buttons to test PID
dfang314 Jan 20, 2018
52b441e
classpath change
lhmcgann Jan 21, 2018
393d31c
Merge remote-tracking branch 'blue/testing-no-auto' into testing-no-auto
dfang314 Jan 21, 2018
c7a5809
Formatted commands and added infra to test
dfang314 Jan 21, 2018
447e316
whoops inserted in wrong place
dfang314 Jan 21, 2018
bb2069d
added listener (hopefully)
dfang314 Jan 21, 2018
532bc10
Merge pull request #26 from doawelul/testing-no-auto
lhmcgann Jan 21, 2018
76af151
changed getGyro to getGyroAngle per request
dfang314 Jan 25, 2018
4930d79
changed moveControllers to 2: one for each side of the dt. NOTICE: tu…
dfang314 Jan 25, 2018
6d43455
changed shiftddrivetype to an instantcommand
dfang314 Jan 25, 2018
72c2b79
velocityPIDController class(es) and attempted tests
lhmcgann Jan 27, 2018
403f9f5
Merge branch 'testing-no-auto' of
lhmcgann Jan 27, 2018
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ bin/
build/
dist/
.DS_Store
*auto*
*Auto*
14 changes: 14 additions & 0 deletions Robot2018/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,19 @@
<classpathentry kind="lib" path="lib/mockito-core-2.13.3.jar"/>
<classpathentry kind="lib" path="lib/byte-buddy-1.7.9.jar"/>
<classpathentry kind="lib" path="lib/objenesis-2.6.jar"/>
<classpathentry kind="lib" path="lib/CTRE_Phoenix-sources.jar"/>
<classpathentry kind="lib" path="lib/CTRE_Phoenix.jar"/>

<classpathentry kind="lib" path="lib/cscore-sources.jar"/>
<classpathentry kind="lib" path="lib/cscore.jar"/>
<classpathentry kind="lib" path="lib/navx_frc.jar"/>
<classpathentry kind="lib" path="lib/ntcore-sources.jar"/>
<classpathentry kind="lib" path="lib/ntcore.jar"/>
<classpathentry kind="lib" path="lib/opencv-sources.jar"/>
<classpathentry kind="lib" path="lib/opencv.jar"/>
<classpathentry kind="lib" path="lib/WPILib-sources.jar"/>
<classpathentry kind="lib" path="lib/WPILib.jar"/>
<classpathentry kind="lib" path="lib/wpiutil-sources.jar"/>
<classpathentry kind="lib" path="lib/wpiutil.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file added Robot2018/lib/CTRE_Phoenix-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/CTRE_Phoenix.jar
Binary file not shown.
Binary file added Robot2018/lib/WPILib-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/WPILib.jar
Binary file not shown.
Binary file added Robot2018/lib/cscore-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/cscore.jar
Binary file not shown.
Binary file added Robot2018/lib/navx_frc.jar
Binary file not shown.
Binary file added Robot2018/lib/ntcore-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/ntcore.jar
Binary file not shown.
Binary file added Robot2018/lib/opencv-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/opencv.jar
Binary file not shown.
Binary file added Robot2018/lib/wpiutil-sources.jar
Binary file not shown.
Binary file added Robot2018/lib/wpiutil.jar
Binary file not shown.
52 changes: 52 additions & 0 deletions Robot2018/src/org/usfirst/frc/team199/Robot2018/Listener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.usfirst.frc.team199.Robot2018;

import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse;
import org.usfirst.frc.team199.Robot2018.commands.UpdatePIDConstants;

import edu.wpi.first.networktables.EntryListenerFlags;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableValue;
import edu.wpi.first.networktables.TableEntryListener;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Scheduler;

public class Listener implements TableEntryListener {

private void addCommand(Command com) {
Scheduler.getInstance().add(com);
}

@Override
public void valueChanged(NetworkTable arg0, String arg1, NetworkTableEntry arg2, NetworkTableValue arg3, int arg4) {
if(arg4 == EntryListenerFlags.kNew) return;
switch (arg1) {
case "Const/Distance Per Pulse Left":
addCommand(new SetDistancePerPulse());
break;
case "Const/Distance Per Pulse Right":
addCommand(new SetDistancePerPulse());
break;
case "Const/TurnkP":
addCommand(new UpdatePIDConstants());
break;
case "Const/TurnkI":
addCommand(new UpdatePIDConstants());
break;
case "Const/TurnkD":
addCommand(new UpdatePIDConstants());
break;
case "Const/MovekP":
addCommand(new UpdatePIDConstants());
break;
case "Const/MovekI":
addCommand(new UpdatePIDConstants());
break;
case "Const/MovekD":
addCommand(new UpdatePIDConstants());
break;

}
}

}
59 changes: 58 additions & 1 deletion Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. 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.usfirst.frc.team199.Robot2018;

import edu.wpi.first.wpilibj.buttons.Button;
import org.usfirst.frc.team199.Robot2018.commands.PIDMove;
import org.usfirst.frc.team199.Robot2018.commands.PIDTurn;
import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse;
import org.usfirst.frc.team199.Robot2018.commands.ShiftDriveType;
import org.usfirst.frc.team199.Robot2018.commands.ShiftHighGear;
import org.usfirst.frc.team199.Robot2018.commands.ShiftLowGear;
import org.usfirst.frc.team199.Robot2018.commands.UpdatePIDConstants;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
* This class is the glue that binds the controls on the physical operator
Expand Down Expand Up @@ -34,4 +51,44 @@ public class OI {
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());

public Joystick leftJoy;
private JoystickButton shiftLowGear;
private JoystickButton shiftHighGear;
private JoystickButton shiftDriveType;
private JoystickButton PIDMove;
private JoystickButton PIDTurn;
public Joystick rightJoy;
private JoystickButton updatePidConstants;
private JoystickButton updateEncoderDPP;
public Joystick manipulator;

public int getButton(String key, int def) {
if (!SmartDashboard.containsKey("Button/" + key)) {
SmartDashboard.putNumber("Button/" + key, def);
}
return (int) SmartDashboard.getNumber("Button/" + key, def);
}

public OI() {
leftJoy = new Joystick(0);
shiftLowGear = new JoystickButton(leftJoy, getButton("Shift Low Gear", 3));
shiftLowGear.whenPressed(new ShiftLowGear());
shiftHighGear = new JoystickButton(leftJoy, getButton("Shift High Gear", 5));
shiftHighGear.whenPressed(new ShiftHighGear());
shiftDriveType = new JoystickButton(leftJoy, getButton("Shift Drive Type", 2));
shiftDriveType.whenPressed(new ShiftDriveType());
PIDMove = new JoystickButton(leftJoy, getButton("PID Move", 7));
PIDMove.whenPressed(new PIDMove(40, Robot.dt));
PIDTurn = new JoystickButton(leftJoy, getButton("PID Turn", 8));
PIDTurn.whenPressed(new PIDTurn(30, Robot.dt));

rightJoy = new Joystick(1);
updatePidConstants = new JoystickButton(rightJoy, getButton("Get PID Constants", 8));
updatePidConstants.whenPressed(new UpdatePIDConstants());
updateEncoderDPP = new JoystickButton(rightJoy, getButton("Get Encoder Dist Per Pulse", 9));
updateEncoderDPP.whenPressed(new SetDistancePerPulse());

manipulator = new Joystick(2);
}
}
74 changes: 52 additions & 22 deletions Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

import org.usfirst.frc.team199.Robot2018.subsystems.Climber;
import org.usfirst.frc.team199.Robot2018.subsystems.ClimberAssist;
import org.usfirst.frc.team199.Robot2018.subsystems.Drivetrain;
import org.usfirst.frc.team199.Robot2018.subsystems.IntakeEject;
import org.usfirst.frc.team199.Robot2018.subsystems.LeftDrive;
import org.usfirst.frc.team199.Robot2018.subsystems.Lift;
import org.usfirst.frc.team199.Robot2018.subsystems.RightDrive;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

Expand All @@ -22,31 +23,60 @@
* directory.
*/
public class Robot extends TimedRobot {

public static final Climber climber = new Climber();
public static final ClimberAssist climberAssist = new ClimberAssist();
public static final IntakeEject intakeEject = new IntakeEject();
public static final Lift lift = new Lift();

public static Climber climber;
public static ClimberAssist climberAssist;
public static IntakeEject intakeEject;
public static Lift lift;
public static RobotMap rmap;
public static Drivetrain dt;
public static LeftDrive ld;
public static RightDrive rd;
public static Listener listen;

public static OI oi;

Command autonomousCommand;
SendableChooser<Command> chooser = new SendableChooser<>();

public static double getConst(String key, double def) {
if (!SmartDashboard.containsKey("Const/" + key)) {
SmartDashboard.putNumber("Const/" + key, def);
}
return SmartDashboard.getNumber("Const/" + key, def);
}

public static boolean getBool(String key, boolean def) {
if (!SmartDashboard.containsKey("Bool/" + key)) {
SmartDashboard.putBoolean("Bool/" + key, def);
}
return SmartDashboard.getBoolean("Bool/" + key, def);
}

/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
* This function is run when the robot is first started up and should be used
* for any initialization code.
*/
@Override
public void robotInit() {
rmap = new RobotMap();
climber = new Climber();
climberAssist = new ClimberAssist();
intakeEject = new IntakeEject();
lift = new Lift();
dt = new Drivetrain();
ld = new LeftDrive();
rd = new RightDrive();
oi = new OI();
listen = new Listener();
// chooser.addObject("My Auto", new MyAutoCommand());
SmartDashboard.putData("Auto mode", chooser);
}

/**
* This function is called once each time the robot enters Disabled mode.
* You can use it to reset any subsystem information you want to clear when
* the robot is disabled.
* This function is called once each time the robot enters Disabled mode. You
* can use it to reset any subsystem information you want to clear when the
* robot is disabled.
*/
@Override
public void disabledInit() {
Expand All @@ -60,24 +90,24 @@ public void disabledPeriodic() {

/**
* This autonomous (along with the chooser code above) shows how to select
* between different autonomous modes using the dashboard. The sendable
* chooser code works with the Java SmartDashboard. If you prefer the
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
* getString code to get the auto name from the text box below the Gyro
* between different autonomous modes using the dashboard. The sendable chooser
* code works with the Java SmartDashboard. If you prefer the LabVIEW Dashboard,
* remove all of the chooser code and uncomment the getString code to get the
* auto name from the text box below the Gyro
*
* You can add additional auto modes by adding additional commands to the
* chooser code above (like the commented example) or additional comparisons
* to the switch structure below with additional strings & commands.
* chooser code above (like the commented example) or additional comparisons to
* the switch structure below with additional strings & commands.
*/
@Override
public void autonomousInit() {
autonomousCommand = chooser.getSelected();

/*
* String autoSelected = SmartDashboard.getString("Auto Selector",
* "Default"); switch(autoSelected) { case "My Auto": autonomousCommand
* = new MyAutoCommand(); break; case "Default Auto": default:
* autonomousCommand = new ExampleCommand(); break; }
* String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
* switch(autoSelected) { case "My Auto": autonomousCommand = new
* MyAutoCommand(); break; case "Default Auto": default: autonomousCommand = new
* ExampleCommand(); break; }
*/

// schedule the autonomous command (example)
Expand Down
Loading