The
speed
and
stepsize
constants can be used to change the gait of the robot. Bigger steps need more time for the
servo to move but cover more ground. Smaller steps can be completed quicker and might offer smoother movement.
Making the speed value smaller will make the robot faster but if it is too small then the servos will not keep up and the
robot will not walk properly.
The constant
bestdistance
is the average distance the robot tries to maintain between itself and the object it is
tracking. Bigger values = smaller distance. Closer distances make it easier to maintain a lock on the object.
The constant
distancemax
is the maximum distance an object can be before the robot ignores it. If this value is too
small then the robot will confuse ambient light for an object. The smaller the value, the greater the distance.
LRscalefactor
and
UDscalefactor
are used to adjust how quickly the head moves in response to an object. In most
cases you do not need to adjust these values. If the head moves too quickly it can overshoot and the head will tend to
vibrate or constantly shake. Too slow and the robot will loose it's lock on a moving object. If you make changes to the
code that affect how quickly the main loop repeats then these values may need adjustment to compensate.
IRdelay
is the time in microseconds needed for the photo transistors in the compound eye to respond to changes in
the IR light when the IR LEDs turn on or off. Increasing this value may improve the robot's sensitivity a bit but it will
also make the robot slower and less responsive.
Understanding the code (cont.)
The second tab is [
Constants.h
]. This tab contains definitions for constant values that do not change when the
program is running. In this tab we can set the center position of each servo and experiment with some other values
that affect the way the robot walks and tracks movement.
Normally the servos should be centered at 1500. If they need a big adjustment you should re-seat the servo horn. For
fine adjustment (+/- 200) you can change the center values in this tab.
The
Boredom
constant determines how long the robot will wait for you to play with it before it gets bored and sits
down. 3000 milliseconds = 3 seconds.
16