Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
all must be inverted bause rev
Browse files Browse the repository at this point in the history
  • Loading branch information
kredcool committed Jan 20, 2024
1 parent 7e4a00f commit db42959
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,6 @@ networktables.json

# Add to tree but only when neccicary (adding a map or smthn)
simgui-window.json

# sysid ignores
*.SysId
14 changes: 9 additions & 5 deletions rio/components/drivetrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def periodic(self) -> None:
like updating the dashboard and maintaining odometry.
"""

# Update the odometry in the periodic block
# Update the odometry in the periodic bloc
self.odometry.update(
Rotation2d.fromDegrees(self.gyro.getAngle()),
(
Expand All @@ -117,16 +117,20 @@ def periodic(self) -> None:
self.rearRight.getPosition(),
),
)

# desired
self.sd.putNumber("Swerve/FL", self.frontLeft.desiredState.angle.degrees())
self.sd.putNumber("Swerve/FR", self.frontRight.desiredState.angle.degrees())
self.sd.putNumber("Swerve/RL", self.rearLeft.desiredState.angle.degrees())
self.sd.putNumber("Swerve/RR", self.rearRight.desiredState.angle.degrees())

logging.info(f"FR Swerve module setpoint {self.frontRight.desiredState.angle.degrees()}, actual is {self.frontRight.getPosition().angle.degrees()}")
# actual
self.sd.putNumber("Swerve/FL", self.frontLeft.getState().angle.degrees())
self.sd.putNumber("Swerve/FR", self.frontRight.getState().angle.degrees())
self.sd.putNumber("Swerve/RL", self.rearLeft.getState().angle.degrees())
self.sd.putNumber("Swerve/RR", self.rearRight.getState().angle.degrees())

# print(
# f"FL: {self.frontLeft.turningEncoder.getPosition()} FR: {self.frontRight.turningEncoder.getPosition()} RL: {self.rearLeft.turningEncoder.getPosition()} RR: {self.rearRight.turningEncoder.getPosition()}"
# logging.info(
# f"FR Swerve module setpoint {self.frontLeft.desiredState.angle.degrees()}, actual is {self.frontLeft.getPosition().angle.degrees(),} .getPosition is {self.frontLeft.getPosition()}"
# )

def getPose(self) -> Pose2d:
Expand Down
2 changes: 1 addition & 1 deletion rio/components/mikeSwerveModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, swerveConfig: dict, moduleConfig: str) -> None:
)

# Uncomment to invert the encoders
# self.turningEncoder.setInverted(true)
self.turningEncoder.setInverted(True)

# Enable PID wrap around for the turning motor. This will allow the PID
# controller to go through 0 to get to the setpoint i.e. going from 350 degrees
Expand Down
6 changes: 3 additions & 3 deletions rio/constants/robotHardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ swerve:
Pose: [-1, 1] # Configured Never by Nobody

frontRight:
CANSteerID: 6 # Configured 1/19 by Keegan
CANDriveID: 5 # Configured 1/19 by Keegan
CANSteerID: 99 # 6 Configured 1/19 by Keegan
CANDriveID: 98 # 5 Configured 1/19 by Keegan
Pose: [1, 1] # Configured Never by Nobody

rearLeft:
Expand All @@ -29,7 +29,7 @@ swerve:
kDrivingMinOutput: -1 # Configured Never by Nobody
kDrivingMaxOutput: 1 # Configured Never by Nobody

kTurningP: 0.265 # Updated 1/19 by Keegan
kTurningP: 2.65 # Updated 1/19 by Keegan
kTurningI: 0.012 # Configured Never by Nobody
kTurningD: 1.5 # Configured Never by Nobody
kTurningFF: 0 # Configured Never by Nobody
Expand Down
10 changes: 5 additions & 5 deletions rio/simgui-window.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"###FMS": {
"Collapsed": "0",
"Pos": "5,540",
"Size": "32,35"
"Size": "283,146"
},
"###Joysticks": {
"Collapsed": "0",
"Pos": "250,465",
"Size": "32,35"
"Size": "796,138"
},
"###NetworkTables": {
"Collapsed": "0",
Expand All @@ -51,12 +51,12 @@
"###System Joysticks": {
"Collapsed": "0",
"Pos": "16,322",
"Size": "32,35"
"Size": "192,218"
},
"###Timing": {
"Collapsed": "0",
"Pos": "7,129",
"Size": "32,35"
"Size": "135,173"
},
"Debug##Default": {
"Collapsed": "0",
Expand All @@ -66,7 +66,7 @@
"Robot State": {
"Collapsed": "0",
"Pos": "5,20",
"Size": "32,35"
"Size": "92,99"
}
}
}
Binary file added rio/tests/logs/FRC_20240120_210407.wpilog
Binary file not shown.
Binary file added rio/tests/logs/FRC_20240120_210513.wpilog
Binary file not shown.
Binary file added rio/tests/logs/FRC_20240120_210521.wpilog
Binary file not shown.
Binary file added rio/tests/logs/FRC_20240120_211051.wpilog
Binary file not shown.

0 comments on commit db42959

Please sign in to comment.