More work
This commit is contained in:
parent
ccc85d7c1e
commit
64d58fcfd8
|
|
@ -1,6 +1,6 @@
|
||||||
import math
|
import math
|
||||||
from phoenix6.hardware.pigeon2 import Pigeon2
|
from phoenix6.hardware.pigeon2 import Pigeon2
|
||||||
import navx
|
#import navx
|
||||||
|
|
||||||
|
|
||||||
class Pigeon:
|
class Pigeon:
|
||||||
|
|
@ -33,7 +33,7 @@ class Pigeon:
|
||||||
def set_yaw(self, angle):
|
def set_yaw(self, angle):
|
||||||
self.gyro.set_yaw(angle)
|
self.gyro.set_yaw(angle)
|
||||||
|
|
||||||
|
'''
|
||||||
class NavX:
|
class NavX:
|
||||||
gyro: navx.AHRS # Either navx.AHRS.create_spi() or navx.AHRS.create_i2c()
|
gyro: navx.AHRS # Either navx.AHRS.create_spi() or navx.AHRS.create_i2c()
|
||||||
|
|
||||||
|
|
@ -72,3 +72,4 @@ class NavX:
|
||||||
|
|
||||||
def zero_yaw(self) -> None:
|
def zero_yaw(self) -> None:
|
||||||
self.gyro.zeroYaw()
|
self.gyro.zeroYaw()
|
||||||
|
'''
|
||||||
|
|
@ -24,5 +24,11 @@ class Intake:
|
||||||
def retract(self):
|
def retract(self):
|
||||||
pass # Implement retraction logic here
|
pass # Implement retraction logic here
|
||||||
|
|
||||||
|
def spin(self):
|
||||||
|
self.voltage = 1
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self.voltage = 0
|
||||||
|
|
||||||
def set_voltage(self, voltage: units.volts):
|
def set_voltage(self, voltage: units.volts):
|
||||||
self.voltage = voltage
|
self.voltage = voltage
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import math
|
||||||
|
|
||||||
|
class SwerveModule:
|
||||||
|
name: str
|
||||||
|
drive_id: int
|
||||||
|
drive_P: float
|
||||||
|
drive_I: float
|
||||||
|
drive_D: float
|
||||||
|
turning_id: int
|
||||||
|
turning_P: float
|
||||||
|
turning_I: float
|
||||||
|
turning_D: float
|
||||||
|
encoder_id: int
|
||||||
|
gear_ratio: float
|
||||||
|
wheel_diameter: float
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
self.max_angular_velocity = math.pi
|
||||||
|
self.max_angular_acceleration = math.tau
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
pass
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
class Limelight:
|
||||||
|
def setup(self):
|
||||||
|
pass
|
||||||
|
def execute(self):
|
||||||
|
pass
|
||||||
|
|
@ -1,6 +1,30 @@
|
||||||
|
import enum
|
||||||
|
|
||||||
# Should we apply deadband correction to the controller inputs?
|
# Should we apply deadband correction to the controller inputs?
|
||||||
CONTROLLER_CORRECT_FOR_DEADBAND = True
|
CONTROLLER_CORRECT_FOR_DEADBAND = True
|
||||||
# The deadband for the controller joysticks
|
# The deadband for the controller joysticks
|
||||||
CONTROLLER_DEADBAND = 0.3
|
CONTROLLER_DEADBAND = 0.3
|
||||||
# The port the controller is connected to
|
# The port the controller is connected to
|
||||||
CONTROLLER_PORT = 0
|
CONTROLLER_PORT = 0
|
||||||
|
|
||||||
|
@enum.unique
|
||||||
|
class CANID(enum.IntEnum):
|
||||||
|
# CAN IDs for motors and other devices
|
||||||
|
FRONT_LEFT_DRIVE = 12
|
||||||
|
FRONT_LEFT_STEER = 3
|
||||||
|
FRONT_LEFT_STEER_ENCODER = 10
|
||||||
|
|
||||||
|
FRONT_RIGHT_DRIVE = 5
|
||||||
|
FRONT_RIGHT_STEER = 6
|
||||||
|
FRONT_RIGHT_STEER_ENCODER = 4
|
||||||
|
|
||||||
|
REAR_RIGHT_DRIVE = 9
|
||||||
|
REAR_RIGHT_STEER = 11
|
||||||
|
REAR_RIGHT_STEER_ENCODER = 4
|
||||||
|
|
||||||
|
REAR_LEFT_DRIVE = 8
|
||||||
|
REAR_LEFT_STEER = 2
|
||||||
|
REAR_LEFT_STEER_ENCODER = 7
|
||||||
|
|
||||||
|
# Pigeon2 IMU
|
||||||
|
PIGEON = 20
|
||||||
|
|
@ -22,4 +22,4 @@ components = [
|
||||||
|
|
||||||
# Other pip packages to install, such as vendor packages (each element
|
# Other pip packages to install, such as vendor packages (each element
|
||||||
# is equivalent to a line in requirements.txt)
|
# is equivalent to a line in requirements.txt)
|
||||||
requires = ["phoenix6"]
|
requires = ["phoenix6", "robotpy-pykit"]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import components
|
import components
|
||||||
import constants
|
import constants
|
||||||
import genie
|
import genie
|
||||||
|
from pykit.logger import Logger
|
||||||
|
|
||||||
class MyRobot(genie.GenieRobot):
|
class MyRobot(genie.GenieRobot):
|
||||||
controller: components.XboxController
|
controller: components.XboxController
|
||||||
pigeon: components.Pigeon
|
#pigeon: components.Pigeon
|
||||||
|
logger: Logger
|
||||||
|
|
||||||
def createObjects(self):
|
def createObjects(self):
|
||||||
"""Create motors and stuff here"""
|
"""Create motors and stuff here"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue