forked from FRC2539/pybottemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
104 lines (80 loc) · 2.43 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from ctre import (
CANCoderConfiguration,
AbsoluteSensorRange,
SensorInitializationStrategy,
)
class Constants:
"""
Dummy class for robot constants.
"""
pass
"""
Use this class to declare variables that may have to be
adjusted a lot. This makes it more global and easier to find.
Please note that this is not the ports.py. That should host
IDs for the CANbus, sensors, PWM, and the liking.
"""
drivetrain = Constants()
shooter = Constants()
# Drive Velocity Control
drivetrain.dPk = 0.0085
drivetrain.dIk = 0
drivetrain.dDk = 0
drivetrain.dFFk = 0.25 # 1?
drivetrain.dIZk = 0
# Drive Position Control
drivetrain.sdPk = 0.45 # 0.1
drivetrain.sdIk = 0
drivetrain.sdDk = 0
drivetrain.sdFFk = 0.1
drivetrain.sdIZk = 0
# Turn Position Control
drivetrain.tPk = 22.5
drivetrain.tIk = 0
drivetrain.tDk = 0.01
drivetrain.tFFk = 0
drivetrain.tIZk = 0
# Turn Secondary Position Control
drivetrain.stPk = 8.5
drivetrain.stIk = 0
drivetrain.stDk = 0
drivetrain.stFFk = 0
drivetrain.stIZk = 0
# The angle of the gyro.
drivetrain.flatAngle = 0
# Gear ratios on the drivetrain.
drivetrain.driveMotorGearRatio = 6.86
drivetrain.turnMotorGearRatio = 12.8
# Motion magic velocities and accelerations
drivetrain.driveMotionAcceleration = 13500
drivetrain.driveMotionCruiseVelocity = 18500
drivetrain.slowDriveMotionCruiseVelocity = 11000
drivetrain.turnMotionAcceleration = 1000
drivetrain.turnMotionCruiseVelocity = 800
# Trajectory constraints.
drivetrain.maxMetersPerSecond = 1 # Velocity for trajectory
drivetrain.maxMetersPerSecondSquared = 0.1 # Accel for trajectory
# Diameter of the wheel in inches.
drivetrain.wheelDiameter = 4
# Distance between adjacent wheels.
drivetrain.wheelBase = 23.5
drivetrain.trackWidth = 23.5
# Center of the robot to the center of a wheel in inches.
drivetrain.robotRadius = 16.84251
drivetrain.speedLimit = (
30.0 # in inches per second (if you have feet per second, multiply by 12!)
)
drivetrain.encoderConfig = CANCoderConfiguration()
drivetrain.encoderConfig.absoluteSensorRange = AbsoluteSensorRange.Unsigned_0_to_360
drivetrain.encoderConfig.initializationStrategy = (
SensorInitializationStrategy.BootToAbsolutePosition
)
drivetrain.encoderConfig.sensorDirection = False
drivetrain.mostRecentPath = [] # Updated in record auto.
drivetrain.preBuild = {1: ".barrelracing.json"}
# Constants for the shooter below.
shooter.kP = 1
shooter.kI = 0
shooter.kD = 0.01
shooter.kF = 0.0495
shooter.IZone = 0