Rover 5 encoders with RPIGPIO

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

Thanks. I’ll give it a go

Thanks. I’ll give it a go next week. Need to workout how many pulses in a turn now.  

**Thanks for the help guys. **

Thanks for the help guys. 

I presume the interupt pules

I presume the interupt pules are 5v therefore I will need a voltage divider to drop it to 3.3v?

Thanks. How do I know if it

Thanks. How do I know if it is an old or a new chassis? I have had it for about 6 months, not sure how long the store had it first.