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

!!!!!!!!!!!!!! #53

Open
wants to merge 93 commits into
base: limitClimber
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
df206e6
added auton function for competition, incomplete and untested
1076software Mar 5, 2022
8123216
successfully tested first phase: AUTON_DRIVE
1076software Mar 5, 2022
3f52233
unit tests with AS_ROTATE_PHASE
1076software Mar 6, 2022
72a76e3
Merge branch 'refactorPhasing' into refactorTesting
1076software Mar 6, 2022
cd52bfc
Merge pull request #48 from FRC1076/refactorTesting
1076software Mar 6, 2022
ed23a65
started merge from refactorPhasing
1076software Mar 6, 2022
52f7edd
finished merge from refactorPhasing
1076software Mar 6, 2022
4249abd
comp1auton finished, untested
1076software Mar 6, 2022
49b933f
First Contact with Drive Bot
1076software Mar 7, 2022
1d69f50
Merge branch 'refactorPhasing' of github.com:FRC1076/2022-Competition…
1076software Mar 7, 2022
deed09a
shuffleboard demo, some fixes to make vision work when there are no t…
sorenfnt Mar 7, 2022
1ed452e
return None from all vision methods if there are no targets
sorenfnt Mar 8, 2022
a080cfb
Merge pull request #50 from FRC1076/visionExceptions
sorenfnt Mar 8, 2022
e125428
added many shuffleboard values
1076software Mar 8, 2022
dbbc087
old people adding shuffleboards
1076software Mar 8, 2022
b0e0018
Merge github.com:FRC1076/2022-Competition into clean_the_code
1076software Mar 8, 2022
38888aa
Fixed corner case when no targets
1076software Mar 8, 2022
e5a7660
Merge pull request #51 from FRC1076/shuffleboard
numerator Mar 8, 2022
c52b788
tested for nulls in teleopPeriodic and teleopDrivetrain
1076software Mar 8, 2022
510a47b
merged nullChecks -- checking for null robot properties in teleop
numerator Mar 8, 2022
0992ffb
Removed some unnecasarry print statements and enabled deadzone on dri…
1076software Mar 8, 2022
d93d461
Merge branch 'main' of https://github.com/FRC1076/2022-Competition
1076software Mar 9, 2022
1b8cd43
restored auton branch
1076software Mar 9, 2022
add249d
Merge branch 'main' into new_auton
numerator Mar 9, 2022
45c37aa
Merge pull request #52 from FRC1076/new_auton
numerator Mar 9, 2022
0beb4dd
fixed small bugz
numerator Mar 9, 2022
c4c1944
All three shooter systems work
1076software Mar 9, 2022
0bf8637
all three shooter systems work
1076software Mar 9, 2022
23951d3
Merge branch 'main' of https://github.com/FRC1076/2022-Competition
1076software Mar 9, 2022
cd557b5
Merge branch 'limitClimber' into main
sorenfnt Mar 9, 2022
040077a
finished comp1AutonSimple() and tested successfully in sim
1076software Mar 9, 2022
f6435d3
Config Changes
1076software Mar 9, 2022
ae70c1d
Config change
1076software Mar 9, 2022
ec9cf9d
Reformat and fix obvious errors
Mar 9, 2022
4c2a021
Various fixes
Mar 9, 2022
614f6c4
Added tilt-shooter override button (Y)
1076software Mar 9, 2022
3675c94
Merge branch 'main' of github.com:FRC1076/2022-Competition
1076software Mar 9, 2022
5c5526f
cleaned up code and added values to robotconfig
1076software Mar 9, 2022
3f84bf1
Merge branch 'main' into comp_auton_1
1076software Mar 9, 2022
b269c5a
Merge pull request #54 from FRC1076/comp_auton_1
1076software Mar 9, 2022
99ac0e9
fixed robotconfig
1076software Mar 9, 2022
40b5ebe
Fix bugs and reformat a little
Mar 9, 2022
5771d83
Merge branch 'main' into bug-fixes
sswangg Mar 9, 2022
4036dc2
Merge pull request #55 from FRC1076/bug-fixes
sswangg Mar 9, 2022
0f10433
added rotationCorrection variable to arcadeDrive and robotconfig
1076software Mar 9, 2022
7bcb32d
Merge branch 'main' of github.com:FRC1076/2022-Competition
1076software Mar 9, 2022
f189c5c
unit testing: testTiltShooter = Passed
1076software Mar 9, 2022
5bdc729
somewhat working climb
1076software Mar 10, 2022
90788fd
Merge branch 'main' of github.com:FRC1076/2022-Competition
1076software Mar 10, 2022
4d11e96
Enable Auton.
1076software Mar 10, 2022
73df026
fixes
1076software Mar 10, 2022
7d36665
Clean up Auton Code.
1076software Mar 10, 2022
91983a3
Rewrite code to allow independent action on climbers.
1076software Mar 11, 2022
1cece47
Make tilt shooter work of D-Pad so it doesn't use same control as rig…
1076software Mar 11, 2022
01119b5
refactored robotconfig
numerator Mar 11, 2022
d074b6f
fixed a thing
numerator Mar 11, 2022
3726b3a
fixed motor conflicts
numerator Mar 11, 2022
5cbccda
Day 1 of Competition changes.
1076software Mar 12, 2022
c2b2d96
Add tilting to target at beginning of auton.
1076software Mar 12, 2022
bf97178
Bug fixes and config shooter speed.
1076software Mar 12, 2022
b4934b6
added disabledInit
numerator Mar 12, 2022
8d8778e
merged in gull_lake_day_2
numerator Mar 12, 2022
310ca74
patched in gull lake config options
numerator Mar 12, 2022
f7f1317
made sure all params copied from gull_lake_day_2
numerator Mar 12, 2022
b628ed7
Finish auton tilt.
1076software Mar 13, 2022
83559a9
merged gull lake changes
numerator Mar 14, 2022
f4367b9
Merge pull request #56 from FRC1076/newconfig
numerator Mar 15, 2022
30a5f95
Cleaned up last years code to just include drivetrain and an example …
IngmarNT Oct 30, 2022
bf85c4e
Initial Swerve Drive
Alexyglenn Nov 20, 2022
3e41346
fixed bugs/error messages until code ran in sim
IngmarNT Nov 23, 2022
01cb566
Compiles Fully
Alexyglenn Nov 27, 2022
210cd39
Merge branch 'SwerveDrive' of https://github.com/FRC1076/2022-WAPUR i…
Alexyglenn Nov 27, 2022
74df677
cleaned up initDrivetrain and the __init__ functions in SwerveDrive a…
IngmarNT Nov 28, 2022
44c1386
fixed issue where drivetrainInit was not being called, ran into issue…
IngmarNT Nov 30, 2022
2be7ea5
changed encoder references from voltages to angles
IngmarNT Dec 1, 2022
13cabf5
configured single module test (havent run it yet)
IngmarNT Dec 1, 2022
1320112
removed unnecessary print statements
IngmarNT Dec 1, 2022
e41bf6b
fixed errors so code ran in sim (should be testable on robot)
IngmarNT Dec 1, 2022
5182d8b
tested one driving one swerve module; running the motors directly wit…
IngmarNT Dec 2, 2022
19da1db
changes to PID configuration and values, still not working
IngmarNT Dec 2, 2022
2482d1a
tuned pid values, successful one module swerve test
IngmarNT Dec 4, 2022
3925f8c
implemented module flipping
IngmarNT Dec 9, 2022
bdc910a
Merge pull request #1 from FRC1076/swerve_onemodule
numerator Dec 11, 2022
6a4bd02
preparing for 4 module test
1076software Dec 11, 2022
e38c89e
added encoder zeros and fixed rotation issues (successful test on woo…
1076software Dec 11, 2022
1ddf152
Merge pull request #2 from FRC1076/swerve_fourmodule
IngmarNT Dec 12, 2022
55abda9
first commit (implemented gyro initialization and functions for getti…
IngmarNT Dec 13, 2022
412d6f4
broken math functions
IngmarNT Dec 13, 2022
5162974
successful field-oriented test, with the exception of one uncooperati…
IngmarNT Dec 13, 2022
4528338
working gyro test
IngmarNT Dec 14, 2022
024d4dd
Merge pull request #62 from FRC1076/gyro
IngmarNT Dec 15, 2022
f41cb5a
Revert "Gyro INTO MAIN (real)"
IngmarNT Dec 15, 2022
6098139
Merge pull request #63 from FRC1076/revert-62-gyro
IngmarNT Dec 15, 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
8 changes: 5 additions & 3 deletions aimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def getYaw(self):

# def getAngle(self):
## self.ag = abs(self.gyro.getAngle()) % 360
return self.ag
#return self.ag

def calculate(self, m):
return (self.turnController.calculate(m))
Expand All @@ -51,6 +51,8 @@ def calculate(self, m):
# self.setRotateToAngleRate = output

def calcDiff(self, theta):
if(not theta):
return None
angle = self.getYaw()
return(abs(angle - theta))

Expand All @@ -65,12 +67,12 @@ def calculateDriveSpeeds(self, theta):
# rotationRate = self.turnController.calculate(angle, theta)
# return(rotationRate, 0)

diff = calcDiff(theta)
diff = self.calcDiff(theta)
correctionFactor = (diff / 10.0)
if correctionFactor > 1.0:
correctionFactor = 1.0

if (getInRange(diff)):
if (self.getInRange(diff)):
print("diff <= ", self.accuracyDegrees)
return (0, 0)
else:
Expand Down
59 changes: 41 additions & 18 deletions climber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,32 @@ def __init__(self, solenoidGroup, winch, extendSpeed, retractSpeed):
self.winch = winch
self.climbstep = 0
# Actions to Climb
self.climbActions = [[self.winchForward, 0.5], [self.pistonForward, 0.5], [self.winchForward, 2.5],
[self.pistonReverse, 0.5], [self.winchReverse, 3.0], [self.winchOff, 0.1]]
self.climbActions = [[self.winchExtend, 0.5], [self.pistonForward, 0.5], [self.winchExtend, 2.5],
[self.pistonReverse, 0.5], [self.winchRetract, 3.0], [self.winchOff, 0.1]]
self.extendSpeed = extendSpeed
self.retractSpeed = retractSpeed

def climberOff(self):
self.winch.set(0.0)
self.solenoids.set(kOff)

def setWinch(self, x): # positive corresponds to extend, negative corresponds to retract
print("setWinch = ", x)
if x >= 0:
self.winch.set(self.extendSpeed*x)
def getWinch(self):
return(self.winch.get())

def setWinch(self, leftSpeedMod, rightSpeedMod):

# positive corresponds to extend, negative corresponds to retract
if (leftSpeedMod >= 0):
leftSpeed = self.extendSpeed * leftSpeedMod
else:
self.winch.set(self.retractSpeed*x)
leftSpeed = self.retractSpeed * leftSpeedMod

if (rightSpeedMod >= 0):
rightSpeed = self.extendSpeed * rightSpeedMod
else:
rightSpeed = self.retractSpeed * rightSpeedMod

self.winch.set(leftSpeed, rightSpeed)

def pistonForward(self):
self.solenoids.set(kForward)
Expand Down Expand Up @@ -75,7 +86,7 @@ def toggle(self):
s.toggle()

class WinchGroup:
def __init__(self, right_winch, left_winch, right_limit, left_limit, cable_wrapped)
def __init__(self, right_winch, left_winch, right_limit, left_limit, cable_wrapped):
self.right_winch = right_winch
self.left_winch = left_winch

Expand All @@ -97,21 +108,33 @@ def __init__(self, right_winch, left_winch, right_limit, left_limit, cable_wrapp
# makes right winch spin in negative (clockwise)
# which draws the cable down

def set(speed):
speed = speed*self.winch_mod

def get(self):
return (self.right_winch.get(), self.left_winch.get())

def set(self, left_speed, right_speed):

# meaning right motor not allowed to spin clockwise (negative) more
# assuming cable wrapped under

if self.atRightLimit() or self.atLeftLimit():
if speed < 0:
speed = 0
leftSpeed = left_speed * self.winch_mod
rightSpeed = right_speed * self.winch_mod

'''
#print("limits: ", self.atRightLimit(), self.atLeftLimit())
if self.atRightLimit():
if rightSpeed > 0:
rightSpeed = 0
if self.atLeftLimit():
if leftSpeed > 0:
leftSpeed = 0
'''


self.right_winch.set(speed)
self.left_winch.set(-speed)
self.right_winch.set(-rightSpeed)
self.left_winch.set(-leftSpeed)

def atRightLimit(self):
return self.right_limit.get()
return not(self.right_limit.get())

def atLeftLimit(self):
return self.left_limit.get()
return not(self.left_limit.get())
14 changes: 8 additions & 6 deletions feeder.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import wpilib


class Feeder:
def __init__(self, motor_controller):
def __init__(self, motor_controller, feederSpeed):
self.motor = motor_controller
self.feederSpeed = feederSpeed
self.motor.setClosedLoopRampRate(1.0)
self.encoder = self.motor.getEncoder()
self.encoder.setPosition(0) # Reset position of motor to zero
self.encoder.setPosition(0) # Reset position of motor to zero

def setFeeder(self, speed):
print("Setting feeder speed: ", speed)
self.motor.set(speed)

def setPosition(self, position):
pass

def getPosition(self):
return(self.encoder.getPosition())
return self.encoder.getPosition()

def hasFired(self):
if(self.getPosition() > 10):
if self.getPosition() > 10:
return True
else:
return False

def reset(self):
self.setPosition(0)

15 changes: 9 additions & 6 deletions intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
kForward = DoubleSolenoid.Value.kForward
kReverse = DoubleSolenoid.Value.kReverse


# Simplified version of the Climber class
class Intake:
def __init__(self, doubleSolenoid, motor, motorSpeed = 0.5):
#def __init__(self, doubleSolenoid, motor, motorSpeed=0.5):
def __init__(self, doubleSolenoid):
self.solenoid = doubleSolenoid
self.motor = motor
self.motorSpeed = motorSpeed
#self.motor = motor
#self.motorSpeed = motorSpeed

self.solenoid.set(kOff)

def toggle(self):
"""
Toggles the state of the piston between kForward and kReverse.
Expand All @@ -28,9 +30,10 @@ def extend(self):

def retract(self):
self.solenoid.set(kReverse)

'''
def motorOn(self):
self.motor.set(self.motorSpeed)

def motorOff(self):
self.motor.set(0.0)
self.motor.set(0.0)
'''
Loading