Difference between revisions of "Itty Bitty Buggy: Line Tracing Tutorial (mDesigner)"

From Microduino Wiki
Jump to: navigation, search
(Block: Color Trace (Go along color))
(Block: Color Trace (Go along color))
 
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=Line Tracing=
 
=Line Tracing=
Buggy Base contains two Color Detectors and two ColorLEDs. These joined together can be used to detect when a line is detected based on its configured color. With this information, it is possible to steer the motors either left or right to stay on the line. The follow blocks will use the Color Detectors, ColorLEDs to stay along (trace) a line.
+
Buggy Base contains two Color Detectors and two ColorLEDs. These joined together can be used to detect when a line is detected based on its configured color. With this information, it is possible to steer the motors either left or right to stay on the line. The following blocks will use the Color Detectors, ColorLEDs to stay along (trace) a line.
  
==Block: Color Trace (Go along color)==
+
=Block: Color Trace (Go along color)=
 
Start of line tracing can be called with this block.
 
Start of line tracing can be called with this block.
  
Line 12: Line 12:
  
 
:*'''Color''' - color of the line to trace (either '''red''', '''green''', '''blue''' or '''black''').
 
:*'''Color''' - color of the line to trace (either '''red''', '''green''', '''blue''' or '''black''').
 +
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:''' This block does one '''adjustment''' when it is called. This means this block has to be constantly called in order to make frequent adjustments to stay on the line.
 +
|}
 
{| class="wikitable" style="background-color:#FEF9E7;"
 
{| class="wikitable" style="background-color:#FEF9E7;"
 
|'''Note:''' This block assumes that the color line is against a white background. (For example, a color line drawn on a white piece of paper.) Therefore, there may be issues when using it against a non-white background.
 
|'''Note:''' This block assumes that the color line is against a white background. (For example, a color line drawn on a white piece of paper.) Therefore, there may be issues when using it against a non-white background.
Line 18: Line 21:
 
|'''Note:''' The speed of tracing cannot be set.
 
|'''Note:''' The speed of tracing cannot be set.
 
|}
 
|}
 +
|}
 +
 +
==Example 1: Follow a black line==
 +
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:''' this example is performed in '''offline mode''' [[File:Info_icon.png|24px|link=no_link]].<br>
 +
