nhs-t10 / Robotics_2021_2022

2 stars 0 forks source link

Make the PIDlessEncoderMovementThread self-correcting #47

Closed chlohal closed 2 years ago

chlohal commented 2 years ago

Current State:

We have a hard-coded -1 * on line 40 of PIDlessEncoderMovementThread.java to account for weirdness in the directions. We don't know where the weirdness came from.

Ideal:

The PIDlessEncoderMovementThread should be able to adapt to any direction. We can see the motor ticks accurately, so why don't we:

With the x-axis being time, here's an an explanation of how it might work. In the purple region, we're giving a positive change, but getting a negative output. diagram of explanation

Ideally, this will make it super easy in the future: the motors can run whichever way they want, and as long as they report accurate ticks, PIDlessEncoderMovementThread will just adapt to them!

Why Not Just Have The -1?

It works now, but if someone plugs in a motor incorrectly, we have to hunt down the issue and fix it again. That's wasted time that we could spend on something else!

chlohal commented 2 years ago

We don't know where the weirdness came from.

I have a suspicion that it's from DcMotors being plugged in backwards, which inverts their directions, but I'm not sure

Arnon-K commented 2 years ago

Robot still Works; need to test by switching motor around!!!