Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0213e80
Update testBuild.yml
julianallchin Feb 5, 2020
263b5ee
Update testBuild.yml
julianallchin Feb 5, 2020
2b793a8
Update requirements.txt
julianallchin Feb 5, 2020
adae1d8
Create workflow-requirements.txt
julianallchin Feb 5, 2020
706aca0
Update testBuild.yml
julianallchin Feb 5, 2020
c12a120
Update workflow-requirements.txt
julianallchin Feb 5, 2020
032fb06
Rebase (#29)
julianallchin Feb 7, 2020
41f2d0c
Created class for handling multiple controllers
someotherotherguy Feb 8, 2020
d763c3f
Update joystick_drive.py
someotherotherguy Feb 9, 2020
3ecc4a8
Revert "Update joystick_drive.py"
someotherotherguy Feb 9, 2020
5b0eb22
Added message for unknown joystick
someotherotherguy Feb 9, 2020
ff9c0cb
add game pad drive
bencady Feb 11, 2020
3258d6c
Merge branch 'alek/controller_class' of https://github.com/redshiftro…
bencady Feb 11, 2020
be1a2c3
Merge branch 'staging' of https://github.com/redshiftrobotics/8032 in…
julianallchin Feb 11, 2020
671bd61
Feature/pneumatics (#32)
julianallchin Feb 11, 2020
12ecf10
:ambulance: Movement speed with intake
julianallchin Feb 11, 2020
986a21c
Update ports
kavidey Feb 12, 2020
77290df
add buttons
bencady Feb 12, 2020
0a51979
made operator joystick
Jenna-LI Feb 12, 2020
00208bc
Merge branch 'alek/controller_class' of https://github.com/redshiftro…
Jenna-LI Feb 12, 2020
40b217a
small bug fixes
kavidey Feb 12, 2020
0f2478e
fixed control logic
kavidey Feb 12, 2020
59e5535
Update README.md
julianallchin Feb 12, 2020
740a7bc
added hang code
kavidey Feb 12, 2020
a53622b
Merge branch 'staging' of https://github.com/redshiftrobotics/8032 in…
kavidey Feb 12, 2020
1d336b5
Updated Talon ports, and reviewed gamepad control.
MasterSnort Feb 13, 2020
37c9b67
Hotfix
julianallchin Feb 13, 2020
10952e2
:sparkles: Drive Code
julianallchin Feb 14, 2020
0140f10
Update joystick_drive.py
someotherotherguy Feb 14, 2020
9cf7f8a
working hang mechanism
kavidey Feb 14, 2020
ed8bc96
added limelight code
kavidey Feb 16, 2020
264aa80
limelight auto base code
kavidey Feb 16, 2020
57bed50
updated pneumatics
kavidey Feb 16, 2020
abd7a40
auto v2
kavidey Feb 16, 2020
3401e7d
Working Auto
kavidey Feb 16, 2020
3e53700
updated back up behavior
kavidey Feb 16, 2020
9536e9c
Updated mechanism controls for Sophie
kavidey Feb 19, 2020
1badfd6
updated transit control logic
kavidey Feb 19, 2020
ac0353e
Practice Field Updates (#35)
kavidey Feb 24, 2020
908df15
transit control with the joystick POV
kavidey Feb 24, 2020
02167d9
Fix bug in getDistance that causes auto to crash
kavidey Feb 25, 2020
e07dab6
Added auto selector and updated hang code
kavidey Feb 25, 2020
c02f69d
added initaition line auto
kavidey Feb 26, 2020
cc46cb0
Minor bug fixes
itmeson Feb 26, 2020
0521e2b
Added encoder based position control to hang
kavidey Feb 26, 2020
862d533
Added camera server code
kavidey Feb 26, 2020
916ad39
updated hang code
kavidey Feb 26, 2020
297903d
Fixed hang motor directions and operator POV input
kavidey Feb 27, 2020
74b4581
Commented Teleop
kavidey Feb 27, 2020
18081af
updatee
kavidey Feb 28, 2020
9905513
Added independent control of hang arms
kavidey Feb 28, 2020
3feff69
Added shuffleboard layout and updated drive code
kavidey Feb 29, 2020
85deebe
Glacier Peak Competition Code
kavidey Mar 7, 2020
8ffffce
Merge branch 'alek/controller_class' into staging
someotherotherguy Mar 7, 2020
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
6 changes: 2 additions & 4 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wpilib==2019.2.3
pip install pyfrc==2019.1.0
pip install pynetworktables==2019.0.2
pip install robotpy-ctre==2019.3.2
pip install -r workflow-requirements.txt

- name: Build
run: |
python robot/robot.py add-tests
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.vscode/
tests/
__pycache__/
characterization-project/
characterization-project/
imgui.ini
.DS_Store
robot/imgui.ini
3 changes: 3 additions & 0 deletions .installer_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[auth]
hostname = 8032

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 8032 Codebase ![FRC Build](https://github.com/redshiftrobotics/8032/workflows/FRC%20Build/badge.svg?branch=master)
# 8032 Codebase ![FRC Build](https://github.com/redshiftrobotics/8032/workflows/FRC%20Build/badge.svg?branch=staging)

## Getting Started

Expand Down
52 changes: 52 additions & 0 deletions limelight/power_port.vpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
area_max:16.9879162896
area_min:0.0168896016
area_similarity:9
aspect_max:20
aspect_min:0
black_level:13
blue_balance:1592
calibration_type:0
contour_grouping:0
contour_sort_final:0
convexity_max:100
convexity_min:21.1
corner_approx:2
cross_a_a:0.025436
cross_a_x:-0.084132
cross_a_y:0
cross_b_a:1
cross_b_x:0
cross_b_y:0
desc:power_port
desired_contour_region:0
dilation_steps:1
direction_filter:0
dual_close_sort_origin:0
erosion_steps:0
exposure:2
hue_max:83
hue_min:56
image_flip:1
image_source:0
img_to_show:0
intersection_filter:0
pipeline_led_enabled:1
pipeline_res:0
pipeline_type:0
red_balance:727
sat_max:255
sat_min:169
send_corners:0
send_raw_contours:0
solve3d:0
solve3d_algo:0
solve3d_conf:0.990000
solve3d_error:8
solve3d_guess:0
solve3d_iterations:50
solve3d_precies:1
solve3d_precise:0
val_max:255
val_min:88
y_max:1.000000
y_min:-1.000000
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ wpilib>=2020.1.2.1
pyfrc>=2020.0.1
robotpy-ctre>=2020.1.0
pynetworktables>=2020.0.1
opencv-python>=4.2.0.32
3 changes: 3 additions & 0 deletions robot/.deploy_cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[auth]
hostname = 8032

44 changes: 44 additions & 0 deletions robot/drive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
import wpilib
from ctre import WPI_TalonSRX, ControlMode

class Drive:

def __init__(self, rightMaster, leftMaster, rightAlt, leftAlt):
self.rightMaster = rightMaster
self.leftMaster = leftMaster
self.rightAlt = rightAlt
self.leftAlt = leftAlt

self.leftSpeed = 0
self.rightSpeed = 0
self.controlMode = ControlMode.PercentOutput


def arcadeDrive(self, xAxis, tAxis, controlMode):
self.leftSpeed = xAxis + tAxis
self.rightSpeed = xAxis - tAxis
self.controlMode = controlMode

def tankDrive(self, leftAxis, rightAxis, controlMode):
self.leftSpeed = leftAxis
self.rightSpeed = rightAxis
self.controlMode = controlMode

def update(self):
self.leftMaster.set(self.controlMode, self.leftSpeed)
self.rightMaster.set(self.controlMode, self.rightSpeed)

def getEncoderAverage(self):
return (self.leftMaster.getSelectedSensorPosition() + self.rightMaster.getSelectedSensorPosition())/2

def getLeftEncoder(self):
return self.leftMaster.getSelectedSensorPosition()

def getRightEncoder(self):
return self.rightMaster.getSelectedSensorPosition()

def stop(self):
self.leftSpeed = 0
self.rightSpeed = 0
self.controlMode = ControlMode.PercentOutput
83 changes: 83 additions & 0 deletions robot/hang.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
import wpilib
from ctre import WPI_TalonSRX, ControlMode, NeutralMode, FeedbackDevice

class Hang:

def __init__(self, left_motor_id, right_motor_id, max_speed, stop_point, kP=0.05, kD=0, kI=0):
self.kPIDLoopIdx = 0
self.kTimeoutMs = 10
self.kP = kP
self.kD = kD
self.kI = kI

self.left_motor = WPI_TalonSRX(left_motor_id)
self.left_motor.setInverted(False)
self.left_motor.configSelectedFeedbackSensor(
FeedbackDevice.CTRE_MagEncoder_Relative,
self.kPIDLoopIdx,
self.kTimeoutMs,
)

self.left_motor.config_kP(self.kPIDLoopIdx, self.kP, self.kTimeoutMs)
self.left_motor.config_kD(self.kPIDLoopIdx, self.kD, self.kTimeoutMs)
self.left_motor.config_kI(self.kPIDLoopIdx, self.kI, self.kTimeoutMs)

self.right_motor = WPI_TalonSRX(right_motor_id)
self.right_motor.setInverted(True)
self.right_motor.configSelectedFeedbackSensor(
FeedbackDevice.CTRE_MagEncoder_Relative,
self.kPIDLoopIdx,
self.kTimeoutMs,
)

self.right_motor.config_kP(self.kPIDLoopIdx, self.kP, self.kTimeoutMs)
self.right_motor.config_kD(self.kPIDLoopIdx, self.kD, self.kTimeoutMs)
self.right_motor.config_kI(self.kPIDLoopIdx, self.kI, self.kTimeoutMs)

self.right_tgt = 0
self.left_tgt = 0
self.hang_mode = ControlMode.PercentOutput
self.max_speed = max_speed
self.stop_point = stop_point

def set_pid(self, kP, kD, kI):
self.kP = kP
self.kD = kD
self.kI = kI

self.left_motor.config_kP(self.kPIDLoopIdx, self.kP, self.kTimeoutMs)
self.left_motor.config_kD(self.kPIDLoopIdx, self.kD, self.kTimeoutMs)
self.left_motor.config_kI(self.kPIDLoopIdx, self.kI, self.kTimeoutMs)

self.right_motor.config_kP(self.kPIDLoopIdx, self.kP, self.kTimeoutMs)
self.right_motor.config_kD(self.kPIDLoopIdx, self.kD, self.kTimeoutMs)
self.right_motor.config_kI(self.kPIDLoopIdx, self.kI, self.kTimeoutMs)

def retract(self):
"""Retracts hang"""
self.right_tgt = -self.max_speed
self.left_tgt = -self.max_speed
self.hang_mode = ControlMode.PercentOutput

def move(self, left, right):
"""Moves hang"""
self.right_tgt = self.max_speed * right
self.left_tgt = self.max_speed * left
self.hang_mode = ControlMode.PercentOutput

def stop(self):
"""Stops hang"""
self.right_tgt = 0
self.left_tgt = 0

def left(self, l):
self.left_tgt = l

def right(self, r):
self.right_tgt = r

def update(self):
"""Updates the values if they are changed"""
self.right_motor.set(self.hang_mode, self.right_tgt)
self.left_motor.set(self.hang_mode, self.left_tgt)
149 changes: 149 additions & 0 deletions robot/imgui.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][Robot State]
Pos=5,20
Size=92,99
Collapsed=0

[Window][Analog Inputs]
Pos=936,31
Size=204,65
Collapsed=0

[Window][FMS]
Pos=7,810
Size=235,169
Collapsed=0

[Window][System Joysticks]
Pos=13,597
Size=192,150
Collapsed=0

[Window][DIO]
Pos=705,30
Size=104,48
Collapsed=0

[Window][Encoders]
Pos=960,322
Size=85,48
Collapsed=0

[Window][PWM Outputs]
Pos=1259,30
Size=104,48
Collapsed=0

[Window][Relays]
Pos=270,30
Size=73,48
Collapsed=0

[Window][Other Devices]
Pos=1259,29
Size=250,695
Collapsed=0

[Window][Solenoids]
Pos=435,30
Size=92,48
Collapsed=0

[Window][Timing]
Pos=6,223
Size=135,104
Collapsed=0

[Window][Joysticks]
Pos=350,516
Size=796,240
Collapsed=0

[SimWindow][GLOBAL]
width=1920
height=1017
maximized=1
xpos=0
ypos=23
userScale=2
style=0
disableOutputsOnDS=1
[SimWindow][Addressable LEDs]
visible=0
enabled=1

[SimWindow][Analog Inputs]
visible=1
enabled=1

[SimWindow][FMS]
visible=1
enabled=1

[SimWindow][System Joysticks]
visible=1
enabled=1

[SimWindow][Joysticks]
visible=1
enabled=1

[SimWindow][DIO]
visible=1
enabled=1

[SimWindow][Encoders]
visible=1
enabled=1

[SimWindow][PDP]
visible=0
enabled=1

[SimWindow][PWM Outputs]
visible=1
enabled=1

[SimWindow][Relays]
visible=1
enabled=1

[SimWindow][RoboRIO]
visible=0
enabled=1

[SimWindow][Other Devices]
visible=1
enabled=1

[SimWindow][Solenoids]
visible=1
enabled=1

[SimWindow][Timing]
visible=1
enabled=1

[Joystick][0]
guid=78696e70757401000000000000000000
useGamepad=0

[DriverStation][Main]
disable=0

[Device][Talon SRX[0]]
open=1

[Device][Talon SRX[1]]
open=1

[Device][Talon SRX[2]]
open=1

[Device][Talon SRX[3]]
open=1

Loading