|}
 +
{|
 +
 +
{|
 +
 +
|style="vertical-align:top;"|
 +
{| class="wikitable"
 +
|+Blocks Used
 +
!Block Category
 +
!Blocks
 +
|-
 +
|bgcolor=FEC254|Events
 +
|[[File:MDesigner_When_Click_Green_Flag_block_new.png|x50px]] [[File:Info_icon.png|24px|link=block_reference]]
 +
|-
 +
|bgcolor=FEAD50|Control
 +
|[[File:mDesigner_v1.6_Forever_block.png|x75px]] [[File:Info_icon.png|24px|link=block_reference]]
 +
 +
|-
 +
|Buggy [[File:IBB_Buggy_icon.png|x30px]]
 +
|[[File:IBB_mDesigner_Car_Block_Go_Along_Color_NoLabels.png|x50px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Color_Trace]] [[File:Info_icon.png|24px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Color_Trace]]
 +
|}
 +
 +
|style="vertical-align:top;"|
 +
{| class="wikitable"
 +
|+Example
 +
|-
 +
|style="padding:50px;"|
 +
[[File:IBB_mDesigner_Line_Tracing_Example1.png]]
 +
|}
 +
 +
|}
 +
 +
'''Description:''' [[how to activate blocks|When activated]], the program will trace along a black line. Download and print this map to test it out: '''[[File:Line_Tracing_Example1_Map.pdf]]'''
 +
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:''' This example runs the '''Color Trace''' block constantly inside a '''Forever''' block.<br>
 +
Each time the '''Color Trace''' block is called, it adjust the Buggy Base to stay on the line. Therefore, it is important to be constantly calling the '''Color Trace''' block or else Buggy Base will go off the line.
 +
|}
 +
 +
=Block: Stop Trace=
 +
This block stops the motors on Buggy Base and turns off the ColorLEDs (both of which were activated during the '''Color Trace''' block call).
 +
 +
{| class="wikitable"
 +
|
 +
'''Function:''' This block stops the Buggy Base following the line (tracing).
 +
:[[File:IBB_mDesigner_Car_Block_Stop_Trace.png]]
 +
|}
 +
==Example 2: Trace the black line then pause==
 +
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:''' this example is performed in '''offline mode''' [[File:Info_icon.png|24px|link=no_link]].<br>
 +
|}
 +
{|
 +
 +
{|
 +
 +
|style="vertical-align:top;"|
 +
{| class="wikitable"
 +
|+Blocks Used
 +
!Block Category
 +
!Blocks
 +
|-
 +
|bgcolor=FEC254|Events
 +
|[[File:MDesigner_When_Click_Green_Flag_block_new.png|x50px]] [[File:Info_icon.png|24px|link=block_reference]]
 +
|-
 +
|bgcolor=FEAD50|Control
 +
|
 +
[[File:mDesigner_v1.6_Wait_block.png|x50px]] [[File:Info_icon.png|24px|link=block_reference]]<br><br>
 +
[[File:MDesigner_v1.6_Repeat_block.png|x75px]] [[File:Info_icon.png|24px|link=block_reference]]<br><br>
 +
[[File:mDesigner_v1.6_Forever_block.png|x75px]] [[File:Info_icon.png|24px|link=block_reference]]<br><br>
 +
|-
 +
|Buggy [[File:IBB_Buggy_icon.png|x30px]]
 +
|
 +
[[File:IBB_mDesigner_Car_Block_Go_Along_Color_NoLabels.png|x50px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Color_Trace]] [[File:Info_icon.png|24px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Color_Trace]]<br><br>
 +
[[File:IBB_mDesigner_Car_Block_Stop_Trace.png|x50px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Stop_Trace]] [[File:Info_icon.png|24px|link=Buggy_Base_(use_with_mDesigner)#Car_-_Stop_Trace]]
 +
|}
 +
 +
|style="vertical-align:top;"|
 +
{| class="wikitable"
 +
|+Example
 +
|-
 +
|style="padding:50px;"|
 +
[[File:IBB_mDesigner_Line_Tracing_Example2.png]]
 +
|}
 +
 +
|}
 +
 +
'''Description:''' [[how to activate blocks|When activated]], the program will repeatedly trace along a black line for 3 seconds, then stop tracing for 3 seconds. Use the same map from example 1 to test it out:  '''[[File:Line_Tracing_Example1_Map.pdf]]'''
 +
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:'''
 +
*This example runs the '''Color Trace''' block constantly inside a '''Repeat''' block.
 +
*Each time the '''Color Trace''' block is called, it adjusts the Buggy Base to stay on the line. Therefore, it is important to be constantly call the '''Color Trace''' block or else Buggy Base will go off the line.
 +
*The 3 seconds of tracing is calculated by the delay of 0.01 seconds * 300 = 3 seconds.
 
|}
 
|}

Latest revision as of 22:38, 1 November 2018

Line Tracing

Buggy Base contains two Color Detectors and two ColorLEDs. These joined together can be used to detect when a line is detected based on its configured color. With this information, it is possible to steer the motors either left or right to stay on the line. The following blocks will use the Color Detectors, ColorLEDs to stay along (trace) a line.

Block: Color Trace (Go along color)

Start of line tracing can be called with this block.

Function: This block controls the Buggy Base to follow (trace) along the chosen color line.

IBB mDesigner Car Block Go Along Color.png
  • Color - color of the line to trace (either red, green, blue or black).
Note: This block does one adjustment when it is called. This means this block has to be constantly called in order to make frequent adjustments to stay on the line.
Note: This block assumes that the color line is against a white background. (For example, a color line drawn on a white piece of paper.) Therefore, there may be issues when using it against a non-white background.
Note: The speed of tracing cannot be set.

Example 1: Follow a black line

Note: this example is performed in offline mode Info icon.png.
Blocks Used
Block Category Blocks
Events MDesigner When Click Green Flag block new.png Info icon.png
Control MDesigner v1.6 Forever block.png Info icon.png
Buggy IBB Buggy icon.png IBB mDesigner Car Block Go Along Color NoLabels.png Info icon.png
Example

IBB mDesigner Line Tracing Example1.png

Description: When activated, the program will trace along a black line. Download and print this map to test it out: File:Line Tracing Example1 Map.pdf

Note: This example runs the Color Trace block constantly inside a Forever block.

Each time the Color Trace block is called, it adjust the Buggy Base to stay on the line. Therefore, it is important to be constantly calling the Color Trace block or else Buggy Base will go off the line.

Block: Stop Trace

This block stops the motors on Buggy Base and turns off the ColorLEDs (both of which were activated during the Color Trace block call).

Function: This block stops the Buggy Base following the line (tracing).

IBB mDesigner Car Block Stop Trace.png

Example 2: Trace the black line then pause

Note: this example is performed in offline mode Info icon.png.
Blocks Used
Block Category Blocks
Events MDesigner When Click Green Flag block new.png Info icon.png
Control

MDesigner v1.6 Wait block.png Info icon.png

MDesigner v1.6 Repeat block.png Info icon.png

MDesigner v1.6 Forever block.png Info icon.png

Buggy IBB Buggy icon.png

IBB mDesigner Car Block Go Along Color NoLabels.png Info icon.png

IBB mDesigner Car Block Stop Trace.png Info icon.png

Example

IBB mDesigner Line Tracing Example2.png

Description: When activated, the program will repeatedly trace along a black line for 3 seconds, then stop tracing for 3 seconds. Use the same map from example 1 to test it out: File:Line Tracing Example1 Map.pdf

Note:
  • This example runs the Color Trace block constantly inside a Repeat block.
  • Each time the Color Trace block is called, it adjusts the Buggy Base to stay on the line. Therefore, it is important to be constantly call the Color Trace block or else Buggy Base will go off the line.
  • The 3 seconds of tracing is calculated by the delay of 0.01 seconds * 300 = 3 seconds.