Quote:
Originally Posted by DavidGitz
I suspect that you have one or more of the following problems: a) You still have binding issues in your drive-train b) Bad weight distribution on your wheels c) Not all wheels contacting the ground.
|
I would add d) drive motors (like CIMS) do not run at the same speeds forwards vs backwards for the same absolute value of PWM request. So many robots have a tendency to have a drift to one side. (lots of threads about that out there in SEARCH-land I bet) Adding a small constant bias solves many of the effects of a + b + c + d.
I'm hacking this in pretty fast, but it should get you going ...
Code:
#define SIDE_BIAS 0.1 // TBD from experimentation
#define NEUTRAL_DEADBAND 0.17 // maybe less - experiment
.
.
.
while (IsOperatorControl())
{
float yStick = stick.GetY(); //as opposed to stick->GetY(); ....not sure
float xStick = stick.GetX();
if( (yStick > -NEUTRAL_DEADBAND) &&
(yStick < NEUTRAL_DEADBAND ) )
{ // in the Y deadband ... spin only so no bias to spin
yStick = 0. ;
}
else // translating fwd/rev add the bias to the spin axis
{
xStick += SIDE_BIAS ; // set sign correctly, here
xStick = (xStick > -1.) ? xStick : -1. ; // keep in range
xStick = (xStick < 1.) ? xStick : 1. ;
}
//myRobot.ArcadeDrive(stick); // drive with arcade style
// using squared inputs has a smoothing effect on handling
myRobot.ArcadeDrive(yStick,xStick,true) ;
Wait(0.005); // wait for a motor update time
}
...something like that....
For better drift compensation, try a yaw rate sensor as feedback to a proportional control of the SIDE_BIAS value
Thanks,
Eric
PS JAG firmware upgrade instructions:
http://www.usfirst.org/sites/default...ructions02.pdf