We got our first car working, and figured out that 0 isnt actually 0 but 50, and 100% throttle is actualy 0 or low voltage to the servo controller. We also faced another problem, Reverse! Before we begin understanding reverse, we need to understand the numbers.
The stick on our throttle goes from 0-100, where 50 is neutral, or its ideal position. When you are driving the car at position 49-0 (Note power values are inversed) and pull the throttle back to >= 50 the car does not reverse, but in fact tries to stop it self. It is only when you go back to idle to 50 for a given time that 50-100 responds as a reverse acceleration.
To do this we follow the same procedure on the phone tilt controls. As it is hard to idle a phone at 50, we create a range that is always 50. You can see this represented in Orange in the figure below.
From the diagram above you can see 0 is extended, as we don't want to stop the car just because the person is dropped the phone a little more than the 0 position, It is only when they go past 0 radians that we switch to the dark gray 50 idle position.
We believe that the reverse using tilt is probably not the most intuitive way to perform reverse on a tilt controller. It would be better to use a switch to engage reverse, and then use the normal throttle as you would an accelerator pedal to reverse. This is to be seen.
For dashee we needed to use threading, and for learning purposes I decided to write my own little class which implements the pthread_ API.