Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer intake turret #29

Open
wants to merge 122 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
6147b60
created code for the shooter subsystem
amrrao Jan 17, 2022
6d96bb4
Boilerplate for the turret.
FlyN-Nick Jan 17, 2022
2858673
Subsystem itself done.
FlyN-Nick Jan 17, 2022
e5c59f3
Added turret to robot map.
FlyN-Nick Jan 17, 2022
921e8d3
Now using pos sensor motor.
FlyN-Nick Jan 17, 2022
56a60da
Changes to Intake also Juicy 3
TheShishKabob Jan 17, 2022
24b0d45
TurnTurret done except for gear ratio.
FlyN-Nick Jan 17, 2022
6e3b52b
Forgot to commit.
FlyN-Nick Jan 17, 2022
2232658
Forgot to remove.
FlyN-Nick Jan 17, 2022
e1a2fd3
Fixed todos and added newline.
FlyN-Nick Jan 17, 2022
8a71f35
edited inversion of flywheel
amrrao Jan 20, 2022
4314ea5
Made the requested changes.
amrrao Jan 21, 2022
4f8eab7
Changed intake subsystem for solenoid and added commands
aze12345 Jan 22, 2022
a92e5f6
changed variable names deleted intake subsystem
aze12345 Jan 22, 2022
093cd98
Remove unnecessary TODO
BenCantCode Jan 23, 2022
4094af1
made requested changed
FlyN-Nick Jan 29, 2022
9d0057a
made indexer off command
amrrao Jan 29, 2022
071ecd8
made indexer commands
amrrao Jan 30, 2022
5c649ed
Added indexer off and on commands
amrrao Jan 30, 2022
1161415
added on and off indexer commands
amrrao Jan 30, 2022
7f09421
made requested changes to indexer commands
amrrao Jan 30, 2022
c2b48e0
added secondary intake motor
pluvii Feb 3, 2022
d1813bb
broken indexer
aze12345 Feb 13, 2022
ae1c8fc
fixed indexer two motor
aze12345 Feb 13, 2022
19103fa
added indexer reverse command
aze12345 Feb 13, 2022
ba44075
merged branches
aze12345 Feb 15, 2022
f95b826
merged turret
aze12345 Feb 15, 2022
8b0c559
merge
aze12345 Feb 15, 2022
10b730c
created a command to rotate indexer and intake
aze12345 Feb 15, 2022
6060f96
fixed command
aze12345 Feb 15, 2022
8c8d3a2
Created command to turn intake and indexer off
aze12345 Feb 17, 2022
ed62d94
Update and rename RotateIndexerIntake.java to StoreBall.java
aze12345 Mar 5, 2022
688e275
fixed command
aze12345 Mar 5, 2022
00e302a
updated indexer
aze12345 Mar 8, 2022
5564e43
merged stuff
aze12345 Mar 8, 2022
f92b79d
created shoot command
aze12345 Mar 8, 2022
5892053
Intermediary edits/merges
b-cho Mar 12, 2022
bb02266
Revamp shooter to work with one motor
b-cho Mar 12, 2022
c1d3afb
Rewrite intake
b-cho Mar 12, 2022
8413a30
Rename indexer motors and modify configuration
b-cho Mar 12, 2022
4773ca3
Interim operator controls
b-cho Mar 12, 2022
1a05a29
PositionSensorMotor test
b-cho Mar 13, 2022
2e82add
Merge main into branch and fix conflicts
b-cho Mar 13, 2022
3dcea9b
Re-add missing chassis code
b-cho Mar 13, 2022
5efb16e
Set ports
b-cho Mar 13, 2022
c6f3c68
Operator and driver control changes
b-cho Mar 14, 2022
ba51947
Update NathanGain.java command bindings
b-cho Mar 15, 2022
4569cc2
Update standard
b-cho Mar 15, 2022
d0ee10b
Reverse intake axle motor
b-cho Mar 15, 2022
f01d49a
New values
b-cho Mar 15, 2022
9827791
Fix shoot commands
b-cho Mar 15, 2022
f2e50c5
Updates
b-cho Mar 15, 2022
4f33fbe
Add brake commands
b-cho Mar 15, 2022
c055f29
Merge branch 'indexer-intake-turret' into chassis
zbuster05 Mar 18, 2022
14d940b
Merge pull request #28 from RoboticsTeam4904/chassis
zbuster05 Mar 18, 2022
6102125
Attaching latest standard commits
zbuster05 Mar 18, 2022
816829e
added new turn turret command
aze12345 Mar 19, 2022
311eb90
changed name
aze12345 Mar 19, 2022
03f8901
Chassis metric tuning
b-cho Mar 19, 2022
91481a1
use meters per tick with CANTalonEncoder
Exr0n Mar 19, 2022
b4f92ce
Hooked everything up
zbuster05 Mar 19, 2022
5fe3f72
Merge branch 'indexer-intake-turret' of https://github.com/RoboticsTe…
zbuster05 Mar 19, 2022
89ce3b4
Fixed albert's mistakes (couldnt' seem to erase him though)
zbuster05 Mar 20, 2022
7fbf432
Update turret commands
b-cho Mar 20, 2022
0121fee
schedule --> execute
b-cho Mar 20, 2022
be14bb3
Set turret gear ratio
b-cho Mar 20, 2022
9d9af96
Modify turret encoder ticks count
b-cho Mar 20, 2022
80ea306
Important UDP fixes
zbuster05 Mar 20, 2022
bdc8aa7
Merge branch 'indexer-intake-turret' of https://github.com/RoboticsTe…
zbuster05 Mar 20, 2022
1d7b760
Attach latest standard commits
zbuster05 Mar 20, 2022
597c590
UDP + turret interactions
b-cho Mar 20, 2022
9c7790f
Merge remote-tracking branch 'origin/indexer-intake-turret' into inde…
b-cho Mar 20, 2022
de88e63
I don't know what I"ve done
zbuster05 Mar 20, 2022
bb107e3
Things
zbuster05 Mar 20, 2022
fbfc89c
Add requirement for turret in command
b-cho Mar 20, 2022
0d515ce
BRANDON
zbuster05 Mar 20, 2022
5e6bce0
Invert shooter velocity values
b-cho Mar 20, 2022
f54bb0d
Add basic auton routine
b-cho Mar 20, 2022
b718b7c
Linking all the UDP and stuff together
zbuster05 Mar 20, 2022
b1acddc
Fixed turret angle
zbuster05 Mar 20, 2022
f30963a
Merge branch 'indexer-intake-turret' of https://github.com/RoboticsTe…
zbuster05 Mar 20, 2022
3ba986e
Turret getAngle implementation
b-cho Mar 20, 2022
5022d07
removed PID
zbuster05 Mar 21, 2022
32dc774
Basic auton routine added, needs to be tuned.
FlyN-Nick Mar 22, 2022
1d20909
Patching over driver's station changes
zbuster05 Mar 22, 2022
28ddf70
Fixed gear ratio issues in turret position
aze12345 Mar 22, 2022
7183daf
Fixed rotation to account for limit switch
zbuster05 Mar 23, 2022
b6d78a1
Added climber
zbuster05 Mar 24, 2022
cfa02d6
Ok turns out I need to add files
zbuster05 Mar 24, 2022
acde879
Climber controls scheduled, climber should work
zbuster05 Mar 24, 2022
7faec99
Ported over all relevant driver station changes
zbuster05 Mar 24, 2022
aca58f6
Fixed shooter stuff
zbuster05 Mar 24, 2022
5f0a232
Fixed sensor init position
zbuster05 Mar 24, 2022
c9cf884
Final turret changes
zbuster05 Mar 24, 2022
e89e915
Fixed/wrote auton routine
zbuster05 Mar 24, 2022
5346e65
Another bit of auton fix
zbuster05 Mar 24, 2022
b04c964
Set climbing motor port
zbuster05 Mar 24, 2022
65214b4
All competition changes
roboticsteam4904-2 Mar 25, 2022
0d64451
use more specific consts in Turret.java
Exr0n Mar 25, 2022
58a4be8
fix mod math + update for new consts TurnTurret.java
Exr0n Mar 25, 2022
8efd6e6
powertables with pascal eqn from March 24 23:26
Exr0n Mar 25, 2022
ea69a76
add teleop turret control to Robot.java
Exr0n Mar 25, 2022
476a4c8
3-24 nightly
roboticsteam4904-2 Mar 25, 2022
09aac15
Merge branch 'indexer-intake-turret' of https://github.com/roboticste…
roboticsteam4904-2 Mar 25, 2022
c52c6e4
windows driver station code
roboticsteam4904-2 Mar 25, 2022
1f28105
timing updates
roboticsteam4904-2 Mar 25, 2022
e770043
turret pid constants (scuffed)
roboticsteam4904-2 Mar 25, 2022
deb258d
dont shoot during auton (bolted turret)
roboticsteam4904-2 Mar 25, 2022
5b473a8
dont turn turret in teleOp
roboticsteam4904-2 Mar 25, 2022
910d2e0
dont extend intake in auton
roboticsteam4904-2 Mar 25, 2022
2c9b7a7
lower drive constants (exp = 1)
roboticsteam4904-2 Mar 25, 2022
03865d5
precision turn with right joystick
roboticsteam4904-2 Mar 25, 2022
9ffe717
Fixed climber issues, added test to command, etc.
roboticsteam4904-2 Mar 26, 2022
47617d5
Theoretically ball can reject
roboticsteam4904-2 Mar 26, 2022
9aaf551
Fixed as requested
roboticsteam4904-2 Mar 26, 2022
8d6b008
Properly bound and set joystick
roboticsteam4904-2 Mar 26, 2022
59133d9
Solenoid shifting
roboticsteam4904-2 Mar 26, 2022
5a7882e
First match day 2 comp
roboticsteam4904-2 Mar 26, 2022
e47b0ad
testingchassissolenoid
TheShishKabob Apr 1, 2022
ddee1af
Attached standard changes
TheShishKabob Apr 1, 2022
e37f453
RobotMap changes
b-cho Apr 1, 2022
a905815
New PID constants
roboticsteam4904-2 Apr 3, 2022
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: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO

plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
id "edu.wpi.first.GradleRIO" version "2022.4.1"
}

sourceCompatibility = JavaVersion.VERSION_11
Expand Down
21 changes: 18 additions & 3 deletions src/main/java/org/usfirst/frc4904/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
/*----------------------------------------------------------------------------*/
package org.usfirst.frc4904.robot;

import org.usfirst.frc4904.robot.auton.SimpleRoutine;
import org.usfirst.frc4904.robot.commands.UDPExecute;
import org.usfirst.frc4904.robot.commands.turret.TurnTurret;
import org.usfirst.frc4904.robot.humaninterface.drivers.NathanGain;
import org.usfirst.frc4904.robot.humaninterface.operators.DefaultOperator;
import org.usfirst.frc4904.standard.CommandRobotBase;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Subsystem;
import edu.wpi.first.wpilibj2.command.CommandGroupBase;
import org.usfirst.frc4904.standard.commands.KittenCommand;

import org.usfirst.frc4904.standard.LogKitten;

public class Robot extends CommandRobotBase {
private RobotMap map = new RobotMap();
private UDPExecute udpExecute;

@Override
public void initialize() {
Expand All @@ -24,14 +30,24 @@ public void initialize() {

@Override
public void teleopInitialize() {
udpExecute = new UDPExecute("UDPExecute");
udpExecute.schedule(false);
}

@Override
public void teleopExecute() {
final double TURRET_MAX_ANGLE = 170; // used to rescale controller input [-1, 1] to safe turret angles; TODO: update
final double CONTROL_SPEED = 0.05;
final double target_radians = Math.max(Math.min((RobotMap.Component.turret.getAngle() + CONTROL_SPEED * RobotMap.HumanInput.Operator.joystick.getX()), 1), -1) * (TURRET_MAX_ANGLE/180)*Math.PI;
//new TurnTurret(target_radians).schedule(false);
}

@Override
public void autonomousInitialize() {
udpExecute = new UDPExecute("UDPExecute");
udpExecute.schedule(false);
CommandGroupBase routine = new SimpleRoutine();
routine.schedule();
}

@Override
Expand All @@ -56,7 +72,6 @@ public void testExecute() {

@Override
public void alwaysExecute() {

}

}
}
183 changes: 141 additions & 42 deletions src/main/java/org/usfirst/frc4904/robot/RobotMap.java
Original file line number Diff line number Diff line change
@@ -1,46 +1,83 @@
package org.usfirst.frc4904.robot;

import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj2.command.Subsystem;
import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick;
import org.usfirst.frc4904.standard.custom.controllers.CustomXbox;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonFX;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;

import com.ctre.phoenix.motorcontrol.FeedbackDevice;

import org.usfirst.frc4904.robot.commands.shooter.ShooterBrake;
import org.usfirst.frc4904.robot.humaninterface.drivers.NathanGain;
import org.usfirst.frc4904.robot.subsystems.Indexer;

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.PneumaticsModuleType;

import org.usfirst.frc4904.standard.commands.chassis.ChassisMove;
import org.usfirst.frc4904.standard.custom.CustomPIDSourceType;
import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick;
import org.usfirst.frc4904.standard.custom.controllers.CustomXbox;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonFX;
import org.usfirst.frc4904.standard.custom.PCMPort;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CANTalonSRX;
import org.usfirst.frc4904.standard.custom.motioncontrollers.CustomPIDController;
import org.usfirst.frc4904.standard.custom.sensors.CANTalonEncoder;
import org.usfirst.frc4904.standard.custom.sensors.CustomCANCoder;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem.SolenoidState;
import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem;
import org.usfirst.frc4904.robot.subsystems.Climber;
import org.usfirst.frc4904.standard.subsystems.chassis.TankDrive;
import org.usfirst.frc4904.standard.subsystems.chassis.TankDriveShifting;
import org.usfirst.frc4904.standard.custom.sensors.EncoderPair;
import org.usfirst.frc4904.standard.custom.sensors.CANTalonEncoder;
import edu.wpi.first.wpilibj.SerialPort;
import org.usfirst.frc4904.standard.subsystems.chassis.TankDrive;
import org.usfirst.frc4904.standard.subsystems.motor.Motor;
import org.usfirst.frc4904.standard.custom.sensors.NavX;

import org.usfirst.frc4904.standard.subsystems.chassis.SensorDrive;
import org.usfirst.frc4904.standard.subsystems.chassis.SolenoidShifters;
import org.usfirst.frc4904.standard.subsystems.motor.PositionSensorMotor;
import org.usfirst.frc4904.robot.subsystems.Turret;
import org.usfirst.frc4904.robot.udp.RobotUDPClient;

public class RobotMap {
public static class Port {
public static class UDPPorts{
public static final int receivingUDPSocket = 3375;
public static final int sendingUDPSocket = 4321;
public static final int sourcePort = 1111;
public static final String nanoHostname = "nano2-4904-frc.local";
}

public static class HumanInput {
public static final int joystick = 0;
public static final int xboxController = 1;
public static final int xboxController = 1;
}

public static class CANMotor {
public static int RIGHT_DRIVE_A = 2; // TODO: Check chassis motor IDs
public static int RIGHT_DRIVE_B = 3;
public static int LEFT_DRIVE_A = 4;
public static int LEFT_DRIVE_B = 5;
public static final int RIGHT_DRIVE_A = 2; // TODO: Check chassis motor IDs
public static final int RIGHT_DRIVE_B = 3;
public static final int LEFT_DRIVE_A = 4;
public static final int LEFT_DRIVE_B = 5;

public static final int INTAKE_AXLE_MOTOR = 7; //TODO: set port for axel intake motor

public static final int INDEXER_HOLDER_MOTOR = 13; // TODO: set port
public static final int INDEXER_BELT_MOTOR = 12; // TODO: set port

public static final int TURRET_MOTOR = 15; // TODO: set port

public static final int CLIMBER_MOTOR = 9; //TODO: set port

public static final int SHOOTER_MOTOR = 8; // TODO: set port
}

public static class PWM {
}

public static class CAN {
public static final int LEFT_WHEEL_ENCODER = -1; // TODO: Check CAN IDs
public static final int RIGHT_WHEEL_ENCODER = -1;
}

public static class Pneumatics {
public static final PCMPort INTAKE_EXTENDER_1 = new PCMPort(0, PneumaticsModuleType.CTREPCM, 1, 2); //TODO: set port for drawbridge intake solenoid
public static final PCMPort INTAKE_EXTENDER_2 = new PCMPort(0, PneumaticsModuleType.CTREPCM, 3, 4); //TODO: set port for drawbridge intake
public static final PCMPort SHIFTER = new PCMPort(0, PneumaticsModuleType.CTREPCM, 0, 7); // TODO fix these values maybe?
}

public static class Digital {
Expand All @@ -49,14 +86,14 @@ public static class Digital {

public static class Metrics {
public static class Chassis {
public static final double DIAMETER_METERS = Units.inchesToMeters(-1.0); // TODO: Check values
public static final double DIAMETER_METERS = Units.inchesToMeters(5.0); // TODO: Check values
public static final double CIRCUMFERENCE_METERS = Metrics.Chassis.DIAMETER_METERS * Math.PI;
public static final double TICKS_PER_METER = Metrics.Encoders.CANCoders.TICKS_PER_REVOLUTION
public static final double TICKS_PER_METER = Metrics.Encoders.TalonEncoders.TICKS_PER_REVOLUTION
/ Metrics.Chassis.CIRCUMFERENCE_METERS;
public static final double DISTANCE_FRONT_BACK = Units.inchesToMeters(-1.0); // TODO: DOUBLE CHECK DISTANCES
public static final double DISTANCE_SIDE_SIDE = Units.inchesToMeters(-1.0); // The robot's a square
public static final double DISTANCE_FRONT_BACK = Units.inchesToMeters(31.0); // TODO: DOUBLE CHECK DISTANCES
public static final double DISTANCE_SIDE_SIDE = Units.inchesToMeters(28.0); // The robot's a square
public static final double METERS_PER_TICK = Metrics.Chassis.CIRCUMFERENCE_METERS
/ Metrics.Encoders.CANCoders.TICKS_PER_REVOLUTION;
/ Metrics.Encoders.TalonEncoders.TICKS_PER_REVOLUTION;
public static final double TURN_CORRECTION = 0.0;
}

Expand All @@ -65,11 +102,6 @@ public static class TalonEncoders {
public static final double TICKS_PER_REVOLUTION = 2048.0;
public static final double REVOLUTIONS_PER_TICK = 1 / TICKS_PER_REVOLUTION;
}

public static class CANCoders {
public static final double TICKS_PER_REVOLUTION = 4096.0;
public static final double REVOLUTIONS_PER_TICK = 1 / TICKS_PER_REVOLUTION;
}
}
}

Expand All @@ -80,21 +112,55 @@ public static class Drive {
public static class Turn {
}

public static class Turret {
public static final double P = 7e-5; // TODO: TUNE
public static final double I = 0; // 3E-8
public static final double D = -7e-6;
public static final double F = 0;
// public static final double tolerance = -1;
// public static final double dTolerance = -1;

}

}

public static class Component {
public static CANTalonEncoder leftWheelTalonEncoder;
public static CANTalonEncoder rightWheelTalonEncoder;
public static CustomCANCoder leftWheelCANCoder;
public static CustomCANCoder rightWheelCANCoder;
public static EncoderPair chassisTalonEncoders;
public static EncoderPair chassisCANCoders;
public static Motor rightWheelA;
public static Motor rightWheelB;
public static Motor leftWheelA;
public static Motor leftWheelB;
public static TankDrive chassis;
public static SensorDrive sensorDrive;
public static TankDriveShifting chassis;
public static CustomPIDController drivePID;
public static NavX navx;

public static Motor intakeAxleMotor;
public static SolenoidSubsystem intakeExtender1;
public static SolenoidSubsystem intakeExtender2;

public static CANTalonFX indexerHolderTalon;
public static CANTalonFX indexerBeltTalon;
public static Indexer indexer;

public static Turret turret;
public static CustomPIDController turretPID;
public static CANTalonEncoder turretEncoder;
public static CANTalonFX turretMotor;

public static CANTalonFX shooterTalon;
public static Motor shooterMotor;

public static SolenoidShifters shifter;

public static RobotUDPClient robotUDPClient;
public static Pose2d initialPose;

public static CANTalonFX climberTalon;
public static Motor climberMotor;
public static Climber climber;
}

public static class Input {
Expand All @@ -111,8 +177,46 @@ public static class Operator {
}

public RobotMap() {
Component.navx = new NavX(SerialPort.Port.kMXP);

HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController);
HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick);



Component.intakeExtender1 = new SolenoidSubsystem("Intake Extender 1", false, SolenoidState.RETRACT, Port.Pneumatics.INTAKE_EXTENDER_1.buildDoubleSolenoid()); //TODO: check if CANTalonFX or SRX
Component.intakeAxleMotor = new Motor("Intake Motor", true, new CANTalonFX(Port.CANMotor.INTAKE_AXLE_MOTOR)); //TODO: check if CANTalonFX

Component.indexerHolderTalon = new CANTalonFX(Port.CANMotor.INDEXER_HOLDER_MOTOR);
Component.indexerBeltTalon = new CANTalonFX(Port.CANMotor.INDEXER_BELT_MOTOR);
Motor indexerHolderMotor = new Motor("Indexer 1", false, Component.indexerHolderTalon);
Motor indexerBeltMotor = new Motor("Indexer 2", false, Component.indexerBeltTalon);
Component.indexer = new Indexer(indexerHolderMotor, indexerBeltMotor);

Component.climberTalon = new CANTalonFX(Port.CANMotor.CLIMBER_MOTOR);
Component.climberMotor = new Motor("Climber Motor", false, Component.climberTalon);
Component.climber = new Climber(Component.climberMotor);

Component.shifter = new SolenoidShifters(Port.Pneumatics.SHIFTER.buildDoubleSolenoid());

Component.turretMotor = new CANTalonFX(Port.CANMotor.TURRET_MOTOR);
Component.turretMotor.setSelectedSensorPosition(0);
Component.turretEncoder = new CANTalonEncoder(Component.turretMotor);
Component.turretPID = new CustomPIDController(PID.Turret.P,
PID.Turret.I, PID.Turret.D, PID.Turret.F,
Component.turretEncoder);
Component.turretPID.setAbsoluteTolerance(1e-10);
PositionSensorMotor turretPSM = new PositionSensorMotor("Turret", Component.turretPID, Component.turretMotor);
Component.turret = new Turret(turretPSM, Component.turretEncoder);

Component.shooterTalon = new CANTalonFX(Port.CANMotor.SHOOTER_MOTOR);
Component.shooterMotor = new Motor("Shooter", true, Component.shooterTalon);

// UDP things
Component.robotUDPClient = new RobotUDPClient();
Component.robotUDPClient.setup();

// Chassis

/* Drive Train */
// TalonFX
Expand All @@ -128,24 +232,19 @@ public RobotMap() {
Component.leftWheelB = new Motor("leftWheelB", true, leftWheelBTalon);

// Wheel Encoders
Component.leftWheelCANCoder = new CustomCANCoder(Port.CAN.LEFT_WHEEL_ENCODER,
Metrics.Chassis.METERS_PER_TICK);
Component.rightWheelCANCoder = new CustomCANCoder(Port.CAN.RIGHT_WHEEL_ENCODER,
Metrics.Chassis.METERS_PER_TICK);

Component.leftWheelTalonEncoder = new CANTalonEncoder("leftWheel", leftWheelATalon, true,
Metrics.Encoders.TalonEncoders.REVOLUTIONS_PER_TICK, CustomPIDSourceType.kDisplacement,
FeedbackDevice.IntegratedSensor);
Metrics.Chassis.METERS_PER_TICK);
Component.rightWheelTalonEncoder = new CANTalonEncoder("rightWheel", rightWheelATalon, true,
Metrics.Encoders.TalonEncoders.REVOLUTIONS_PER_TICK, CustomPIDSourceType.kDisplacement,
FeedbackDevice.IntegratedSensor);
Metrics.Chassis.METERS_PER_TICK);
Component.initialPose = new Pose2d(); // TODO double x, double y, rotation2d
Component.sensorDrive = new SensorDrive(Component.chassis, Component.leftWheelTalonEncoder,
Component.rightWheelTalonEncoder, Component.navx, Component.initialPose);

Component.chassisTalonEncoders = new EncoderPair(Component.leftWheelTalonEncoder, Component.rightWheelTalonEncoder);
Component.chassisCANCoders = new EncoderPair(Component.leftWheelCANCoder, Component.rightWheelCANCoder);

// General Chassis
Component.chassis = new TankDrive("2022-Chassis", Component.leftWheelA, Component.leftWheelB,
Component.rightWheelA, Component.rightWheelB);
Component.chassis = new TankDriveShifting("2022-Chassis", Component.leftWheelA, Component.leftWheelB,
Component.rightWheelA, Component.rightWheelB, Component.shifter);
Component.chassis.setDefaultCommand(new ChassisMove(Component.chassis, new NathanGain()));
}
}
30 changes: 30 additions & 0 deletions src/main/java/org/usfirst/frc4904/robot/auton/SimpleRoutine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.usfirst.frc4904.robot.auton;

import org.usfirst.frc4904.robot.RobotMap;
import org.usfirst.frc4904.robot.commands.indexer.IndexerOff;
import org.usfirst.frc4904.robot.commands.indexer.IndexerSet;
import org.usfirst.frc4904.robot.commands.indexerIntakeTurret.Shoot;
import org.usfirst.frc4904.robot.commands.intake.ExtendIntake;
import org.usfirst.frc4904.robot.commands.shooter.ShooterBrake;
import org.usfirst.frc4904.robot.commands.turret.TurnTurret;
import org.usfirst.frc4904.robot.subsystems.Indexer;
import org.usfirst.frc4904.standard.commands.RunFor;
import org.usfirst.frc4904.standard.commands.chassis.ChassisConstant;

import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

public class SimpleRoutine extends SequentialCommandGroup {
public SimpleRoutine() {
// first backup, then shoot
this.addCommands(
new ChassisConstant(RobotMap.Component.chassis, 0, -0.5, 0, 0.5) // TODO: tune num of seconds, currently 2
//new RunFor(new ExtendIntake(), 2.2)
//new TurnTurret(0.0),
// new TurnTurret(RobotMap.Component.turret.getAngle() + RobotMap.Component.robotUDPClient.server.heading),
// new RunFor(new Shoot(), 5),
// new IndexerSet(Indexer.DEFAULT_INDEXER_SPEED, -Indexer.DEFAULT_INDEXER_SPEED),
// new ShooterBrake(),
// new IndexerOff()
);
}
}
Loading