... | ... | @@ -37,7 +37,7 @@ This might be due to our sensor not being calibrated the same as the one used wh |
|
|
|
|
|
For this exercise we had to build a pc controller for the NXT that would allow us to change the PID constants while the robot was running. We used `PCcarController.java`[REFERENCE] as a starting point for our new controller `PCpidController.java`[REFERENCE] and added text fields for the constants `KP`, `KI`, `KD` and `SCALE` Furthermore, we decided that it would be useful to have the current light value and `pid_val` which is the number defining whether our NXT should drive forward or backwards. Our new PC controller have a connect button, that establishes a bluetooth connection with the NXT and a set button which writes the entered values to the output stream. Figure 1 shows how the finished PC controller looks.
|
|
|
|
|
|
![Figure 1: The PC controller with the various fields and buttons.](http://i.imgur.com/YezJHRKm.jpg)
|
|
|
![Figure 1: The PC controller with the various fields and buttons.](http://i.imgur.com/YezJHRKl.jpg)
|
|
|
|
|
|
The connect button behavior is exactly the same as in the original controller but the set button behavior is new and it writes the values from the five input fields to the `DataOutputStream`. The code looks like this:
|
|
|
|
... | ... | |