Robotics with the Boe-Bot text v2.2
Chapter 8: Robot Control with Distance Detection · Page 277 
ACTIVITY #2: BOE-BOT SHADOW VEHICLE 
For one Boe-Bot to follow another, the Boe-Bot that follows, a.k.a. the shadow vehicle, 
has to know how far ahead the lead vehicle is. If the shadow vehicle is lagging behind, it 
has to detect this and speed up. If the shadow vehicle is too close to the lead vehicle, it 
has to detect this as well and slow down. If it’s the right distance, it can wait until the 
measurements indicate it’s too far or too close again. 
Distance is just one kind of value that robots and other automated machinery are 
responsible for. When a machine is designed to automatically maintain a value, such as 
distance, pressure, or fluid level, it generally involves a control system. These systems 
sometimes consist of sensors and valves, or sensors and motors, or, in the case of the 
Boe-Bot, sensors and continuous rotation servos. There is also some kind of processor 
that takes the sensor measurements and converts them to mechanical action.  The 
processor has to be programmed to make decisions based on the sensor inputs, and then 
control the mechanical outputs accordingly. In the case of the Boe-Bot, the processor is 
the BASIC Stamp 2. 
Closed loop control is a common method of maintaining levels, and it works very well 
for helping the Boe-Bot maintain its distance from an object. There are lots of different 
kinds of closed loop control. Some of the most common are hysteresis, proportional, 
integral, and derivative control. All of these types of control are introduced in detail in 
the Stamps in Class text Process Control, listed in the Preface. 
Most control techniques can be implemented with just a few lines of code in PBASIC. In 
fact, the majority of the proportional control loop shown in Figure 8-4 reduces to just one 
line of PBASIC code. This diagram is called a block diagram, and it describes the steps 
of the proportional control process that the Boe-Bot will use to measure distance with its 
right IR LED and detector and adjust position to maintain distance with its right servo. 










