<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:lego_line_tracking_test

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
wiki:v2:lego_line_tracking_test [2019/01/30 01:45]
pixycam
wiki:v2:lego_line_tracking_test [2019/01/30 02:02]
pixycam
Line 3: Line 3:
 From the LEGO Mindstorms EV3 Software, go to the **File** menu and select **Open Project**.\\ From the LEGO Mindstorms EV3 Software, go to the **File** menu and select **Open Project**.\\
 {{wiki:​img:​3e3b64f2ff052ac58280fa2315eff9d803714e6e.png}}\\ {{wiki:​img:​3e3b64f2ff052ac58280fa2315eff9d803714e6e.png}}\\
-Browse to the location where you unzipped the "LEGO blocks and examples"​ file, and then to the **examples** directory and then either to the **EV3** or **NXT** directory depending on your brick version. Select "​line\_test.ev3"​ and click on **Open**.  ​+Browse to the location where you unzipped the "LEGO blocks and examples"​ file, and then to the **examples** directory and then either to the **EV3** or **NXT** directory depending on your brick version. Select "​line\_test.ev3"​ and click on **Open**.  ​The program is shown below. ​
  
-{{ }}+{{wiki:​v1:​image_725.png}}
  
  
Line 11: Line 11:
 {{wiki:​v2:​image_704.png}} {{wiki:​v2:​image_704.png}}
  
 +
 +===== Detecting and Tracking a Line (Vector) =====
  
 Draw a line on a piece of paper and put it in front of Pixy2. ​ Pencil will work, but black marker is usually better. ​ If you are running PixyMon, you should see something like this: Draw a line on a piece of paper and put it in front of Pixy2. ​ Pencil will work, but black marker is usually better. ​ If you are running PixyMon, you should see something like this:
Line 21: Line 23:
  
  
-{{}}+{{wiki:​v1:​image_726.png}}
  
  
-You can also see what happens when you turn off and on Pixy2'​s lamp by setting it to false or true.  You'll need to stop the program and re-run it for the change to take effect though. ​+===== The Lamp =====
  
-{{}}+You can also see what happens when you turn off and on Pixy2'​s lamp by setting it to false or true.  You'll need to stop the program and re-run it for the change to take effect.  
 + 
 +{{wiki:​v1:​image_729.png}}
  
  
Line 32: Line 36:
  
  
-Make a 4-way intersection by drawing another line through the original line and place it in front of Pixy2. ​ Pixy2 will identify the intersection and quickly choose the default branch of the intersection,​ which is the "​straightest"​ branch of the intersection,​ assuming the Turn Angle input is set to 0 (default).  ​You should notice that while Pixy2 sees the intersection,​ the EV3 LCD will show "​Intsctn:​ 4", meaning that it sees a 4-way intersection. ​   ​+===== Make an intersection ===== 
 + 
 +Make a 4-way intersection by drawing another line through the original line and place it in front of Pixy2. ​ Pixy2 will identify the intersection and quickly choose the default branch of the intersection,​ which is the "​straightest"​ branch of the intersection,​ assuming the Turn Angle input is set to 0 (default).  ​If you run the EV3 program, you should notice that while Pixy2 sees the intersection,​ the EV3 LCD will show "​Intsctn:​ 4", meaning that it sees a 4-way intersection. ​   ​
  
  
Line 38: Line 44:
  
  
-You can stop the program and change turn angle to 90 degrees.+You can stop the program and change turn angle to -90 degrees.
  
 +{{wiki:​v1:​image_732.png}}
  
-{{}} +-90 degrees is a right turn according to the diagram below.  ​
- +
-90 degrees is a left turn according to the diagram below.  ​+
  
  
Line 49: Line 54:
  
  
-Re-run the program and notice that when it sees the intersection it will choose the left-most branch as the Vector.   +Re-run the program and notice that when it sees the intersection it will choose the right-most branch ​of the intersection ​as the Vector (instead ​of the straightest.)   
- +
-Try changing the default turn angle to -90 (right-most turn/​branch) and click on Apply. ​  +
- +
- +
-{{wiki:​v2:​image_376.png}} +
- +
- +
-Now when you place the intersection in front of Pixy2, it will choose ​the right-most branch of the intersection +
  
  
Line 63: Line 60:
  
  
-By default, Pixy2 will choose the branch automatically based on default turn angle or the most recent call to [[wiki:​v2:​line_api|setNextTurn()]]. ​ You can change this behavior by enabling "​delayed turn" in the Expert configure tab.  ​+====- Barcodes ===-=
  
 +We wanted Pixy2 to be able to receive simple commands or information while it is performing line tracking, so we added the barcode feature. ​ The barcodes are intended to act as "​roadsigns"​. ​ You can add graphics to the barcodes that are human-readable as long as you keep the barcode unobstructed. ​   To test the barcode functionality,​ download the print the [[https://​github.com/​charmedlabs/​pixy2/​raw/​master/​documents/​other/​all_codes.pdf|all_codes.pdf]] document. ​ (Note, other barcode files and images can be found [[https://​pixycam.com/​downloads-pixy2/​|here]].)
  
-Go ahead and enable delayed turn and click on Apply.  ​ 
  
 +Holding the document in front of Pixy2 while it is running the line tracking algorithm will yield something like this in PixyMon:
  
-{{wiki:​v2:​image_371.png}} 
  
 +{{wiki:​v2:​image_374.png}}
  
-Now when you place the intersection in front of Pixy2, it won't choose the branch automatically. ​ Instead Pixy2 will label the intersection because, it doesn'​t know what action to take.  
- 
- 
-{{wiki:​v2:​image_375.png}} 
- 
- 
-In delayed turn mode, Pixy2 will wait for your controller to call [[wiki:​v2:​line_api|setNextTurn()]] which will instruct Pixy2 to choose the branch of the intersection that matches the angle the closest.  ​ 
- 
- 
- 
- 
- 
- 
-==== Barcodes ==== 
- 
-We wanted Pixy2 to be able to receive simple commands or information while it is performing line tracking, so we added the barcode feature. ​ The barcodes are intended to act as "​roadsigns"​. ​ You can add graphics to the barcodes that are human-readable as long as you keep the barcode unobstructed. ​   To test the barcode functionality,​ download the print the [[https://​github.com/​charmedlabs/​pixy2/​raw/​master/​documents/​other/​all_codes.pdf|all_codes.pdf]] document.  ​ 
- 
- 
-Holding the document in front of Pixy2 while it is running the line tracking algorithm will yield something like this: 
- 
- 
-{{wiki:​v2:​image_374.png}} 
  
 +If you run the EV3 program, you should see the text "​Barcode:​ n" on the EV3 LCD, where "​n"​ is the barcode'​s number.  ​
  
  
wiki/v2/lego_line_tracking_test.txt · Last modified: 2019/01/31 01:40 by pixycam