-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tyler Duckworth
authored and
Tyler Duckworth
committed
Sep 21, 2019
1 parent
ce28342
commit 92dae7f
Showing
10 changed files
with
111 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.pythonPath": "/Users/s848387/.local/share/virtualenvs/bruhbot-RyimO_7k/bin/python" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ verify_ssl = true | |
pyfrc = "*" | ||
black = "*" | ||
flake8 = "*" | ||
robotpy-ctre = "*" | ||
|
||
[requires] | ||
python_version = "3.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# BruhBot - Rename coming soon | ||
|
||
A revamp of the code for our 2019-2020 Robot, Rosetta, in the MagicBot Framework. | ||
|
||
## Running | ||
|
||
Make sure you have Python 3.7 or above, PIP, and pipenv installed. When you do, type ```pipenv install``` to install the dependencies, ```pipenv start``` to open a shell for that virtual environment, and ```python3 robot.py [flag]``` to run the code in whatever fashion you want. | ||
|
||
## Why does this exist? | ||
|
||
Since we have started using RobotPy, the Python framework for FIRST Robotics, we have admired, but never used, the MagicBot framework for our code. | ||
|
||
This is an attempt to rewrite a previous codebase in the hopes of gaining enough experience to use it for next year's robot. | ||
|
||
## Versioning | ||
|
||
This project will follow a simple Semantic Versioning process. That is to say, MAJOR.MINOR.PATCH (Example: 0.5.2, 0.4.1, 0.4.0, etc.) | ||
|
||
Version 1.0.0 Will mark the completion of our project, with any other commits being bug fixes or updates to libraries. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SETUP | ||
# DigitalInput(0) - Limit Switch | ||
# Interrupts the shooter when pressed | ||
# Spark(1) - Shooter | ||
# DoubleSolenoid(2, 3) - Intake Solenoid | ||
|
||
# WHAT DOES IT DO | ||
from wpilib import DigitalInput, Spark, DoubleSolenoid | ||
|
||
|
||
class Arm: | ||
intakeSolenoid: DoubleSolenoid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
import wpilib | ||
import wpilib.drive | ||
from wpilib.drive import MecanumDrive | ||
|
||
from ctre import WPI_TalonSRX | ||
|
||
|
||
class Drivetrain: | ||
# We also use injection here to access the l_motor and r_motor declared in BruhBot's | ||
# createObjects method. | ||
l_motor: wpilib.Talon | ||
r_motor: wpilib.Talon | ||
m_lfront: WPI_TalonSRX | ||
m_rfront: WPI_TalonSRX | ||
m_lback: WPI_TalonSRX | ||
m_rback: WPI_TalonSRX | ||
|
||
xSpeed = 0 | ||
ySpeed = 0 | ||
zRotation = 0 | ||
gyroAngle = 0 | ||
|
||
# Declare the basic drivetrain setup. | ||
def setup(self): | ||
self.dif_drive = wpilib.drive.DifferentialDrive(self.l_motor, self.r_motor) | ||
self.mec_drive = MecanumDrive( | ||
self.m_lfront, self.m_lback, self.m_rfront, self.m_rback | ||
) | ||
self.mec_drive.setExpiration(0.1) | ||
self.mec_drive.setSafetyEnabled(True) | ||
|
||
# Change x and y variables for movement. | ||
def move(self, x, y): | ||
self.x = x | ||
self.y = y | ||
|
||
# Each time move is called, call arcadeDrive with supplied x and y coordinates. | ||
def move(self, x, y, z, gyroAngle): | ||
self.xSpeed = x if abs(x) > 0.03 else 0 | ||
self.ySpeed = y if abs(y) > 0.03 else 0 | ||
self.zRotation = z | ||
self.gyroAngle = gyroAngle | ||
|
||
# Each time move is called, call arcadeDrive with supplied | ||
# x and y coordinates. | ||
def execute(self): | ||
self.dif_drive.arcadeDrive(self.x, self.y) | ||
self.mec_drive.driveCartesian( | ||
self.xSpeed, self.ySpeed, self.zRotation, self.gyroAngle | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from wpilib import DigitalInput, Spark | ||
|
||
|
||
class Shooter: | ||
limitSwitch: DigitalInput | ||
shooter: Spark | ||
|
||
def __init__(self): | ||
self.speed = 0 | ||
self.switchState = False | ||
self.enabled = False | ||
|
||
def enable(self): | ||
self.enabled = True | ||
|
||
def is_pressed(self): | ||
self.switchState = self.limitSwitch.get() | ||
|
||
def set_speed(self, new_speed): | ||
self.speed = new_speed | ||
|
||
def execute(self): | ||
if self.enabled and self.switchIsOn: | ||
self.shooter.set(self.speed) | ||
else: | ||
self.shooter.set(0) | ||
self.enabled = False | ||
self.switchIsOn = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
''' | ||
This test module imports tests that come with pyfrc, and can be used | ||
to test basic functionality of just about any robot. | ||
''' | ||
|
||
from pyfrc.tests import * | ||
from magicbot.magicbot_tests import * |