The figure below shows four consecutive claps, measured with the NXT sound sensor. The pattern starts out at low amplitude and rises quickly (within the 25ms) to an amplitude above 85%. The length of the four claps varies between approximately 85ms and 175ms and then returns back to low (below 50%).
In the SoundCtrCar.java a state change occurs whenever a sound level is recorded as 90% or above. The duration of the sound is not taken into account thus a constant sound above this limit would also trigger a state change. A sleep functionality has been implemented in order to keep the program from running quickly through every state at high sounds.
...
...
@@ -94,6 +111,7 @@ while(!Button.ESCAPE.isDown())
Thread.sleep(dt);
}
```
The full code is found in [3].
The gains for the vehicle is chosen empirically to:
```java
...
...
@@ -101,14 +119,24 @@ static float Kp = 5.0f,
Ki=0f,
Kd=0.5f;
```
This means that the integral part of the PID controller is not used.
This is chosen, since it seemed to have an unfortunate effect on the control even when a Ki value of 0.001 was used.
The performance of our Party Finding Robot is shown in the following video.