Itty Bitty Buggy: Example 3: Line Avoidance (mDesigner)

From Microduino Wiki
Revision as of 23:52, 2 November 2018 by Sonny (talk | contribs) (Overview)
Jump to: navigation, search

Introduction

Itty Bitty Buggy is capable of tracing lines, but what about avoiding them? This example will program Itty Bitty Buggy to avoid a line!

Overview

How can we make it so Itty Bitty Bug avoids a line instead of tracing it?

First, how can we detect a line? We can use the Color Detector to do so. But which block?

IBB mDesigner LineFInder Block Test Color.png

The Color Detector - Detect Color block of course! It is capable of detecting colors, which means it can be used to detect a colored line.

Great, so, we are able to detect a line, what next? We need to avoid it. How can we avoid it? We can turn away from the line. But which way?

Since Itty Bitty Buggy has two sets of Color Detectors, one on each side, labeled A (left side) and B (right side). (As labeled on the underside of Buggy Base.)

IBB Example3 Image1.png

We can detect which side we are approaching a line, based on which Color Detector senses the line. With this information, we can turn away from the line.

If we detect the line on the A Color Detector (left side), we need to turn right in order to avoid it.

IBB Example3 Image2.png

To turn right, we can set the motors speeds to steer right.

File:Img.png

If we detect the line on the B Color Detector (right side), we need to turn left in order to avoid it.

IBB Example3 Image3.png

To turn left, we can set the motors speeds to steer left.

File:Img.png

If we do not detect a line on both the A and B Color Detectors, we are fine with going forward.

IBB Example3 Image4.png

To go forward, we can set the motors speeds to move forward. We have the the motors at a slow speed going forward as it gives Itty Bitty Buggy a chance to detect the line. Moving forwarded too fast can cause Itty Bitty Buggy to simply skip over the line without avoiding it.

File:Img.png