|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Problems with PID- PLEASE HELP!!!
Hey,
We are a rookie team and have been desperately (but unsuccessfully ) trying to get the autonomous code provided by Mr. Watson to work. Right now coming to the basics, when we ask the scripting code to drive 1500 mm, wait 20000 ms and then stop, the robot wheels just keep on driving. We are using the grayhill 63R128 encoders along with the ADXRS150 gyro. The gyro and the encoders work fine independently, but when put together in the Navigation code we get completely unpredicted results. We are not even on turning as of yet so i am not much worried about the gyro right now. What could be wrong here? Has any other team who has had success with this please let us know what changes u needed to make in order to get things to work? We test this by putting the robot mobility on 4- 2" by 4" wooden stilts, can this make a difference despite the fact that the encoders are hooked up right? Being a rookie we are completely clueless about this as we spent a lot of time making our mobility system and are short on time. Please help! Thanks in advance, vick. PS. Let me inform you that I have tried searching for a similar post but didnt find anything, so if you have seen anything similar please post the link, thanks |
|
#2
|
|||
|
|||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
|
|
#3
|
|||
|
|||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
struct commands command_list[] = { {CMD_GYRO_BIAS, 0, 0, 0}, {CMD_DRIVE, 1500, 0, 0}, {CMD_WAIT, 20000, 0, 0}, {CMD_STOP, 0, 0, 0}, {NULL, 0, 0, 0} }; the robot just keeps on going forward for a long time without stopping at all. If you meant something else please let me know. Thanks. |
|
#4
|
||||
|
||||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
#define LEFT_DIR (-1) #define RIGHT_DIR (1) Next make sure the PID software properly detects the rotational direction by setting the sign on these #defines in encoder.h: #define LEFT_ENCODER_TICK_DELTA -1 #define RIGHT_ENCODER_TICK_DELTA 1 When you're done, the encoder count will increase as the 'bot drives forward. -Kevin |
|
#5
|
|||
|
|||
|
Quote:
I just double-checked the code and it is set as per your reccomendations, but we get the same undesired results. Is there a way to see the readings of the encoder counts in the PID files, i tried adding in printf statements in the PID.c file where the encoder count values are being called: long int Get_Encoder_Count(int motor) { if (motor == 0) { temp = Get_Left_Encoder_Count(); printf("/rLeft count: %5d", (int)temp); return (temp); } else if (motor == 1) { temp = Get_Right_Encoder_Count(); printf("/rRight count: %5d", (int)temp); return (temp); } but this just prints out the values of Right count: 0 and Left count: 0. Can anyone tell why this can be? I know i am being annoying, but we are really desperate about this, so please keep the inputs flowing. Thanks for your suport, Vick. Last edited by thinkpad : 06-02-2005 at 23:15. |
|
#6
|
||||
|
||||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
-Kevin |
|
#7
|
|||||
|
|||||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
Earlier you said that the encoders work when you're not also using the gyro. How did you determine this? |
|
#8
|
|||
|
|||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
Quote:
I can say the encoders are working because i tried out the frc_encoder code (available from Mr. Watson's website) with the encoders hooked up. The wheels were manually rotated, and the encoders responded as they were supposed to and their measurements are consistent with out gear ratios. Last edited by thinkpad : 07-02-2005 at 00:37. Reason: spelling mistake |
|
#9
|
||||
|
||||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
** IMPORTANT ** On a 40MHz PIC18F8520, this software can track peak encoder count rates as high as a few thousand counts per second, which should be more than adequate for most applications. To meet your performance expectations, selecting the proper Counts Per Revolution (CPR) parameter of your encoder is very important. If the CPR is too high, the robot controller will spend too much time counting encoder "ticks" and not enough time on other tasks. At the extreme, you will see very wacky behavior in your robot controller including corrupted data, the red- light-of-death or the controller may even think the robot is traveling in a direction that it isn't. Selecting a CPR that is too low will not give you the resolution you desire. The CPR should be optimized to minimize the number of interrupts your robot controller will have to service yet meet your resolution expectations (yes, millimeter position resolution to too much to ask for). To test this theory out, find these #defines in pid.h: /* These define the motor control settings. The max and min values are the greatest and smallest pwm values that you want to use on your motors. */ #define MAX_PWM 182 #define MIN_PWM 82 And set the values to something like 152/112 and test again. This will lower the maximum shaft velocity to a value that the encoders can (hopefully) track. If the control loop suddenly starts to work, you found your problem. You'll probably need to go to a much lower CPR encoder or move the encoders to the output shaft. Quote:
-Kevin |
|
#10
|
|||
|
|||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
That makes sense Mr. Watson, i will try that out lowering the speed first thing tomorrow morning, and let you know of the results. As far as the speed, i was unable to measure it in a numerical value but I am going to say it was VERY fast so this makes more sense altogether. I am sorry i don't understand what you meant by going to an encoder with a lower CPR. Do you recommend we get any other encoder in place of the Grayhill 63R128 ? I will talk to the mechanical guys to consider moving the encoders to the final shaft as well. Thanks, Vick. |
|
#11
|
||||
|
||||
|
Re: Problems with PID- PLEASE HELP!!!
Quote:
(As a note, make sure you have a spare, as the Grayhill encoders aren't the most robust encoders out there, a bad blow to the shaft can take one out, and from experience, having to re-write the code in the pits to limp along without an encoder is not fun) |
|
#12
|
|||
|
|||
|
Re: Problems with PID- PLEASE HELP!!!
Hey,
I got the mechanical guys to put the encoders on the output chain of the wheel, and the current calculated counts per wheel revolution are 299 counts/ wheel revolution. It does work for driving a fixed length in a straight line right now, but it is at relatively lower speed that we will have on our final robot mobility. Is this counts per revolution OK (hopefully not overkill like before, especially if we want high speeds)? Now I am trying to get the robot to turn (using the gyros), is there a variable where we can calibrate the turning speed as per our gearboxes? We have a tank like mobility system so the turning isn’t very sharp, so when i ask the scripting to turn 90 deg (1500 miliradians), I can see the motors are spinning at different rate, but since it is encountering a lot of friction I was wondering if it is possible to make it turn sharper? Thanks for all the assistance you’ve provided so far, it is really appreciated, it is amazing even a rookie team can have a good autonomous, all because of your generous help. Regards, Vick. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PID code questions | Don Reid | Programming | 15 | 18-02-2005 19:58 |
| All-Time PID Drive with Hall-effects: Coming along very nicely | jdong | Programming | 6 | 05-02-2005 19:39 |
| PC problems. . . | opnickc | IT / Communications | 5 | 12-01-2005 16:53 |
| Robot Rodeo - fixing control problems | Gary Dillard | Off-Season Events | 7 | 26-10-2004 00:46 |