Search This Blog

Sunday, May 2, 2010

Almost autonomous

With all the hardware prepared (except the quadrature encoder on the wheels, which is still to be implemented and installed), all conditions were met in order to be able to write some code and make the car finally move on its own.

I have first added the sonar module (the previously mentioned SRF02). This implied making a small aluminium support to fixate the sonar to the servo, while still being able to slightly adjust the tilt:

After installing it, made a quick check and read the ranging data directly through the MuIn original Windows application:

Every thing was fine. It was time to add more code to the MuIn PIC, implenting useful functions for the robot. A singe command returning both range data and the servo position would be useful, so I implemented it. It essentially consists of the following structure:

'@''F''S'I2C addrservo nr00'#'

Each element is 8 bytes long. The PIC responds with the following answer format:

'@''F''S'I2C addrservo nrRange HBRange LBServo HBServo LB'#'Checksum

This allows a measurement to be taken, while the servo is sweeping.

A small video of the car in action:

No comments: