Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
6812e41
Amir - added getLocation command
greenblitz4590 Oct 30, 2022
45805ff
Amir - added getlocation function
greenblitz4590 Oct 30, 2022
9376c5f
Romy & Amir - made combineJoystickMovment by supplier
greenblitz4590 Oct 30, 2022
fd257d4
Romy & Amir - fixed conflicts, please rebase more often
greenblitz4590 Nov 6, 2022
5f1e1b6
noam & tal - fixed all of the list's problems of the swerve
greenblitz4590 Oct 31, 2022
8063b47
noam & tal - fixed all of the list's problems of the swerve
greenblitz4590 Oct 31, 2022
44f0759
Amir - added getLocation command
greenblitz4590 Oct 30, 2022
1c99297
Amir - added getlocation function
greenblitz4590 Oct 30, 2022
cfe57c7
Romy & Amir - made combineJoystickMovment by supplier
greenblitz4590 Oct 30, 2022
b9a3905
Romy & Asaf - made comand for CombineJoystickMovment by vision suppli…
itamaroryan Nov 2, 2022
0b152e3
Romy - some git conflicts
itamaroryan Nov 2, 2022
a3f5949
Amir & Asaf - commited for one lower case m
greenblitz4590 Nov 9, 2022
8e42748
Romy & Amir - added AngPIDSupplier NOT TESTED
greenblitz4590 Nov 14, 2022
a3f8fda
Romy & Amir & Heinemann - CombineJoystickMovment by supplier works TE…
greenblitz4590 Nov 16, 2022
32ed6d1
added new line
greenblitz4590 Nov 16, 2022
75ff53f
noam -added battery subsystem
greenblitz4590 Nov 20, 2022
17e3b05
added a tick timer until disables the robot when the battery goes brr…
greenblitz4590 Nov 21, 2022
7c5f1d9
noam - fixed some stuff
greenblitz4590 Nov 21, 2022
8c3743c
noam - now periodic runs in a if the battery not dead
greenblitz4590 Nov 23, 2022
4fe9359
now supposed to disable robot
greenblitz4590 Nov 24, 2022
6e11866
Amir & Romy & Asaf - added combinejoystick TESTED not working
itamaroryan Nov 27, 2022
81ecd6d
noam & broder - battery disables robot by exception
itamaroryan Nov 30, 2022
1cb1954
noam & broder - added a voltage linear filter and now takes one secon…
itamaroryan Nov 30, 2022
14edc28
asaf & broder - simplefied code and made grace period better
itamaroryan Nov 30, 2022
77d5d7e
Amir & Romy & Asaf - added vision target supliier and changed some th…
greenblitz4590 Nov 30, 2022
ecc4758
asaf as amir & romi - vision works but slowly
itamaroryan Dec 4, 2022
388b3d6
asaf as amir & romi - added ff to ang pid to vision target
itamaroryan Dec 5, 2022
cd2bab7
amir- added documantation
itamaroryan Dec 5, 2022
f3cf21d
asaf & amir - merged dev containg no gblib
itamaroryan Dec 5, 2022
149784f
Romy & Amir & Asaf - added docoumition and tried to fix feedforward
itamaroryan Dec 5, 2022
20ae006
Romy & Amir & Asaf - added a case if linelight d is 0
greenblitz4590 Dec 7, 2022
30258d7
added polymorphizm to swerveModule and now we have SDS swerveModule w…
greenblitz4590 Dec 7, 2022
74a8c5c
added comments and missing return statements to some of the SDS Swerv…
NoamRosenberg08 Dec 8, 2022
dbf2495
Amir - changed some idiot mistakes that ive probebly made
greenblitz4590 Dec 11, 2022
b870caf
Amir & Asaf & Romy - Toda lael, the vision is working(until he wants …
itamaroryan Dec 11, 2022
9616e95
Amir & Asaf & Romy - Toda lael, the vision is working(until he wants …
itamaroryan Dec 11, 2022
b6b5ab2
asaf & amir - added latency handling untested
itamaroryan Dec 11, 2022
770d387
asaf & amir - added latency handling (maybe working)
itamaroryan Dec 11, 2022
7d1a3e6
Amir & Asaf - commited to merge
itamaroryan Dec 11, 2022
a8d51bb
Amir & Asaf - merge dev and lamprey reset
itamaroryan Dec 11, 2022
dcf9d6e
Romy & Tal - moved kaza's constants into the module, WORKS! also, tri…
greenblitz4590 Dec 11, 2022
adfbd96
tal et romy - changed the sds gear ratio to supposedly the correct one
greenblitz4590 Dec 11, 2022
608ff83
dan et tal- added convertion between ticks and rads for sds swerve, n…
itamaroryan Dec 14, 2022
d25736f
dan et noam we added GBSparkMax wrapper to CANSparkMax and its config…
NoamRosenberg08 Dec 4, 2022
6e051fe
noam & asaf - angular motor now GBSparkMax
itamaroryan Dec 5, 2022
1db35f3
noam - chanbged all swerve motors to GBSparkMax tested on cart
itamaroryan Dec 5, 2022
92995ee
asaf & noam -fixed conversion rate testing needed
greenblitz4590 Dec 7, 2022
086030e
tal et dan - removed isReversed and did some prettfying
tnrz135 Dec 7, 2022
1c58c66
tal - added GBFalcon
tnrz135 Dec 7, 2022
a1c8b1c
asaf - added reset factory defaults and tested
greenblitz4590 Dec 14, 2022
8026062
merged branch dev -> baterry-limiter and solved all of the confilcts …
NoamRosenberg08 Dec 19, 2022
5114508
noam - battery limited tested now working
itamaroryan Dec 19, 2022
71e2575
asaf as romi - started working on default cpnf obj
greenblitz4590 Dec 19, 2022
aed27d0
asaf - moved sparkmax conf objects to robot map
asaf8888 Dec 20, 2022
0c9d072
asaf - updated gbfalcon to include all configs in gbsparkmax
itamaroryan Dec 20, 2022
50c3784
Amir - added pose estimation(NOT TESTED)
aaa-png Dec 20, 2022
9fc1a5f
asaf - tested and fixed some inversion problems
itamaroryan Dec 20, 2022
2cbf641
Merge pull request #11 from GreenBlitz/motor-wrapper
greenblitz4590 Dec 20, 2022
67f4917
noam - did what i needed to do at the cr
tnrz135 Dec 20, 2022
bfe7cc9
Amir - pose estimator is kinda of working!
greenblitz4590 Dec 20, 2022
59c558a
noam - changed the string and voltage to the wanted voltage
greenblitz4590 Dec 21, 2022
9e3e93b
Merge branch 'battery-limiter' into dev
greenblitz4590 Dec 21, 2022
ac5602e
Amir - pose estimator is working!
greenblitz4590 Dec 22, 2022
fc693b4
noam - changed the name of the lamprey to absolute encoder in robot m…
NoamRosenberg08 Dec 23, 2022
ac34b57
asaf as amir - transformed AngPidSupplier to use the poseEstimator
greenblitz4590 Dec 26, 2022
cb9f6d0
asaf & tal - tested on sds chassis and set correct conversion values …
itamaroryan Dec 26, 2022
a7f22f0
asaf - calibrated max velocity for chassis ds and tested
itamaroryan Dec 27, 2022
1153382
Aamireeee - fixed bugs in get vision location and now it works?
itamaroryan Dec 27, 2022
1b289e7
Amir - the pose estimator is working only for the angle, now fixing it
itamaroryan Dec 28, 2022
f5c433b
noam as asaf changed to chassis sds with motor ids
greenblitz4590 Dec 28, 2022
41748d0
Amireee - The pose estimator is finally working!
itamaroryan Dec 28, 2022
6887162
Amireee - merged dev to vision
itamaroryan Dec 28, 2022
d8a102f
tal et romi et amir et asaf - lowered the limit for the battery-disab…
itamaroryan Dec 29, 2022
3d426a6
tal - removed factory reset from GBSpark and GBFalcon
itamaroryan Dec 29, 2022
c7cb427
tal - added NaN protection for getModuleState in SwerveModule, so Pos…
itamaroryan Dec 29, 2022
88b4436
Tal & Amir - changed the get module angle func to not throw exeption
itamaroryan Dec 29, 2022
8bb9407
asaf - added magencoder to sds swerve no reset yet
greenblitz4590 Dec 30, 2022
bb819ac
asaf - merged from dev which forced me to implement reset by mag encoder
greenblitz4590 Dec 30, 2022
ab42551
asaf - updated absolute encoder ids
greenblitz4590 Dec 30, 2022
845afb8
tal for amir- documentation
greenblitz4590 Jan 1, 2023
c9a33cc
tal - added command to reotae all wheels, and made the p value 10 tim…
greenblitz4590 Jan 1, 2023
2b84fd0
tal et dan- changed pid, and started making the absEncoder offset
greenblitz4590 Jan 1, 2023
e4ddee2
Dan et Tal - we re-enabled the subsystems and swiched from sds to kaza
DanIsBad Jan 1, 2023
4e9dcfe
tal et dan - added config object for swerve to make robot map more neat
DanIsBad Jan 1, 2023
3fdc4c7
tal - made decoy module not hjave any values in constructor
itamaroryan Jan 1, 2023
5d2d27e
asaf & amir imported chassis constants from swerve sds and flipped ap…
greenblitz4590 Jan 2, 2023
c452e54
asaf- fixed driving code directions by inverting motors
itamaroryan Jan 2, 2023
8d399bb
Amir & Asaf - pose estimator is finlly working! now send to pr
itamaroryan Jan 2, 2023
b0f2eef
Romy & Asaf - made the code ~beautiful~. transfared consts from swerv…
itamaroryan Jan 2, 2023
8507afc
asaf & tal - removed redundent and debug code
greenblitz4590 Jan 4, 2023
fa8b823
Merge pull request #13 from GreenBlitz/swerve-sds
greenblitz4590 Jan 4, 2023
15adb66
asaf & tal merged 'swerve-sds'(dev) into vision untested
greenblitz4590 Jan 4, 2023
fc60796
asaf & tal - kaza swerve ids were invereted between lin and rot
greenblitz4590 Jan 4, 2023
b3acd98
Merge branch 'dev' into vision
greenblitz4590 Jan 4, 2023
703452f
asaf & tal - fixed double conversion in swerve module
greenblitz4590 Jan 4, 2023
d0d41ec
asaf & broder & tal - resolved code mess (broder cr)
greenblitz4590 Jan 4, 2023
a0e895a
tal -changed back everything so itll work with pegasus
greenblitz4590 Jan 5, 2023
56380a1
Merge pull request #14 from GreenBlitz/vision
greenblitz4590 Jan 7, 2023
95322cb
Amir - added fin tag id function in limelight
itamaroryan Jan 8, 2023
7b1badc
asaf & noam - recalibrated kazaswerve
itamaroryan Jan 9, 2023
123c70a
asaf - probably fixed the NaNs
itamaroryan Jan 9, 2023
39e6cc8
asaf - matched change in switch port
itamaroryan Jan 11, 2023
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
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
[submodule "src/main/java/edu/greenblitz/GBLib"]
path = src/main/java/edu/greenblitz/GBLib
url = https://github.com/GreenBlitz/GBLib.git
branch = GBLib-submodule
10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/main/java/edu/greenblitz/GBLib
Submodule GBLib deleted from 457063
2 changes: 1 addition & 1 deletion src/main/java/edu/greenblitz/pegasus/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package edu.greenblitz.pegasus;

import edu.wpi.first.wpilibj.RobotBase;
Expand Down
104 changes: 58 additions & 46 deletions src/main/java/edu/greenblitz/pegasus/OI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.greenblitz.pegasus;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import edu.greenblitz.pegasus.commands.funnel.RunFunnel;
import edu.greenblitz.pegasus.commands.intake.extender.ToggleRoller;
import edu.greenblitz.pegasus.commands.intake.roller.RunRoller;
Expand All @@ -9,76 +10,87 @@
import edu.greenblitz.pegasus.commands.shooter.ShooterEvacuate;
import edu.greenblitz.pegasus.commands.shooter.StopShooter;
import edu.greenblitz.pegasus.commands.swerve.CombineJoystickMovement;
import edu.greenblitz.pegasus.commands.swerve.MoveByVisionSupplier;
import edu.greenblitz.pegasus.commands.swerve.measurement.CalibrateAll;
import edu.greenblitz.pegasus.commands.swerve.measurement.CalibrateLampreyByNeo;
import edu.greenblitz.pegasus.subsystems.Funnel;
import edu.greenblitz.pegasus.subsystems.Intake;
import edu.greenblitz.pegasus.subsystems.swerve.SwerveChassis;
import edu.greenblitz.pegasus.utils.DigitalInputMap;
import edu.greenblitz.pegasus.utils.hid.SmartJoystick;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.StartEndCommand;

public class OI { //GEVALD

public class OI {
private static OI instance;
private static boolean isHandled = true;
private final SmartJoystick mainJoystick;

private final SmartJoystick thirdJoyStick;
private final SmartJoystick secondJoystick;


private static OI instance;
private static boolean isHandled = true;
private final SmartJoystick mainJoystick;
private OI() {
mainJoystick = new SmartJoystick(RobotMap.Pegasus.Joystick.MAIN, 0.1);
secondJoystick = new SmartJoystick(RobotMap.Pegasus.Joystick.SECOND, 0.2);
thirdJoyStick = new SmartJoystick(RobotMap.Pegasus.Joystick.debug);
initButtons();

private final SmartJoystick secondJoystick;
}

private OI() {
mainJoystick = new SmartJoystick(RobotMap.Pegasus.Joystick.MAIN, 0.1);
secondJoystick = new SmartJoystick(RobotMap.Pegasus.Joystick.SECOND, 0.2);
initButtons();
public static OI getInstance() {
if (instance == null) {
instance = new OI();
}
return instance;
}

}
public static boolean isIsHandled() {
return isHandled;
}

public static OI getInstance() {
if (instance == null) {
instance = new OI();
}
return instance;
}
public static void disableHandling() {
isHandled = false;
}

public static boolean isIsHandled() {
return isHandled;
}
private void initButtons() {
SwerveChassis.getInstance().setDefaultCommand(new CombineJoystickMovement(false));

public static void disableHandling() {
isHandled = false;
}
mainJoystick.Y.whenPressed(new InstantCommand(() -> SwerveChassis.getInstance().resetChassisAngle()));
mainJoystick.X.whenHeld(new MoveByVisionSupplier(false));
mainJoystick.POV_UP.whenPressed(new InstantCommand(() -> SwerveChassis.getInstance().resetAllEncoders()));

private void initButtons() {
SwerveChassis.getInstance().setDefaultCommand(new CombineJoystickMovement(mainJoystick, false));
mainJoystick.R1.whenHeld(new StartEndCommand(() -> Intake.getInstance().getExtender().retract(),
() -> Intake.getInstance().getExtender().extend()));

mainJoystick.Y.whenPressed(new InstantCommand(() -> SwerveChassis.getInstance().resetChassisAngle()));
secondJoystick.Y.whenHeld(new EjectEnemyBallFromGripper());

mainJoystick.POV_UP.whenPressed(new InstantCommand(() -> SwerveChassis.getInstance().resetAllEncoders()));
secondJoystick.R1.whenHeld(new ShooterByRPM(RobotMap.Pegasus.Shooter.ShooterMotor.RPM).andThen(new StopShooter()));

mainJoystick.R1.whenHeld(new StartEndCommand(() -> Intake.getInstance().getExtender().retract(),
() -> Intake.getInstance().getExtender().extend()));
secondJoystick.A.whenHeld(new InsertIntoShooter());

secondJoystick.Y.whenHeld(new EjectEnemyBallFromGripper());
secondJoystick.B.whenHeld(new RunRoller().alongWith(new RunFunnel().until(() -> Funnel.getInstance().isMacroSwitchPressed())));

secondJoystick.R1.whenHeld(new ShooterByRPM(RobotMap.Pegasus.Shooter.ShooterMotor.RPM).andThen(new StopShooter()));

secondJoystick.A.whenHeld(new InsertIntoShooter());
secondJoystick.START.toggleWhenPressed(new ToggleRoller());
secondJoystick.POV_DOWN.whileHeld(new RunFunnel());
secondJoystick.POV_UP.whenPressed(new ShooterEvacuate());



secondJoystick.B.whenHeld(new RunRoller().alongWith(new RunFunnel().until(() -> DigitalInputMap.getInstance().getValue(0))));

//debug joysticks
thirdJoyStick.X.toggleWhenPressed(new CalibrateAll());


}

secondJoystick.START.toggleWhenPressed(new ToggleRoller());
secondJoystick.POV_DOWN.whileHeld(new RunFunnel());
secondJoystick.POV_UP.whenPressed(new ShooterEvacuate());
public SmartJoystick getMainJoystick() {
return mainJoystick;
}

}
public SmartJoystick getSecondJoystick() {
return secondJoystick;
}

public SmartJoystick getMainJoystick() {
return mainJoystick;
}

public SmartJoystick getSecondJoystick() {
return secondJoystick;
}

}
}
30 changes: 18 additions & 12 deletions src/main/java/edu/greenblitz/pegasus/Robot.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
package edu.greenblitz.pegasus;


import edu.greenblitz.pegasus.commands.BatteryDisabler;
import edu.greenblitz.pegasus.commands.auto.Taxi;
import edu.greenblitz.pegasus.subsystems.Battery;
import edu.greenblitz.pegasus.subsystems.Dashboard;
import edu.greenblitz.pegasus.subsystems.Indexing;
import edu.greenblitz.pegasus.subsystems.*;
import edu.greenblitz.pegasus.subsystems.swerve.SwerveChassis;
import edu.greenblitz.pegasus.utils.DigitalInputMap;
import edu.wpi.first.util.net.PortForwarder;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

public class Robot extends TimedRobot {
@Override
public void robotInit() {
CommandScheduler.getInstance().enable();

DigitalInputMap.getInstance();
Pneumatics.init();
Dashboard.init();
Limelight.getInstance();
Funnel.getInstance();
Intake.getInstance();
Indexing.getInstance();
PortForwarder.add(5800, "gloworm.local", 5800);
PortForwarder.add(5801, "gloworm.local", 5801);
PortForwarder.add(5802, "gloworm.local", 5802);
PortForwarder.add(5803, "gloworm.local", 5803);
PortForwarder.add(5804, "gloworm.local", 5804);
PortForwarder.add(5805, "gloworm.local", 5805);
Shooter.create(RobotMap.Pegasus.Shooter.ShooterMotor.PORT_LEADER);

//todo add voltage compensation
//swerve
LiveWindow.disableAllTelemetry();
Battery.getInstance().setDefaultCommand(new BatteryDisabler());

//swerve

SwerveChassis.getInstance().resetChassisAngle();
SwerveChassis.getInstance().resetAllEncoders();
SmartDashboard.putNumber("auto number", 1);
Expand All @@ -35,7 +47,6 @@ public void robotInit() {
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
SmartDashboard.putNumber("pigeon angle", Math.toDegrees(SwerveChassis.getInstance().getChassisAngle()));
}


Expand All @@ -60,11 +71,6 @@ public void teleopPeriodic() {
*/
@Override
public void autonomousInit() {
//resets encoders
SwerveChassis.getInstance().resetAllEncoders();
SwerveChassis.getInstance().resetLocalizer();
(new Taxi(2.5, 2)).schedule(); //THIS //todo sendablechooser for choosing auto


}

Expand Down
Loading