... | ... | @@ -108,21 +108,20 @@ After all of these various experiments with change of different factors, we came |
|
|
#### Algorithm-discussion
|
|
|
Based on Hurbain [2], we know that the PID constants used in ***Sejway.java*** were designed for Hurbain's specific light sensor, robot build and environment setup. We therefore decided to start testing which specific variables would be best for our setup.
|
|
|
|
|
|
We thought about (and actually started) changing the PID variables of Bagnall's initial program from integers to floats, but couldn't get it to work and moved on with the initial integer variables to save time.
|
|
|
We began by changing the PID variables of Bagnall's initial program from integers to floats, as suggested in the lecture, but couldn't get it to work and moved on with the initial integer variables to save time.
|
|
|
|
|
|
In order to optimize our experimentation with various PID values for the program, we decided to make a PC GUI program to send new values to the robot over Bluetooth, on-the-fly while testing, rather than having to upload a new program with every value change.
|
|
|
In order to optimize our experimentation with various PID values for the program, we followed the suggestion of making a PC GUI program to send new values to the robot via Bluetooth, on-the-fly while testing, rather than having to upload a new program with every change of values.
|
|
|
|
|
|
### Choosing parameters on the fly
|
|
|
---
|
|
|
#### Making the programs
|
|
|
To make a GUI that runs on a computer and communicates variable values with the program running on the NTX we retrieved the ***TrackerController.java*** and the ***Tracker.java*** from [lesson 2](http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson2.dir/Lesson.html) which was used respectively for controlling the PID values used on the NTX and receiving and using these values in a PID controller for the ultrasonic sensor. The ***TrackerController.java*** hence became the inspiration for our PC GUI and the ***Tracker.java*** for the NXT program responsible for receiving the sent values.
|
|
|
To make a GUI that runs on a computer and communicates variable values to the program running on the NTX we retrieved ***TrackerController.java*** and ***Tracker.java*** from [lesson 2](http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson2.dir/Lesson.html) which were used respectively for controlling the PID values used on the NTX and receiving and using these values in a PID controller for the ultrasonic sensor. ***TrackerController.java*** hence became the inspiration for our PC GUI and ***Tracker.java*** for the NXT program became responsible for receiving the sent values.
|
|
|
|
|
|
Later on we noticed that two java programs to use as inspiration were actually provided in the lesson plan, but at this point we had already written the program ourselves and therefore chose to ignore the supplied programs as we would rather continue with our experiments.
|
|
|
|
|
|
We ended up writing (basically through capy-paste though) four programs; ***PICcontroller.java***, ***PCconnection.java***, ***Sejway.java*** and ***NXTSegwayRunner.java***.
|
|
|
We ended up writing (or rather: mainly copy-pasting) four programs; ***PICcontroller.java***, ***PCconnection.java***, ***Sejway.java*** and ***NXTSegwayRunner.java***.
|
|
|
|
|
|
The ***PIDcontroller.java*** [11] is the PC GUI to enable PC control of variables used on the NXT. This program sets up a GUI with six fields and two buttons. The first two fields contains name and bluetooth device ID, which is used when clicking the 'connect'-button, as this action starts NXT communication with the given device ID and sets up a dataOutPutStream.
|
|
|
The last four fields are input fields for *P*, *I*, *D*, and *SP* respectively, where SP is the calibration setpoint that the NXT program will aim for - i.e. its offset. The last variable was added to the PC controller, as we wanted to avoid box-calibration which we suspected didn't entirely remove the button-push error of the calibration.
|
|
|
The ***PIDcontroller.java*** [11] is the PC GUI to enable PC control of variables used on the NXT. This program sets up a GUI with six fields and two buttons. The first two fields contains name and bluetooth device ID, which is used when clicking the 'connect'-button, as this action starts NXT communication with the given device ID and sets up a dataOutPutStream. The last four fields are input fields for *P*, *I*, *D*, and *SP* respectively, where SP is the calibration setpoint that the NXT program will aim for - i.e. its offset. The last variable was added to the PC controller, as we wanted to avoid box-calibration which we suspected didn't entirely remove the button-push error of the calibration.
|
|
|
|
|
|
The ***PCconnection.java*** [12] is inspired from the ***Tracker.java*** and therefore is responsible for retrieving the parameters send from the pc through the datastream and forwarding them to a running ***Sejway.java*** instance.
|
|
|
|
... | ... | |