Skip to content

Commit 31f4a18

Browse files
committed
Encoded Motor and Differential Drive
Set encoder pins in code to match board.
1 parent 16dfe5a commit 31f4a18

7 files changed

+6
-6
lines changed
193 Bytes
Binary file not shown.
5.54 KB
Binary file not shown.
Binary file not shown.
8.49 KB
Binary file not shown.
5.32 KB
Binary file not shown.

XRPLib/differential_drive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def get_default_differential_drive(cls):
1919

2020
if cls._DEFAULT_DIFFERENTIAL_DRIVE_INSTANCE is None:
2121
cls._DEFAULT_DIFFERENTIAL_DRIVE_INSTANCE = cls(
22-
EncodedMotor.get_default_encoded_motor(index=3),
23-
EncodedMotor.get_default_encoded_motor(index=4),
22+
EncodedMotor.get_default_encoded_motor(index=1),
23+
EncodedMotor.get_default_encoded_motor(index=2),
2424
IMU.get_default_imu()
2525
)
2626

XRPLib/encoded_motor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,28 @@ def get_default_encoded_motor(cls, index:int = 1):
4141
if cls._DEFAULT_RIGHT_MOTOR_INSTANCE is None:
4242
cls._DEFAULT_RIGHT_MOTOR_INSTANCE = cls(
4343
MotorImplementation("MOTOR_R_IN_1", "MOTOR_R_IN_2"),
44-
Encoder(1, "MOTOR_R_ENCODER_A", "MOTOR_R_ENCODER_A")
44+
Encoder(1, "MOTOR_R_ENCODER_A", "MOTOR_R_ENCODER_B")
4545
)
4646
motor = cls._DEFAULT_RIGHT_MOTOR_INSTANCE
4747
elif index == 3:
4848
if cls._DEFAULT_MOTOR_THREE_INSTANCE is None:
4949
cls._DEFAULT_MOTOR_THREE_INSTANCE = cls(
5050
MotorImplementation("MOTOR_3_IN_1", "MOTOR_3_IN_2", flip_dir=True),
51-
Encoder(2, "MOTOR_3_ENCODER_A", "MOTOR_3_ENCODER_A")
51+
Encoder(2, "MOTOR_3_ENCODER_A", "MOTOR_3_ENCODER_B")
5252
)
5353
motor = cls._DEFAULT_MOTOR_THREE_INSTANCE
5454
elif index == 4:
5555
if cls._DEFAULT_MOTOR_FOUR_INSTANCE is None:
5656
cls._DEFAULT_MOTOR_FOUR_INSTANCE = cls(
5757
MotorImplementation("MOTOR_4_IN_1", "MOTOR_4_IN_2"),
58-
Encoder(3, "MOTOR_4_ENCODER_A", "MOTOR_4_ENCODER_A")
58+
Encoder(3, "MOTOR_4_ENCODER_A", "MOTOR_4_ENCODER_B")
5959
)
6060
motor = cls._DEFAULT_MOTOR_FOUR_INSTANCE
6161
else:
6262
return Exception("Invalid motor index")
6363
return motor
6464

65-
def __init__(self, motor: Motor, encoder: Encoder):
65+
def __init__(self, motor, encoder: Encoder):
6666

6767
self._motor = motor
6868
self._encoder = encoder

0 commit comments

Comments
 (0)