Tune Shooter and Work on DriverStation

This commit is contained in:
Keenan D. Buckley
2020-03-11 08:26:27 -06:00
parent 7efbea847a
commit a1632fa688
5 changed files with 423 additions and 91 deletions
@@ -198,6 +198,305 @@
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"9,1": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Drum Ready",
"_title": "Drum Ready",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"0,2": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Shooter Beam",
"_title": "Shooter Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"3,2": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Upper Beam",
"_title": "Upper Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"4,2": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Turret Aimed",
"_title": "Turret Aimed",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"8,2": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Intake Beam",
"_title": "Intake Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"9,2": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Storage Beam",
"_title": "Storage Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"0,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Left Motor Position Raw",
"_title": "Left Motor Position Raw"
}
},
"1,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Right Motor Position Raw",
"_title": "Right Motor Position Raw"
}
},
"2,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Average Motor Position Raw",
"_title": "Average Motor Position Raw"
}
},
"3,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Avg Speed MPH",
"_title": "Avg Speed MPH"
}
},
"4,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Turret Angle Raw",
"_title": "Turret Angle Raw"
}
},
"5,3": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Aim Ready",
"_title": "Aim Ready",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"6,3": {
"size": [
2,
2
],
"content": {
"_type": "Gyro",
"_source0": "network_table:///SmartDashboard/Turret Angle",
"_title": "Turret Angle",
"Visuals/Major tick spacing": 45.0,
"Visuals/Starting angle": 180.0,
"Visuals/Show tick mark ring": true,
"Visuals/Counter clockwise": false
}
},
"8,3": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Hood Angle Raw",
"_title": "Hood Angle Raw"
}
},
"9,3": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/!Ball in Intake!",
"_title": "!Ball in Intake!",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"0,4": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/!Ball Storage!",
"_title": "!Ball Storage!",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"1,4": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/!Ball Shooter!",
"_title": "!Ball Shooter!",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"2,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Distance to Target",
"_title": "Distance to Target"
}
},
"3,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Center Displacement",
"_title": "Center Displacement"
}
},
"4,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Is Auto Start?",
"_title": "Is Auto Start?"
}
},
"5,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Left Motor Pos Inches",
"_title": "Left Motor Pos Inches"
}
},
"8,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Right Motor Pos Inches",
"_title": "Right Motor Pos Inches"
}
},
"9,4": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Left Motor Pos Meters",
"_title": "Left Motor Pos Meters"
}
},
"0,5": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Right Motor Pos Meters",
"_title": "Right Motor Pos Meters"
}
},
"1,5": {
"size": [
1,
1
],
"content": {
"_type": "Text View",
"_source0": "network_table:///SmartDashboard/Odometry Values Meters",
"_title": "Odometry Values Meters"
}
}
}
}
@@ -310,6 +609,34 @@
"_type": "Text View",
"_source0": "network_table:///LiveWindow/Ungrouped/DoubleSolenoid[7,3]/Value",
"_title": "DoubleSolenoid[7,3]/Value"
},
{
"_type": "Boolean Box",
"_source0": "network_table:///LiveWindow/Ungrouped/DigitalInput[13]/Value",
"_title": "DigitalInput[13]/Value",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
},
{
"_type": "Boolean Box",
"_source0": "network_table:///LiveWindow/Ungrouped/DigitalInput[11]/Value",
"_title": "DigitalInput[11]/Value",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
},
{
"_type": "Boolean Box",
"_source0": "network_table:///LiveWindow/Ungrouped/DigitalInput[14]/Value",
"_title": "DigitalInput[14]/Value",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
},
{
"_type": "Boolean Box",
"_source0": "network_table:///LiveWindow/Ungrouped/DigitalInput[12]/Value",
"_title": "DigitalInput[12]/Value",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
]
}
@@ -460,30 +787,6 @@
"Visuals/Counter clockwise": false
}
},
"8,8": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"9,8": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"8,5": {
"size": [
2,
@@ -497,54 +800,6 @@
"Visuals/Show value": true
}
},
"6,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"4,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"5,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"7,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_title": "Boolean Box",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"8,0": {
"size": [
2,
@@ -677,15 +932,93 @@
"Wheels/Wheel diameter": 80.0,
"Visuals/Show velocity vectors": true
}
},
"8,8": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Turret Aimed",
"_title": "/SmartDashboard/Turret Aimed",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"9,8": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Drum Ready",
"_title": "/SmartDashboard/Drum Ready",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"6,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Upper Beam",
"_title": "/SmartDashboard/Upper Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"5,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Storage Beam",
"_title": "/SmartDashboard/Storage Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"7,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Shooter Beam",
"_title": "/SmartDashboard/Shooter Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
},
"4,0": {
"size": [
1,
1
],
"content": {
"_type": "Boolean Box",
"_source0": "network_table:///SmartDashboard/Intake Beam",
"_title": "/SmartDashboard/Intake Beam",
"Colors/Color when true": "#7CFC00FF",
"Colors/Color when false": "#8B0000FF"
}
}
}
}
}
],
"windowGeometry": {
"x": 47.20000076293945,
"y": 148.8000030517578,
"width": 1553.5999755859375,
"height": 1448.0
"x": -7.199999809265137,
"y": -7.199999809265137,
"width": 1550.4000244140625,
"height": 878.4000244140625
}
}
+1 -1
View File
@@ -116,7 +116,7 @@ public final class Constants {
public static final int SHOOTER_SLOT_IDX = 0;
public static final int SHOOTER_PID_LOOP_IDX = 1;
public static final int SHOOTER_TIMEOUT_MS = 30;
public static final Gains DRUM_SHOOTER_GAINS = new Gains(0.55, 0.0, 100, 0.0, 0, 1.0);
public static final Gains DRUM_SHOOTER_GAINS = new Gains(1.5, 0.0, 100, 0.055, 0, 1.0);
public static final Gains SHOOTER_TURRET_GAINS = new Gains(0.0, 0.0, 0.0, 0.0, 0, 1.0);
public static final Gains SHOOTER_ANGLE_GAINS = new Gains(0.05, 0.0, 0.0, 0.0, 0, 0.3);
public static final double SHOOTER_TURRET_MIN = -1.0;
@@ -34,7 +34,18 @@ public class ShooterVelocityControlPID extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
m_shooter.runDrumShooterVelocityPID(m_shooter.addFireVel());
//Tells whether the target velocity has been reached
m_actualVel = m_shooter.m_shooterFalcon.getSelectedSensorPosition();
m_targetVel = m_shooter.addFireVel();
double error = m_actualVel - m_targetVel;
if (Math.abs(error) < ShooterConstants.DRUM_VELOCITY_BOUND){
m_shooter.m_isDrumReady = true;
m_shooter.runDrumShooterVelocityPID(m_targetVel);
}
else{
m_shooter.m_isDrumReady = false;
m_shooter.runDrumShooterVelocityPID(m_targetVel);
}
}
// Called once the command ends or is interrupted.
@@ -45,16 +56,6 @@ public class ShooterVelocityControlPID extends CommandBase {
// Returns true when the command should end.
@Override
public boolean isFinished() {
//Tells whether the target velocity has been reached
double upperBound = m_targetVel + ShooterConstants.DRUM_VELOCITY_BOUND;
double lowerBound = m_targetVel - ShooterConstants.DRUM_VELOCITY_BOUND;
if (m_actualVel < upperBound && m_actualVel > lowerBound){
m_shooter.m_isDrumReady = true;
}
else{
m_shooter.m_isDrumReady = false;
}
return false;
}
}
@@ -54,7 +54,7 @@ public class Shooter extends SubsystemBase {
m_shooterFalcon.setNeutralMode(NeutralMode.Coast);
m_shooterFalcon.setInverted(true);
m_shooterFalcon.configOpenloopRamp(1, ShooterConstants.SHOOTER_TIMEOUT_MS);
m_shooterFalcon.configClosedloopRamp(1.0, ShooterConstants.SHOOTER_TIMEOUT_MS);
//m_shooterFalcon.configClosedloopRamp(1.0, ShooterConstants.SHOOTER_TIMEOUT_MS);
setShooterGains();
m_shooterFalcon.configPeakOutputReverse(0, ShooterConstants.SHOOTER_TIMEOUT_MS);
@@ -67,8 +67,6 @@ public class ShooterAim extends SubsystemBase {
// This method will be called once per scheduler run
SmartDashboard.putNumber("Turret Angle Raw", getShooterRotatePosition());
SmartDashboard.putBoolean("Aim Ready", m_isAimReady);
SmartDashboard.putData("Turret Angle", m_turretGyro);
SmartDashboard.putBoolean("Turret Aimed" , m_isAimReady);