Rescuer Learn 4: Logical Decisions

Site: GoLabs
Course: Robotic Challenges with Python and GoPiGo
Book: Rescuer Learn 4: Logical Decisions
Printed by: Guest user
Date: Thursday, 16 May 2024, 5:03 AM

Description

This is the third challenge within the Robotics with GoPiGo and Python Curriculum.

Your task is to design a robot program that can navigate through the maze-like jungle without trampling over any plants or getting stuck in any dead ends.

Learn how to use the Distance Sensor and practice using the left-hand rule of maze-solving.

1. Making Logical Decisions

Set the robot aside for a moment and let’s discuss logical decision making. We’ll get back to the robot very soon.

Imagine that you want to watch a film on the TV. You press the power button on your remote control but nothing happens. You then realise that the TV is not plugged in. You plug it in but it still doesn’t work. It’s only then that you remember that you recently borrowed the batteries from the remote control for your new remote controlled toy. D’oh! Off you go to retrieve those batteries.

The TV is now on and the popcorn is made. Let’s now find a film to watch. You fancy watching some science fiction or comedy. You flick through your film library for film that fits the bill. Wouldn’t it be great if you could find a film that is both a comedy and science fiction such as “Men In Black” or “Back to the Future”? However, you’re not fussy. You’ll watch anything from either genre.

In the scenario described above, the TV will only power on when all of the pre-conditions are met and you will choose a film that meets any of your genre criteria. Let’s describe these situations in pictures.

In the computing industry, we call these truth tables. To determine an outcome, simply read off the value in the cell that is in the row and column that matches the answer to both of your questions. 

LEFT TABLE:

When a positive outcome requires all conditions to be met, we use an AND table. It is called this because the end result can only happen if condition A  AND condition B are true. 

RIGHT TABLE:

When a positive outcome only requires any one of the conditions to be met we use an OR table. It is called this because the end result can also happen if only one of condition A OR condition B is true.


2. Mark Learn as Done

We’re coming back to the robot now!

In this project, you will be using front-facing and left-facing distance sensors to help your robot find its way out of a maze.

Truth tables can be used as a planning tool to help you decide what your robot should do (the truth table outcomes) based on whether or not your code determines that there is a wall in front of or to the left of it (the truth table conditions).

You are now ready for the big project! Will your robot be able to save the scientists lost deep in the rainforest and take them back to safety?

What will be the questions for the rescuer's truth table?