Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Mecanum and Encoders (http://www.chiefdelphi.com/forums/showthread.php?t=91532)

NicholasRuhland 11-02-2011 19:45

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.

drakesword 11-02-2011 22:25

Re: Mecanum and Encoders
 
Quote:

Originally Posted by NicholasRuhland (Post 1020879)
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.

Look at using the speed control mode of the jaguar. Are you using CAN or pwm?

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);

replace the following:
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);


All times are GMT -5. The time now is 10:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi