cvf06035 created page: home authored by Camilla Marie Vinther Frederiksen's avatar Camilla Marie Vinther Frederiksen
...@@ -114,13 +114,18 @@ Later on we noticed that the lesson plan actually gave two java programs to use ...@@ -114,13 +114,18 @@ Later on we noticed that the lesson plan actually gave two java programs to use
We ended up writing (basically through capy-paste though) four programs; ***PICcontroller.java***, ***PCconnection.java***, ***Sejway.java*** and ***NXTSegwayRunner.java***. We ended up writing (basically through capy-paste though) four programs; ***PICcontroller.java***, ***PCconnection.java***, ***Sejway.java*** and ***NXTSegwayRunner.java***.
The ***PIDcontroller.java*** 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 [TODO ref]. The ***PIDcontroller.java*** 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 [TODO ref].
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. it's offset.
The ***PCconnection.java*** 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.
The ***Sejway.java*** program is a modification of Bagnall's Sejway program, where the PID variables are set through setter-methods called by outsiders - in our case the PCconnection instance. This program thereby controls the actual balancing abilities of the robot.
As both these programs can't run simultanously on the NXT, we also made the ***NXTSegwayRunner.java*** program which simply starts a Sejway instance, starts it, starts a PCconnection instance with a reference to the Sejway instance. This also means that the upper two classes extends Thread to enable simultaneous execution.
The ***PCconnection.java*** is inspired from the ***Tracker.java*** and therefore is responsible for retrieving the parameters send from the pc through the datastream.
It basically does three things; sets up a GUI for parameter entering with two buttons, connects to the specfied NXT and establishes a datastream for parameter exchange.
We used the **TrackerController** class [4] from lesson 2 as a basis for our GUI, and ended up using ***PIDController.java*** on the PC and ***PCconnection.java*** + ***Sejway.java***.
When able to control the calibration (Setpoint) variable, we made the robot 'fall' to both sides. This means that we now can be able to control the PID-variables.
The robot seemed to fall faster than it corrected - i.e. we need more motorpower as it falls. The robot seemed to fall faster than it corrected - i.e. we need more motorpower as it falls.
We tried to change the i-value - which was 4 initialy We tried to change the i-value - which was 4 initialy
... ...
......