Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecating current DcMotor run mode naming #1344

Open
Iris-TheRainbow opened this issue Dec 2, 2024 · 5 comments
Open

Deprecating current DcMotor run mode naming #1344

Iris-TheRainbow opened this issue Dec 2, 2024 · 5 comments

Comments

@Iris-TheRainbow
Copy link

Currently, the SDK has three run modes to expose the Lynx firmware functionality for motors, those being RUN_WITHOUT_ENCODER, RUN_USING_ENCODER, and RUN_TO_POSITION for the standard set power mode, the velocity PID, and the positional PID.

As someone who spends a lot of time helping inexperienced programmers learn, I can pretty confidentially say that few new programmers properly interpret what the run modes actually do from their names. Many, many people assume (in my opinion, quite reasonably) that you must set the motor mode to RUN_USING_ENCODER to use .getPosition(). In reality, RUN_USING_ENCODER is a velocity control mode, which can lead to very confusing behavior when used without understanding what that mode actually does.

I propose that in a future SDK release, RUN_USING_ENCODER and RUN_WITHOUT_ENCODER should be deprecated and replaced by RUN_TO_VELOCITY and SET_POWER (or similar, like RUN_SET_POWER for consistency) to clear up the actual function of the run mode.

@AlecHub
Copy link

AlecHub commented Dec 2, 2024

A RUN_AT_CONSTANT_SPEED run mode was requested a long long time ago. Also, a new SDK method was requested to set the desired speed of the motor, such asDcMotor.setSpeed(int encoderTicksPerSecond).

With DcMotor.setPower() you don't know what speed the particular motor controller/firmware is going to run your motor at.

@Froze-N-Milk
Copy link

as far as I'm aware, DcMotorEx.setVelocity() exits, which does what you say

@Iris-TheRainbow
Copy link
Author

Iris-TheRainbow commented Dec 2, 2024 via email

@AlecHub
Copy link

AlecHub commented Dec 2, 2024

Thank you @Froze-N-Milk !!!

@garrettsummerfi3ld
Copy link

I have personally ran into those issues in 2016 when I was actively competing. Seeing as this hasn't changed is quite surprising as this was unbelievably easy to get wrong and lose sanity over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants