# Drive Control, Wheel Speed Calibration, and Rapid Speed Changes

Today has not been a good day. :mad: Two of our brand new Victor Speed Controllers exploded in flames (yes they were wired correctly) and an Andy Mark Tough box locked up.

However, these are minor setbacks. I want to talk about (3) issues.

1. Drive control. Linear speed control is not a good idea e.g. (pwy=p1_y) since it is very hard to control using the kit joysticks. I read the white paper on creating a lookup table to smooth the throttle. Is there a better way?

2. Speed Calibration. How do you get all of your wheels to spin at the same speed when given the same PWM value? I realize there are quite a few mechanical and electrical variables involved but want to know how you handle the one wheel that lags the others.

3. Rapid Speed Changes. How do you handle rapid speed changes in your code? Example, going from pwm=250 to pwm = 10 (full motor reversal)? This is obviously not good for the drive train. If you have written any code to handle this please share and save all of our drivetrains.

1. A couple things you can do with this one:
-Ramping - You can try and create an exponential curve around the drive values, so that when you’re joystick is at half speed, the motor drives at 1/4 speed, but at full joystick, the motor is full.
-Dead Zone - You want some sort of expanded neutral zone so that positioning the joystick on an unlevel surface doesn’t cause the robot to spontaneously creep about…

2. No idea, sorry. I’d assume equal PWMs give equal speed, but if you’re getting weird results, well, blame the mechanical team. (I have no clue.)

3. I’d think you could check this against a ‘maximum delta’ by saving your last motor speed, and only add that when your joystick value is way out of whack with your last PWM value. (I haven’t written anything like this yet this year, although this reminds me I should, especially when doing this with our drive train de-chains the drive train. Thanks!)

1. You could use an encoder to calculate the actual speed its going at. Then just make sure they are all even. You could use 4 encoders or you could use one and create an algorithm.

2. In hybrid just make it equal 127 before you do a big jump. In tele-operated period the driver should be able to make sure they don’t jerk the sticks around.

Many many questions I see…

1. How do you want to drive your robot? 1 joystick, or 2 joystick. You can possibly buy a chicklet and/or buy a new joystick.

2. We never have really had our wheels spin at the same rate with the same PWM

value. Actually, it is almost impossible. There are so many little variances that will make one side spin faster than the other. You can possibly try to install the Dual Axis Accelerometer or the two gear tooth sensors and write some code that would make it go straight.

3. We never really have dealt with rapid speed changes. Of course it’s not good, but we’ve never run into that type of problem (and we run 25 chain). If you do try to do this, you will lose some control while it slows down and speeds up again. I would recommend making a drive train that can handle this. The Victors do pretty good at handling this abuse (but if they released the magic smoke or “exploded in flames” then you may want to try to look into programming in a throttle). The best solution: Train your drivers NOT to do this unless needed.