Hi
I have built my forst robot using a Raspberry pi, Rover 5 chassis (2 wheel drive with encoders), dagu 4 wheel motor control board and an ultrasonic sensor and running a Python script.
I have 2 modes. One were it is remote controlled with a Wiimote and the second is autonomous mode. In autonomous mode, it uses the ultrasonic sensors to detect if it is within a certain distance from an obstacle, if it is it stops, rotates left, takes a measurement, rotates right, takes a measurement and then sets off again in the direction with the highest measurement. All very basic.
The amount of rotation in a turn is simply controlled by using a time.sleep function which isn't very elegant and also hard to work out how much rotation a certain time equates to.
i want to use the encoders to measure the rotation of the wheels. I understand the principle but I do not know how to translate this to Pythin code. I am using the RpiGPIO library for all other in/outs and I understand this has an interupt ability I could use, I just don't know how to count the pulses. I am very new to programming.
Anyone done anything similar?
Thanks
Paul