|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Robot turning Erratically in auton...
During auton mode, when given a turn command in the commands.h, all it does is spin around in circles...please help! We ship out tonight!
|
|
#2
|
||||
|
||||
|
Re: Robot turning Erratically in auton...
Quote:
Did you get it running with the original scripting code? I haven't been able to do that.... Jon |
|
#3
|
|||||
|
|||||
|
Re: Robot turning Erratically in auton...
Your motors are either turning in the wrong direction or your gyro isn't calculating the bias properly. For us we had to give the gyro a second to get bias or else it would spit out an angle like 20 000 milliradians to turn (it spins in circles). Try adding in some extra wait time before calculating bias. If it works then decrease it as much as you can. Hope that helps
|
|
#4
|
||||
|
||||
|
Re: Robot turning Erratically in auton...
the PWM's are mixed up. swap them and it will solve your problems.
|
|
#5
|
||||
|
||||
|
Re: Robot turning Erratically in auton...
Incorrect.
|
|
#6
|
||||
|
||||
|
Re: Robot turning Erratically in auton...
Quote:
What I would do is go into pid.c and and find the function called pid(). Down at the bottom of that function, find these lines: Code:
switch (motor)
{
case LEFT:
{
wheel_l = (unsigned char)(PWM_ZERO + LEFT_DIR * motor_info[left].pwm);
break;
}
case RIGHT:
{
wheel_r = (unsigned char)(PWM_ZERO + RIGHT_DIR * motor_info[right].pwm);
break;
}
default:
{
printf("Unknown motor");
break;
}
}
Code:
switch (motor)
{
case LEFT:
{
wheel_l = 255 - (unsigned char)(PWM_ZERO + LEFT_DIR * motor_info[left].pwm);
break;
}
case RIGHT:
{
wheel_r = (unsigned char)(PWM_ZERO + RIGHT_DIR * motor_info[right].pwm);
break;
}
default:
{
printf("Unknown motor");
break;
}
}
![]() You're probably going so fast that your encoders are missing clicks. If you're not using interrupts, you have a fairly limited ability to see state changes... |
|
#7
|
||||||
|
||||||
|
Re: Robot turning Erratically in auton...
I would assume that your encoders are working, since you didn't mention any problems with going straight. Is your gyro working is the first question.
Even with a working gyro, we had trouble with the turning code, I think it was because our encoders didn't give enough resolution to give good velocity control. With a few modifications we were able to get the code to turn with encoders working well enough. We're still working on turning with the gyro. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Winning Robot or Quality Robot? | Eric Bareiss | General Forum | 30 | 09-02-2006 13:19 |
| Is allowing a practice robot good for FIRST? | Matt Adams | General Forum | 38 | 19-01-2005 11:35 |
| [moderated] You write <G34> and <G35> | Aidan F. Browne | General Forum | 109 | 21-04-2004 17:00 |
| Robot Collaboration | Karthik | General Forum | 153 | 18-02-2004 03:40 |
| about how Drive Train push the robot... shouldn't the force accelerate the robot? | Ken Leung | Technical Discussion | 12 | 26-11-2001 09:39 |