<< 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
wiki:v2:lego_line_tracking_test [2019/01/30 01:59]
pixycam
wiki:v2:lego_line_tracking_test [2019/01/31 01:40] (current)
pixycam
Line 1: Line 1:
 ====== Pixy2 LEGO Line Tracking Test ====== ====== Pixy2 LEGO Line Tracking Test ======
  
-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}}\\ + 
-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:​img:​3e3b64f2ff052ac58280fa2315eff9d803714e6e.png}} 
 + 
 + 
 +Browse to the location where you unzipped the "LEGO blocks and examples"​ file, and then to the **examples** directory. Select "​line\_test.ev3"​ and click on **Open**. ​ The program is shown below. ​ 
  
 {{wiki:​v1:​image_725.png}} {{wiki:​v1:​image_725.png}}
  
  
-Run the program by clicking the play icon in the lower right corner of your EV3 software window. If you don't see the play icon, make sure your LEGO brick is powered on, finished booting, and connected to your computer via a USB cable.\\+Run the program by clicking the play icon in the lower right corner of your EV3 software window. If you don't see the play icon, make sure your LEGO brick is powered on, finished booting, and connected to your computer via a USB cable. 
 + 
 {{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 23: Line 32:
 {{wiki:​v1:​image_726.png}} {{wiki:​v1:​image_726.png}}
  
 +
 +===== 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. ​ 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}} {{wiki:​v1:​image_729.png}}
Line 31: Line 43:
 Note, with the lamp on, Pixy2 will typically reduce the exposure (sampling) time of the image, which reduces motion blur.  In general, motion blur happens because a camera is sampling a subject while the subject is moving. ​ In this case, the subject is a line (or set of lines). ​ If they are blurred due to motion (the motion of your robot), it can make the lines more difficult for Pixy2 to detect and track. ​ Pixy2'​s lamp can help with this.  The upshot is that the lamp makes your robot go faster! Note, with the lamp on, Pixy2 will typically reduce the exposure (sampling) time of the image, which reduces motion blur.  In general, motion blur happens because a camera is sampling a subject while the subject is moving. ​ In this case, the subject is a line (or set of lines). ​ If they are blurred due to motion (the motion of your robot), it can make the lines more difficult for Pixy2 to detect and track. ​ Pixy2'​s lamp can help with this.  The upshot is that the lamp makes your robot go faster!
  
 +
 +===== 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. ​   ​ 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 52:
  
  
-You can stop the program and change ​turn angle to -90 degrees.+===== Make a "​Turn"​ at an Intersection ===== 
 + 
 +You can stop the program and change ​Turn Angle to -90 degrees. 
  
 {{wiki:​v1:​image_732.png}} {{wiki:​v1:​image_732.png}}
 +
  
 -90 degrees is a right turn according to the diagram below.  ​ -90 degrees is a right turn according to the diagram below.  ​
Line 54: Line 72:
  
  
- +===== Barcodes ​=====
-==== 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]].) 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]].)
Line 67: Line 84:
  
 If you run the EV3 program, you should see the text "​Barcode:​ n" on the EV3 LCD, where "​n"​ is the barcode'​s number.  ​ If you run the EV3 program, you should see the text "​Barcode:​ n" on the EV3 LCD, where "​n"​ is the barcode'​s number.  ​
 +
 +
 +===== What's Next? =====
 +
 +This is just a test program to help demonstrate Pixy2'​s line following capabilities. ​ From here, you might want to test things on a simple robot with the [[wiki:​v2:​lego_line_following_demo|Line Following Demo]].
  
  
wiki/v2/lego_line_tracking_test.1548813552.txt.gz · Last modified: 2019/01/30 01:59 by pixycam