jessvi created page: Lab5 authored by Jesper Kurtzmann Svith's avatar Jesper Kurtzmann Svith
...@@ -75,37 +75,36 @@ In the datalogger class we had to replace FileOutputStream with BufferedOutputSt ...@@ -75,37 +75,36 @@ In the datalogger class we had to replace FileOutputStream with BufferedOutputSt
> While using the GUI we ran into a problem where the values would not be sent correctly to the robot. Instead of just sending one value for the P parameter all the values would change to the same as the P value. We think the problem lies in the PCcarController.java program. In the part of the program that sends the values to to robot, we had forgot to change the I value from an int to a float value (see fig. 5). After fixing this the Bluetooth connection seemed to work normally again. > While using the GUI we ran into a problem where the values would not be sent correctly to the robot. Instead of just sending one value for the P parameter all the values would change to the same as the P value. We think the problem lies in the PCcarController.java program. In the part of the program that sends the values to to robot, we had forgot to change the I value from an int to a float value (see fig. 5). After fixing this the Bluetooth connection seemed to work normally again.
> >
>``` >```
try > try
{ > {
String pString = pField.getText(); > String pString = pField.getText();
int p = new Integer(pString).intValue(); > int p = new Integer(pString).intValue();
dos.writeInt(p); > dos.writeInt(p);
dos.flush(); > dos.flush();
>
String iString = iField.getText(); > String iString = iField.getText();
float i = new Float(iString).intValue(); // The I value needs to be a float value in > float i = new Float(iString).intValue(); // The I value needs to be a float
dos.writeFloat(i); // order to send decimal numbers. > value in
dos.flush(); > dos.writeFloat(i); // order to send decimal numbers.
> dos.flush();
String dString = dField.getText(); >
int d = new Integer(dString).intValue(); > String dString = dField.getText();
dos.writeInt(d); > int d = new Integer(dString).intValue();
dos.flush(); > dos.writeInt(d);
> dos.flush();
String oString = oField.getText(); >
int o = new Integer(oString).intValue(); > String oString = oField.getText();
dos.writeInt(o); > int o = new Integer(oString).intValue();
dos.flush(); > dos.writeInt(o);
> dos.flush();
String sString = sField.getText(); >
int s = new Integer(sString).intValue(); > String sString = sField.getText();
dos.writeInt(s); > int s = new Integer(sString).intValue();
dos.flush(); > dos.writeInt(s);
> dos.flush();
} > }
>```
``` >
> >
>--- >---
> >
... ...
......