Hi,I tried to let our arm mechanism turn like 180 degrees,is there any suggestions for that?
Best place to start is to figure out what hardware you have available and/or already using? Everything else depends on that.
Our mentor told me use built-in encoder on NEO.
That makes it fairly streamlined then. Since the Neo’s encoder measures the number of revolutions, you have a couple paths available.
-
First you could just output the encoder value, and manually figure out what number of revolutions you need to spin the motor to in order to reach 180 degrees.
-
Alternatively, you could figure out what gearboxes are attached to the Neo. Say it is a 64:1 ratio. Every 64 revolutions of the motor, the arm will spin 360 degrees. So half that, or 32 revs will be the 180 degrees.
Then just find a control method you like, plug in the encoder and the desired location and boom.
Is there any exsample,I checked so many resources to look for how to let the arm turn 180 degrees(32 revolution of motor),and also checked libraries ,but found nothing
Be aware that if you are using the encoder in the NEO, you will need to have a system to set the zero angle of your arm. When the robot boots, the NEO encoder will start a 0, no matter where the arm actually is. So you either need to always boot the robot with the arm in the same location, or you should consider adding an absolute encoder to get the starting angle.
getAbsoluteEncoder(null);
what should I write in this
First you need to pick the hardware. There are multiple absolute encoders available. 2 that I know of are the Rev Through bore encoder, and the CANcoder. Which you pick and how you wire it will make a difference. You can search for examples, sorry I don’t have an obvious one.
When it doubt, just go to the wpi documents. Here is a list of the most prominent ones.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.