Neo Brushless Motors Encoders and Degree movement etc

Hello, we are making a 2024 OffSeason FRC Robot and we want to make our shooter platform move like a servo. We planning to use Neo Brushless Motors (REV-21-1650) and we want to code it by using degrees and encoders for motor movement. We don’t know about encoders and NEO motors. (We didn’t use Swerve until this year, we will buy it. We used CIM motors since our team was established. ) Can you help us with BASİC encoder coding and using the degree system at our shooting platform motor? (Please basic first .D, i can’t understand complex ones at first) (Also if you can we hope to give some tips about swerve and limelight3g setup, configuring) Thank you for your attention<3

You can use the REVLib API to command the motor in position PID mode. This allows you to tell the motor a position to go to, and it will try to get there. Using the API you can also set a “conversion factor” so that the reported units for the motor encoder and any connected absolute encoder can be whatever you want. The default units are rotations and RPM.

You can look around Chief Delphi to learn more about PID, it requires tuning some values.

ı don’t know about terms like PID etc. I just want to make some analyzes at some basic code about them. And also in some english guides,i can have some difficulity about understand them

This WPILib documentation article may be a good place to start. It’s interactive, too!

If you have specific questions about a particular sentence, I’m sure CD responders will help you.

Basically if the turret points too far left, then turn right and if too far right, then turn left. The tuning aspect is how fast can you turn without going faster than your encoder can determine if you have gone too far or not. If you go too fast, you overshoot the target and then have to go back the other direction which again may overshoot.

You can concentrate on the Kp, proportionality constant, to start learning. That relates how much you have to turn (the position’s error) with the voltage (speed) of the motor. Kp is an amount of voltage per unit of error.

Thus, when you multiply the error by Kp, more error will give you more voltage and as the error decreases the motor will go slower and approach the target.

If you pick Kp too big, then the motor goes too fast and overshoots the target. If Kp is too small, you might not get to the target position or approach too slowly to be of use.

1 Like