... | ... | @@ -132,10 +132,13 @@ As both these programs can't run simultanously on the NXT, we also made the ***N |
|
|
#### Search for good PID parameters
|
|
|
After implementing the programs enabling easy PID parameter search, we started playing around with different values for P, I and D using a by-hand-calibrated setpoint. We quickly realized that this method didn't enhance our understanding of the different variables and neither of the robot's ability to self-balance. We therefore decided to use a more systematic way of testing and deciding on variable values than this approach based on gut feeling and experience (the latter of which we had very little).
|
|
|
|
|
|
To systematically observe which values of P, I and D worked better for our robot we needed to have a best possible starting point (i.e. the robot being in equilibrium), and we therefore began by trying to find a good setpoint.
|
|
|
To systematically observe which values of P, I and D worked better for our robot we needed to have a best possible starting point (i.e. the robot being in equilibrium), and we therefore began by trying to find a good setpoint. This is presented below, along with our search for the other parameters.
|
|
|
|
|
|
##### Finding a good setpoint
|
|
|
To find the best possible setpoint we decided to use the PID values of Bagnall's initial program (p = 28, i = 4, d = 33) and then trying to narrow our way into the best possible value by starting with (from our prior experience) low and high values. This resulted in the observations presented in table 1.
|
|
|
##### Grid-inspired search and extrema exploration
|
|
|
We decided to test the effect of different values for the parameters using a technique inspired by grid search: We selected a range of values to try out for each parameter (*setpoint*, *P*, *I*, and *D*) and then varied one parameter while keeping the others fixed. We began by testing different values with rather large intervals in between, including extreme values on either side of the value provided in Bagnall's code (p = 28, i = 4, d = 33). By extreme, we mean values far away from the provided values. According to which values gave the best results we then made the search around these values more fine-grained.
|
|
|
|
|
|
*Finding a good setpoint:*
|
|
|
To find the best possible setpoint, we followed the procedure described above and narrowed our way into a good value by starting with (from our prior experience) low and high values. The resulting observations are presented in table 1. We ended up selecting an SP value of 577. The process is described more closely below.
|
|
|
|
|
|
| Setpoint value | Status | Observation |
|
|
|
| --- | --- | --- |
|
... | ... | @@ -151,12 +154,6 @@ To find the best possible setpoint we decided to use the PID values of Bagnall's |
|
|
|
|
|
*Table 1: Observations for the effect of various setpoint values for the balancing robot as moving towards better values*
|
|
|
|
|
|
|
|
|
##### Grid-inspired search and extrema exploration
|
|
|
|
|
|
We decided to test the effect of different values for the parameters using a technique inspired by grid search: We selected a range of values to try out for each parameter (*setpoint*, *P*, *I*, and *D*) and then varied one parameter while keeping the others fixed. We began by testing different values with rather large intervals in between, including extreme values (values far away) on either side of the value provided in the code used as inspiration. According to which values gave the best results we then made the search around these values more fine-grained.
|
|
|
|
|
|
*Setpoint:*
|
|
|
Noting that the value measured by the robot initially was around 580, we started with a value of 500 to see the effect. We then tried a value of 750 (simply to try something somewhat in the middle between 500 and the highest possible value of 1023). Seeing how poorly both of these affected the robot's performance, we tried a value of 600 which made the robot perform a lot better. After this, we started narrowing in between 600 and 550, ending at a value of 577. After a while of testing, we noticed that the robot was casting a shade depending on the direction that the light was coming from. This has most likely affected the light readings, but we have not taken this further into account except for the awareness that the accuracy of our measurements need to be taken with a grain of salt. Additionally, the values we arrived at were specific for the exact ambient lighting in the room we were in at the time. Any change in lighting would change the ideal setpoint, and we'd have to do these readings again.
|
|
|
|
|
|
*P value:*
|
... | ... | |