Closed SizzinSeal closed 1 month ago
This would complicate the API for adding or removing motors from a motor group that's being used by LemLib, as you would need to do the same thing for both the motor and motor encoder. This would also require an encoder group class, so this is not going to be implemented
Overview
Split the
Motor
class into theMotor
andMotorEncoder
class, and theMotorGroup
class into aMotorGroup
andMotorEncoderGroup
Motivation
A motor is something that moves something else. An encoder measures position. So why do we currently treat them as a the same thing? Well, its because it was thought that it wouldn't be possible to have them both completely independent from each other, that either would need to write to the motor firmware something that would affect the other. However, once Issue #2 is implemented, it's possible. When these objects are split, it will prevent mistakes from happening when interacting with the motors.
Implementation
The
Motor
class implementsmove
,moveVelocity
,getPort
, and, if Issue #1 is implemented,getTemperature
too. TheMotorEncoder
class inherits from the abstractEncoder
class and implements the virtual methods. Same thing for theMotorGroup
andMotorEncoderGroup
class