- Module 24
Edge Detection and Safe Robot Navigation
Programming / Robotics / Engineering
Module Identity
TitleEdge detection and safe robot navigationSubject AreasInformation Technology Natural Sciences Engineering RoboticsFormatExperiential learning; Small group work (3-5 students); Observation of robot behavior; Modification of safety parameters.Preparation RequirementsSetup FOSSBot or CoppeliaSim; Load the "sens6_edge_detection" stage; Ensure floor sensors are calibrated.Estimated Duration45 minutesAge Range14-15 years old (Upper levels of lower secondary)KeywordsEdge Detection, Floor Sensors, Safety Systems, Logical Operators (AND), If-Else Structures, Risk Avoidance.SummarySafety is a critical component in the design of autonomous systems. This scenario explores how a robot can utilize floor sensors to detect edges (such as a table's limit) and automatically adjust its behavior to prevent falls. Students work experientially to predict, observe, and program risk avoidance behaviors. By employing logical operators (AND) and selection structures (If-Else If), learners develop algorithms that allow the FOSSBot to recognize dangerous voids and execute safety maneuvers like backing up and turning.
Introduction
How does a robot know when it is about to fall? This lesson delves into the mechanics of edge detection using floor sensors. Students engage in a series of activities designed to help them "think like a robot," defining what constitutes an edge and how to react to it.
Starting with discussions and predictions, students progress to running and modifying complex code. They analyze different hazard scenarios—detecting an edge on the left, right, or both sides—and program appropriate countermeasures. This not only builds programming skills but also highlights the relationship between sensors and real-world safety systems.
Prerequisite Knowledge
- • Familiarity with basic selection structures (if – else)
- • Familiarity with using sensors
- • Experience with basic robot movement commands
- • Ability to work effectively in small groups (3–5 people)
Learning Outcomes
By the end of this module, students will be able to:
Conceptual Understanding
- ✓ Understand how robots make safety decisions based on environmental data
- ✓ Describe how the robot reacts to different hazard scenarios
- ✓ Explain why backing up and turning actions increase safety
Programming & Implementation
- ✓ Use FOSSBot floor sensors to read surface values
- ✓ Combine multiple conditions using if – else if structures
- ✓ Combine conditions using the logical AND operator
Engineering & Problem-Solving
- ✓ Program risk avoidance behavior to prevent equipment damage
- ✓ Modify parameters (backward distance, turning angle) to optimize safety
- ✓ Relate sensors to real-world safety systems in engineering
📐 Key Logic & Safety Concepts
Safe Ground Logic (Logical AND):
IF (Left != 0 AND Right != 0)
THEN [Move Forward]The robot moves forward only if both sensors detect the floor (ground value is not 0).
Hazard Detection (If-Else If):
ELSE IF (Left != 0 AND Right == 0) THEN [Back + Turn Left]
ELSE IF (Left == 0 AND Right != 0) THEN [Back + Turn Right]If the ground disappears under one sensor (value becomes 0), the robot performs a safety maneuver.
Students observe that moving backwards before turning is crucial to prevent the wheels from slipping off the edge during rotation.


