Hardware manual

60
The general idea is that, if we know the speeds of the wheels we can read it from PXMC then
we can calculate the difference in speed between two wheels. This allows calculating by which
amount in degrees the robot rotated. Additionally, knowing the perimeters of the wheels we
Unfortunately, due to fact that the microcontroller is very slow and it was impossible to make all
of these calculations within one interrupt period, we had to resign from this approach and
finally we decided to send to the main computer only the changes in position of the wheels.
6.6. Application for “index marking” and hall sensors table detection.
HalDetector is a special purposed program designed to detect the right order of a hall table and
it should work on every Linux system.
Fig. 6.6-1. HalDetector.
The general algorithm for creating a hall table is very easy. We just need to rotate the motor
according to the phase table(s) and at the same time we need to check the hall sensors. If we
detect that they changed, it means that the motor enters to the next 60
o
part. We know that
there are six such parts because 360
o
/60
o
=6. If we have 3 hall sensors it also means we can get
maximal value equal to: 7 - all sensors give 1 so we get binary: 111 what is equal to 7 in decimal.
Knowing all of these we can start to work. Firstly, we start to rotate the motor and read hall
sensor. We assume that the motor is in the first 60
o
part, so we put in the hall table in an
element shown by hall sensor value 0 zero because in C/C++ mostly we count from zero. Then
we wait till the value read from hall sensors will change. When this occurs, we put to the hall