Rescuer: Project

Site: GoLabs
Course: Robotic Challenges with Python and GoPiGo
Book: Rescuer: Project
Printed by: Guest user
Date: Thursday, 16 May 2024, 4:22 PM

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. The Challenge

Write some code to instruct your rescuer robot to :

          • navigate its way through a maze
          • from the entry point
          • to the exit point
          • using a pair of
            • front-facing and
            • left-facing distance sensors.

Your rescuer robot can only :

          • drive forwards,
          • turn left 90 degrees,
          • turn right 90 degrees.
          • If necessary, you can also adjust its orientation to keep it running parallel to the left wall using the align_with_left_wall() template function that we have provided for you.

No other movements should be necessary.


2. Create A Maze

Create a maze on your floor for your rescuer robot to navigate. 

The design of the maze is up to you but it should have :

          • an entry point
          • an exit point
          • contain a mixture of
            • dead-ends,
            • left turns
            • right turns.

It is recommended to make the maze no larger than 2 meters squared with corridors 40-50cm wide.

Use whatever objects you have around you to construct the walls of the maze. 

For the distance sensors to sense these walls, the walls must be solid.

Solid walls can be created from many things including

          • boxes,
          • books,
          • blankets,
          • cushions
          • opened up cereal boxes taped together.
          • table turned on its side (with permission from an adult),
          • a piece of solid furniture such as a low sofa
          • a physical wall as part of your maze.
          • you could even use plant pots with luxurious plants to get that Amazonian feel!

Below is an example for inspiration.



3. Plan Your Logic

You have front-facing and left-facing distance sensors available to guide your rescuer robot through the maze.

          • Draw a truth table like the one below.
          • For each empty cell in the truth table below, fill in what action you think your robot should take based on the conditions sensed in front of and to the left of it.

Remember: the only allowable actions are:

          • drive forward,
          • turn 90 degrees left
          • turn 90 degrees right.


4. Program Your Rescuer Robot

Now it’s time to code up your rescuer robot. Using what you have learned and the truth table you have constructed above to guide you, change the code in the Main Code cell so that, when run, your robot will navigate successfully through your maze.

You might want to think carefully about the following issues:

      1. How do you translate distance readings into yes/no answers to the question “is there a wall?”?
      2. How does your solution deal with dead ends?

May your mission be successful!


5. Try It Out

Don't run your code right away!

Move on to the Try It Out lesson when you've coded the rescue mission.

The Try It Out Lesson has things to consider before you run your code.