<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bespokerobotsociety.org/index.php?action=history&amp;feed=atom&amp;title=Activity%3ALine_Following</id>
	<title>Activity:Line Following - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bespokerobotsociety.org/index.php?action=history&amp;feed=atom&amp;title=Activity%3ALine_Following"/>
	<link rel="alternate" type="text/html" href="https://wiki.bespokerobotsociety.org/index.php?title=Activity:Line_Following&amp;action=history"/>
	<updated>2026-04-25T11:27:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.bespokerobotsociety.org/index.php?title=Activity:Line_Following&amp;diff=12&amp;oldid=prev</id>
		<title>John: Claude edited based on my notes, prompt, and SimpleBot code repository</title>
		<link rel="alternate" type="text/html" href="https://wiki.bespokerobotsociety.org/index.php?title=Activity:Line_Following&amp;diff=12&amp;oldid=prev"/>
		<updated>2025-10-11T15:55:31Z</updated>

		<summary type="html">&lt;p&gt;Claude edited based on my notes, prompt, and SimpleBot code repository&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Activity&lt;br /&gt;
|name=Line Following&lt;br /&gt;
|difficulty=Beginner&lt;br /&gt;
|real_world=Warehouse AGVs following floor markers, museum tour guide robots, automated guided vehicles in factories, robotic vacuum cleaners (some models)&lt;br /&gt;
|capabilities=[[Capability:Line Sensing]], [[Capability:Differential Drive]]&lt;br /&gt;
|behaviors=[[Behavior:Line Following]]&lt;br /&gt;
|robots=[[SimpleBot]]&lt;br /&gt;
|status=Fully Documented&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Line Following&amp;#039;&amp;#039;&amp;#039; is a fundamental mobile robotics activity where a robot autonomously follows a visible path marked on the ground. The path is typically a contrasting line—commonly black tape on a white surface, or white tape on a dark surface—that the robot detects using optical sensors.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Line following represents one of the most accessible yet instructive challenges in mobile robotics. The task requires a robot to continuously sense its position relative to a line and make steering corrections to stay on course. Despite its conceptual simplicity, line following introduces essential robotics concepts including sensor processing, feedback control, and real-time decision-making.&lt;br /&gt;
&lt;br /&gt;
This activity serves as an excellent introduction to autonomous navigation because it provides immediate visual feedback, requires minimal hardware, and scales from simple implementations to sophisticated control algorithms.&lt;br /&gt;
&lt;br /&gt;
== Real-World Applications ==&lt;br /&gt;
&lt;br /&gt;
Line following technology underpins numerous industrial and commercial automation systems:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Warehouse AGVs&amp;#039;&amp;#039;&amp;#039; - Automated Guided Vehicles follow magnetic strips or optical lines embedded in warehouse floors to transport materials between storage areas, loading docks, and production lines. These systems operate 24/7 in facilities worldwide, moving thousands of tons of goods daily.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factory Automation&amp;#039;&amp;#039;&amp;#039; - Manufacturing plants use line-following robots to deliver parts and materials along production lines, maintaining just-in-time inventory systems and reducing manual material handling.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Museum Tour Guides&amp;#039;&amp;#039;&amp;#039; - Some autonomous tour guide robots follow nearly-invisible lines embedded in museum floors, stopping at exhibits to provide information to visitors while navigating safely through crowded spaces.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Robotic Vacuum Cleaners&amp;#039;&amp;#039;&amp;#039; - Advanced models use virtual walls and boundary markers (optical or magnetic) to define cleaning areas and create efficient coverage patterns.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Hospital and Hotel Service Robots&amp;#039;&amp;#039;&amp;#039; - Autonomous delivery robots follow embedded pathways to transport medications, linens, meals, and supplies through facilities while avoiding obstacles and people.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Agricultural Robots&amp;#039;&amp;#039;&amp;#039; - Field robots follow crop rows or temporary markers to perform precise planting, weeding, and harvesting operations.&lt;br /&gt;
&lt;br /&gt;
The prevalence of line following in industry demonstrates that simple, reliable solutions often outperform complex alternatives in structured environments.&lt;br /&gt;
&lt;br /&gt;
== Required Capabilities ==&lt;br /&gt;
&lt;br /&gt;
=== Line Sensing ===&lt;br /&gt;
&lt;br /&gt;
[[Capability:Line Sensing]] provides the fundamental input for this activity. The robot must detect the contrast between the line and the surrounding surface. This typically involves:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Reflective Optical Sensors&amp;#039;&amp;#039;&amp;#039; - Infrared LED/phototransistor pairs that measure reflected light intensity&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Analog or Digital Output&amp;#039;&amp;#039;&amp;#039; - Sensors may provide continuous readings (analog) or binary on/off signals (digital)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Multiple Sensor Configurations&amp;#039;&amp;#039;&amp;#039; - From single sensors to arrays of 3, 5, 8, or more sensors for enhanced precision&lt;br /&gt;
&lt;br /&gt;
Without line sensing capability, the robot has no way to perceive the path it should follow.&lt;br /&gt;
&lt;br /&gt;
=== Differential Drive ===&lt;br /&gt;
&lt;br /&gt;
[[Capability:Differential Drive]] enables the robot to steer by controlling the speed of left and right wheels independently. This capability is essential because:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Independent Motor Control&amp;#039;&amp;#039;&amp;#039; - Allows precise steering corrections without mechanical steering mechanisms&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Pivot Turning&amp;#039;&amp;#039;&amp;#039; - Enables the robot to navigate sharp corners by rotating in place&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Speed Modulation&amp;#039;&amp;#039;&amp;#039; - Permits smooth curves by varying relative wheel speeds&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Bidirectional Operation&amp;#039;&amp;#039;&amp;#039; - Supports forward and backward line following when needed&lt;br /&gt;
&lt;br /&gt;
While other drive systems (Ackermann steering, omnidirectional wheels) can follow lines, differential drive offers the simplest and most common implementation for educational and small-scale robots.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
&lt;br /&gt;
=== Basic Algorithm ===&lt;br /&gt;
&lt;br /&gt;
At its core, line following implements a feedback control loop:&lt;br /&gt;
&lt;br /&gt;
1. &amp;#039;&amp;#039;&amp;#039;Sense&amp;#039;&amp;#039;&amp;#039; - Read line sensor(s) to determine the robot&amp;#039;s position relative to the line&lt;br /&gt;
2. &amp;#039;&amp;#039;&amp;#039;Decide&amp;#039;&amp;#039;&amp;#039; - Calculate the steering correction needed to center on the line&lt;br /&gt;
3. &amp;#039;&amp;#039;&amp;#039;Act&amp;#039;&amp;#039;&amp;#039; - Adjust motor speeds to execute the steering correction&lt;br /&gt;
4. &amp;#039;&amp;#039;&amp;#039;Repeat&amp;#039;&amp;#039;&amp;#039; - Continuously loop at high frequency (typically 10-100+ Hz)&lt;br /&gt;
&lt;br /&gt;
=== Control Strategies ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Bang-Bang Control&amp;#039;&amp;#039;&amp;#039; - The simplest approach using binary decisions:&lt;br /&gt;
* Line detected on left → turn right&lt;br /&gt;
* Line detected on right → turn left&lt;br /&gt;
* Line centered → go straight&lt;br /&gt;
&lt;br /&gt;
This produces characteristic oscillating motion but works effectively at slow speeds.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Proportional Control&amp;#039;&amp;#039;&amp;#039; - Adjusts steering intensity based on error magnitude:&lt;br /&gt;
* Calculate position error (how far off-center the line appears)&lt;br /&gt;
* Apply steering correction proportional to the error&lt;br /&gt;
* Results in smoother tracking with less oscillation&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PID Control&amp;#039;&amp;#039;&amp;#039; - Advanced control using Proportional, Integral, and Derivative terms:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Proportional&amp;#039;&amp;#039;&amp;#039; - Responds to current error&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Integral&amp;#039;&amp;#039;&amp;#039; - Compensates for persistent bias (e.g., motor imbalance)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Derivative&amp;#039;&amp;#039;&amp;#039; - Anticipates error changes to reduce overshoot&lt;br /&gt;
* Provides optimal performance but requires parameter tuning&lt;br /&gt;
&lt;br /&gt;
== Difficulty Levels ==&lt;br /&gt;
&lt;br /&gt;
=== Single Sensor (Hardest) ===&lt;br /&gt;
&lt;br /&gt;
Using one sensor positioned at the robot&amp;#039;s edge creates a challenging scenario:&lt;br /&gt;
&lt;br /&gt;
* Robot must oscillate across the line boundary to maintain tracking&lt;br /&gt;
* Requires precise timing and calibration&lt;br /&gt;
* Very sensitive to speed changes&lt;br /&gt;
* Good learning exercise for understanding feedback loops&lt;br /&gt;
&lt;br /&gt;
=== Two Sensors (Moderate) ===&lt;br /&gt;
&lt;br /&gt;
Positioning sensors on either side of the expected line position:&lt;br /&gt;
&lt;br /&gt;
* Can detect which side of the line the robot is on&lt;br /&gt;
* Enables three-state control (left, center, right)&lt;br /&gt;
* More stable than single sensor&lt;br /&gt;
* Still limited precision on curves&lt;br /&gt;
&lt;br /&gt;
=== Multi-Sensor Array (Easiest) ===&lt;br /&gt;
&lt;br /&gt;
Arrays of 3-8+ sensors provide comprehensive line information:&lt;br /&gt;
&lt;br /&gt;
* Can calculate precise line position using weighted averaging&lt;br /&gt;
* Detects line angle for predictive steering&lt;br /&gt;
* Handles wider lines and gradual curves smoothly&lt;br /&gt;
* Can detect special conditions (intersections, markers, line ends)&lt;br /&gt;
* Enables sophisticated algorithms like PID control&lt;br /&gt;
&lt;br /&gt;
Most educational line-following robots use arrays of 3-5 sensors as the optimal balance of capability and complexity.&lt;br /&gt;
&lt;br /&gt;
== Common Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Lost Line Recovery ===&lt;br /&gt;
&lt;br /&gt;
When the robot loses the line completely (all sensors read the same):&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Gaps in the line, excessive speed, sharp corners, sensor misalignment&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Remember last known direction, execute search patterns, reduce speed before anticipated gaps&lt;br /&gt;
&lt;br /&gt;
=== Sharp Corners ===&lt;br /&gt;
&lt;br /&gt;
Standard algorithms struggle with turns exceeding 45-60 degrees:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Sensor array too narrow to detect the line after turning&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Slow down before corners, use wider sensor spacing, implement turn-in-place maneuvers for detected corners&lt;br /&gt;
&lt;br /&gt;
=== Intersections and Junctions ===&lt;br /&gt;
&lt;br /&gt;
Multiple line paths confuse standard tracking algorithms:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Sensors detect lines in multiple directions&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Pre-programmed intersection behavior (turn left, right, straight), marker detection for navigation decisions, line counting&lt;br /&gt;
&lt;br /&gt;
=== Lighting Conditions ===&lt;br /&gt;
&lt;br /&gt;
Variable ambient light affects sensor readings:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Sunlight, shadows, reflective surfaces, different surface colors&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Regular calibration, use sensors with ambient light rejection, adaptive thresholding algorithms&lt;br /&gt;
&lt;br /&gt;
=== Surface Variations ===&lt;br /&gt;
&lt;br /&gt;
Different materials affect sensor performance:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Glossy vs. matte finishes, textured surfaces, surface contaminants&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Test on target surface, adjust sensor height, use appropriate wavelength sensors&lt;br /&gt;
&lt;br /&gt;
=== Worn or Inconsistent Lines ===&lt;br /&gt;
&lt;br /&gt;
Faded tape or irregular marking reduces contrast:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Causes&amp;#039;&amp;#039;&amp;#039; - Wear from traffic, poor initial application, low-quality materials&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Solutions&amp;#039;&amp;#039;&amp;#039; - Use high-quality tape, regular track maintenance, robust threshold settings&lt;br /&gt;
&lt;br /&gt;
== Performance Metrics ==&lt;br /&gt;
&lt;br /&gt;
=== Speed ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Metric&amp;#039;&amp;#039;&amp;#039; - Maximum velocity while maintaining line contact&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Typical Values&amp;#039;&amp;#039;&amp;#039; - 0.1-0.5 m/s for educational robots, 1-3 m/s for competition robots&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factors&amp;#039;&amp;#039;&amp;#039; - Sensor update rate, control algorithm sophistication, track complexity&lt;br /&gt;
&lt;br /&gt;
=== Accuracy ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Metric&amp;#039;&amp;#039;&amp;#039; - Deviation from line center during tracking (RMS error)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Typical Values&amp;#039;&amp;#039;&amp;#039; - ±2-5mm for good implementations&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factors&amp;#039;&amp;#039;&amp;#039; - Sensor resolution, control algorithm quality, mechanical precision&lt;br /&gt;
&lt;br /&gt;
=== Recovery Time ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Metric&amp;#039;&amp;#039;&amp;#039; - Time to re-acquire line after disturbance or gap&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Typical Values&amp;#039;&amp;#039;&amp;#039; - 0.1-0.5 seconds&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factors&amp;#039;&amp;#039;&amp;#039; - Search algorithm effectiveness, robot speed, sensor field of view&lt;br /&gt;
&lt;br /&gt;
=== Consistency ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Metric&amp;#039;&amp;#039;&amp;#039; - Ability to complete course repeatedly without failure&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Typical Values&amp;#039;&amp;#039;&amp;#039; - 95%+ success rate for tuned systems&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factors&amp;#039;&amp;#039;&amp;#039; - Robustness of algorithms, sensor noise immunity, mechanical reliability&lt;br /&gt;
&lt;br /&gt;
=== Energy Efficiency ===&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Metric&amp;#039;&amp;#039;&amp;#039; - Battery consumption per unit distance traveled&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Factors&amp;#039;&amp;#039;&amp;#039; - Excessive steering corrections reduce efficiency; smooth tracking with minimal oscillation optimizes energy use&lt;br /&gt;
&lt;br /&gt;
== Implementation Considerations ==&lt;br /&gt;
&lt;br /&gt;
When implementing line following on a robot:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Start Simple&amp;#039;&amp;#039;&amp;#039; - Begin with bang-bang control to verify hardware functionality&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Calibrate Thoroughly&amp;#039;&amp;#039;&amp;#039; - Measure sensor readings on both line and background surfaces under actual operating conditions&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Tune Incrementally&amp;#039;&amp;#039;&amp;#039; - If using PID, tune P first, then add D, finally add I if needed&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Test Progressively&amp;#039;&amp;#039;&amp;#039; - Begin with straight lines, then gentle curves, then sharp corners&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Log Data&amp;#039;&amp;#039;&amp;#039; - Record sensor readings and motor commands to diagnose problems&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Consider Speed vs. Accuracy&amp;#039;&amp;#039;&amp;#039; - Slower speeds are more forgiving; increase speed only after reliable tracking at lower speeds&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Behavior:Line Following]] - The behavior implementation details&lt;br /&gt;
* [[Capability:Line Sensing]] - Technical details of line detection sensors&lt;br /&gt;
* [[Capability:Differential Drive]] - Motor control fundamentals&lt;br /&gt;
* [[SimpleBot]] - A robot with complete line following implementation&lt;br /&gt;
* [[Activity:Maze Solving]] - Advanced activity that may incorporate line following&lt;br /&gt;
&lt;br /&gt;
[[Category:Activity]]&lt;br /&gt;
[[Category:Beginner Activity]]&lt;br /&gt;
[[Category:Navigation]]&lt;/div&gt;</summary>
		<author><name>John</name></author>
	</entry>
</feed>