|
Re: urget help needed with c++ code
Something in your auton code looks wrong. I'm bolding the line your should add:
while((fabs(encoderL->GetRaw())<4500||fabs(encoderR->GetRaw())<4500) && t<200)
{
yLeft.Set(0.7);
sLeft.Set(-0.7);
yRight.Set(-0.7);
sRight.Set(0.7);
Wait(0.005);
t++;
}
t = 0;
while((fabs(encoderL->GetRaw())<4700||fabs(encoderR->GetRaw())<4700) && t<200)
{
yLeft.Set(0.4);
sLeft.Set(-0.4);
yRight.Set(-0.4);
sRight.Set(0.4);
Wait(0.005);
t++;
}
Also, in OperatorControl, you're using "angle" as a pointer, which seems unnecessary and dangerous. Change " *angle " everywhere you see it to just " angle ".
I don't see anything obviously wrong with your code. I'd recommend taking out all those Wait calls in OperatorControl, because you'll lose control of the robot for the entire duration of that Wait. So if you're turning and you trigger that Wait(0.25), you'll keep turning for 0.25 sec, no matter what you do on the controls.
Generally, I'd recommend trying the robot in Practice mode, so it runs through Auton and into Teleop in the same sequence it would on the field. I'd also recommend running NetConsole while you're on the field, so you can get any debugging statements or exceptions that will tell you what's killed your robot.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.
Lone Star Regional Troubleshooter
|