![]() |
Robot Drifting
Our team is having trouble with our robot drifting to the right while driving straight. We feel that is because one drill motor is running in reverse. I know there is a way to compensate for in in the programming but im not really sure how to do it. Would the Current Sensors help in programming the motors? Any suggestions or examples of code would be very helpful to us. Thanks alot.
|
Re: Robot Drifting
Quote:
Here is a quick example: Code:
// Somewhere t the top of the file. Comp is short for compensation |
Re: Robot Drifting
I don't think that'll work quite like you intend. It'll work fine for autonomous mode dead reckoning, but not for normal driving, really. I'd think in normal driving, the difference would scale with the speed of the motors, and you'd need a more complicated function to figure out the compensation.
In addition, your reverse compensation isn't right. Remember, when you're going in that direction, the motor that's normally going in reverse is now going forwards. It's now the one that needs to be compensated. The reverse direction should be: pwm01 = 0 + COMP_SPEED; pwm02 = 0; |
Re: Robot Drifting
Quote:
The right/left drivetrains are rarely 100% balanced, so you should always be able to adjust for it in the code as necessary. Be aware that every time you adjust the drive system (replace a wheel, fix the alignment) you need to revisit the code adjustment. An easy method is to first assume the difference is linear and adjust the more powerful side down to match the less powerful side as a percentage of full power. These will of course be different for driving forwards and backwards, so add an if statement for that. e.g., stronger side power = current power - (current power/full power * constant)The simplest way to select constant is: - Run the robot at full power and note which side lags. - Pick a value for constant above, put it into the code and run the robot again. - Repeat until you are driving straight. Remember that constant doesn't have to be restricted to integers like 1,2,3,.. It can be a #define like "#define CONSTANT 150/100" to get a value of 1.5 without using floating point #'s. |
Re: Robot Drifting
Software fixes to mechanical problems... eek! :p
If your robot is drifting... there's one quick thing that you should look at right away... this is a very typical situation, but it can often (but not always) be adjusted by shifting your weight distribution. The drill motors do not run in the same speed forward and backward, if this is what you're using, (or even if you're not) perhaps you could shift some weight around your robot to the side opposite of where you're drifting... i.e. if you're drifting to the right, try to move some weight on the left side. Mind you that in reverse, drifting will be more significant if you're evenly balanced via weight in forward. Maybe you'll balance this by software in reverse, since you can try to avoid needing to drive accurate and pushing in that direction. In general, try to do as much as you can mechanically, and don't try to kill your robot's power input through software... your drivers wil want every ounce of it! Good luck! Matt |
Re: Robot Drifting
I can't believe all the solutions which have been mentioned so far as the "simplest".
The SIMPLEST solution, is to teach your driver to live with it, and account for the drift when he/she is on the field. It's not that difficult... ;) Human controlled, dynamically adjusted voltage scaling. (Also known as HuCDAVS), is a simple control method that involves holding one joystick a little bit further forward than the other. ;) John |
Re: Robot Drifting
Quote:
I will note that we don't usually apply this software fix when our HuCDAVS is operable. |
Re: Robot Drifting
Quote:
|
Re: Robot Drifting
Quote:
|
Re: Robot Drifting
Simple solution?
next year make sure both motors are running in the same direction... or if time/design allows fix it before ship date! we have been doing this for 2 years now |
Re: Robot Drifting
Quote:
This is a more concrete example using a joystick value to drive: Code:
int temp; // use to hold signed pwm value (-127 to 127) for simpler math |
Re: Robot Drifting
Thank you so much. Im going to try it on tuesday when we get back to working on the bot and hope it works.
|
Re: Robot Drifting
Can the drill motors polarity be reversed on one of them? Check the cans for the positive above the one brush. Also is one tire gaining more traction than the other. I noticed today that an extreme of what you are describing happened in last years robot. The frame was so warped that the robot was actually swerving since one wheel was not getting enough traction.
|
Re: Robot Drifting
Quote:
|
Re: Robot Drifting
I spent the entire day yesterday, and 2 hours today learning to stop our 2003 robot on a dime in a 30 by 36 box when driving from about 10 feet away. Yes, the robot drifts. Yes, it is really annoying to have to compensate for it. Yes, this is going to happen in real matches. Yes, I'm going to shut up and deal with it. Just have your driver prepare for it.
|
| All times are GMT -5. The time now is 03:59. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi