... | ... | @@ -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.
|
|
|
>
|
|
|
>```
|
|
|
try
|
|
|
{
|
|
|
String pString = pField.getText();
|
|
|
int p = new Integer(pString).intValue();
|
|
|
dos.writeInt(p);
|
|
|
dos.flush();
|
|
|
|
|
|
String iString = iField.getText();
|
|
|
float i = new Float(iString).intValue(); // The I value needs to be a float value in
|
|
|
dos.writeFloat(i); // order to send decimal numbers.
|
|
|
dos.flush();
|
|
|
|
|
|
String dString = dField.getText();
|
|
|
int d = new Integer(dString).intValue();
|
|
|
dos.writeInt(d);
|
|
|
dos.flush();
|
|
|
|
|
|
String oString = oField.getText();
|
|
|
int o = new Integer(oString).intValue();
|
|
|
dos.writeInt(o);
|
|
|
dos.flush();
|
|
|
|
|
|
String sString = sField.getText();
|
|
|
int s = new Integer(sString).intValue();
|
|
|
dos.writeInt(s);
|
|
|
dos.flush();
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
> try
|
|
|
> {
|
|
|
> String pString = pField.getText();
|
|
|
> int p = new Integer(pString).intValue();
|
|
|
> dos.writeInt(p);
|
|
|
> dos.flush();
|
|
|
>
|
|
|
> String iString = iField.getText();
|
|
|
> float i = new Float(iString).intValue(); // The I value needs to be a float
|
|
|
> value in
|
|
|
> dos.writeFloat(i); // order to send decimal numbers.
|
|
|
> dos.flush();
|
|
|
>
|
|
|
> String dString = dField.getText();
|
|
|
> int d = new Integer(dString).intValue();
|
|
|
> dos.writeInt(d);
|
|
|
> dos.flush();
|
|
|
>
|
|
|
> String oString = oField.getText();
|
|
|
> int o = new Integer(oString).intValue();
|
|
|
> dos.writeInt(o);
|
|
|
> dos.flush();
|
|
|
>
|
|
|
> String sString = sField.getText();
|
|
|
> int s = new Integer(sString).intValue();
|
|
|
> dos.writeInt(s);
|
|
|
> dos.flush();
|
|
|
> }
|
|
|
>```
|
|
|
>
|
|
|
>
|
|
|
>---
|
|
|
>
|
... | ... | |