![]() |
Slowing down the drive motors
My team is using the standard gearbox for our drive train and with two motors on each side the wheels move way too fast. I'm using the standard tank drive code with two joysticks for driving. The way it is now, unless the joystick is barely pushed forward the robot kindof goes out of control, there is a lot of torque, and the robot shakes too much for comfort. Is there a way to code the robot so that I can still use a standard tank drive but slow the motors down? I hope I'm being clear enough as to what the problem is but I can clarify if I'm not <3
|
Re: Slowing down the drive motors
Quote:
|
Re: Slowing down the drive motors
There are several ways to slow it down in software. When you create the joysticks, you can specify to square the inputs, which helps give more sensitivity near zero commands. Other methods of changing the max voltage output or the gain do hurt the performance of the motors.
One mechanical method to get more control is to get new CIM gears from VEX - if you have 14T, they sell a 13T and if you are using a 12T, they sell an 11T. This will only give you a 10% reduction in top speed, but it will improve overall performance because the CIM motor is rotating faster for the same robot velocity. There are other threads that explain the difference better. |
Re: Slowing down the drive motors
Quote:
Code:
package org.usfirst.frc.team2872.robot; |
Re: Slowing down the drive motors
Quote:
Code:
myRobot.tankDrive(stick1,stick2);Code:
myRobot.tankDrive(stick1.getY() * 0.5, stick2.getY() * 0.5); |
Re: Slowing down the drive motors
Quote:
|
Re: Slowing down the drive motors
Quote:
double throttle=(-1*stick.getThrottle() + 1)/2; This gives us a value between 0 and 1 depending on where the throttle is. Depending on your stick, you may need to call getZ or some other mapping if you have a throttle. I can't say for sure-- we've only used the one joystick with this year's software. |
Re: Slowing down the drive motors
If you raise the stick values to a power, instead of multiplying by a constant, you might be able to get more control at low speed without reducing the maximum speed. Typically, for this application, the value is squared or cubed.
Since all values are between -1 and 1, this actually reduces the value at all points. Just be careful about squaring negatives, you need to preserve the sign somehow. |
Re: Slowing down the drive motors
Quote:
Code:
myRobot.tankDrive(stick1.getY() * Math.abs(stick1.getY()), |
Re: Slowing down the drive motors
Quote:
|
Re: Slowing down the drive motors
Arguably the simplest and most flexible way to contour your joystick's output is to use a piecewise linear function for each axis. Here's a simple example. |
Re: Slowing down the drive motors
Quote:
Code:
public class RobotDrive implements MotorSafety {The best plan is probably to do as Ether suggested and go piece-wise linear. Perhaps first find your sweet-spot for operating the robot (say 0.4-0.7) map your deadzone to ~10-20% less than the minimum power to drive your robot and then map 0.9 to be the maximum you want to drive and then map 1.0 to 1.0. There are many ways to code an OI... I'll mention that what our team sees as a way to not lose motor strength and yet drive very slowly is to use a feedback encoder system so you are asking the wheels to go 0.4 of their fastest rotation rather than 0.4 constant output voltage. This way a PID can apply full power to the wheels to get it going but quickly cut back power as you reach your requested rate. If you are moving very slowly and something gets in your way, you can apply the full power of your cims to overcome and if your wheels happen to slip the PID would likely compensate back down to the maximum power possible without overcoming friction. |
Re: Slowing down the drive motors
Quote:
|
| All times are GMT -5. The time now is 10:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi