Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
used digital Inputs so that the rio can connect to the limit switches…
Browse files Browse the repository at this point in the history
…. This is all bad so I put it on a new branch as to not interfere with anything. If this does manage to work at all it will still need fixes. I'm sorry in advance
  • Loading branch information
NotSimon5673 committed Apr 1, 2022
1 parent ba529e1 commit befda36
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rio/subsystems/drivetrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ def __init__(self, constants, pid):
self.steer_motor_encoder.setPosition(0)

# Zeroing objects

self.forePortLimitSwitch = wpilib.digitalInput(1)
self.foreStarLimitSwitch = wpilib.digitalInput(2)
self.aftPortLimitSwitch = wpilib.digitalInput(3)
self.aftStarLimitSwitch = wpilib.digitalInput(4)

self.isZeroed = False
self.zeroSwitch = self.steer_motor.getForwardLimitSwitch(
SparkMaxLimitSwitch.Type.kNormallyClosed
Expand Down Expand Up @@ -415,7 +421,12 @@ def find_zero(self):
"""

if not self.isZeroed:
if not self.zeroSwitch.get():
if (
not self.forePortLimitSwitch.get()
and not self.foreStarLimitSwitch.get()
and not self.aftPortLimitSwitch.get()
and not self.aftStarLimitSwitch.get()
):
self.steer_motor.set(0.165) # CHANGEME
else:
self.steer_motor_encoder.setPosition(0)
Expand Down

1 comment on commit befda36

@KenwoodFox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all wrong :/ sorry, this constructs 4 limit switch sensors for every wheel, thats 16 switches total.

Please sign in to comment.