|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Mecanum and Encoders
We have mecanum wheels with attached Optical Quadrature Encoders. They're hooked up to our CAN Jaguars.
Right now, the wheels are turning at different speeds. And we want them to turn at the same speed because our mecanum system is hard to manually adjust on the field. Is there a way to use the encoder values to dynamically regulate the speeds of the wheels? Or should we just use the encoders, get some values, find a magic number, and program them in? We're using Java. |
|
#2
|
|||
|
|||
|
Re: Mecanum and Encoders
Quote:
If you use CAN you can use the speed control mode other wise you need to hook the encoders to the cRio and use PIDController. As an example for speed control. Code:
CANJaguar jag = new CANJaguar(channel, CANJaguar.ControlMode.kSpeed); jag.configEncoderCodesPerRev(ENCODER_TICKS); jag.setPID(P, I, D); jag.setSpeedReference(CANJaguar.SpeedReference.kEncoder); jag.enableControl(0); channel with the jag number ENCODER_TICKS with how many pulses per revolution the encoder is P I and D with your Proportional Integral and Derivative terms To figure out your PID values you will need to do some tuning. Head over the the Technical->Electrical->CAN section there are many threads there. When you go to set the value of the jag set it to the speed in RPM not -1 to 1. so for example we limited our output to 400 rpm in normal mode. Code:
jag.set(joystick1.getY() * 400); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|