This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:v2:lego_chase_demo [2019/01/30 21:05] pixycam |
wiki:v2:lego_chase_demo [2019/01/30 23:28] (current) pixycam |
||
---|---|---|---|
Line 47: | Line 47: | ||
- | ===== Load Chase example ===== | + | ===== Load Chase Example ===== |
- Turn on your LEGO brick if you haven't done so, and hook up a USB cable between your computer and your LEGO brick. | - Turn on your LEGO brick if you haven't done so, and hook up a USB cable between your computer and your LEGO brick. | ||
Line 53: | Line 53: | ||
{{wiki:img:3e3b64f2ff052ac58280fa2315eff9d803714e6e.png}}\\ | {{wiki:img:3e3b64f2ff052ac58280fa2315eff9d803714e6e.png}}\\ | ||
- | - Browse to the location where you unzipped the "LEGO blocks and examples" file (which you can download [[https://pixycam.com/downloads-pixy2/|on this page]]), and then to the **examples** directory and select "ccc\_chase.ev3" and click on **Open**. | + | - Browse to the location where you unzipped the "LEGO blocks and examples" file (which you can download [[https://pixycam.com/downloads-pixy2/|on this page]]), and then to the **examples** directory and select "ccc\_chase.ev3" and click on **Open**. You should see a program that looks like this (below).\\ |
- | - Click on the "track" tab. You should see a program that looks like this (below).\\ | + | |
{{wiki:v1:image_735.png}}\\ | {{wiki:v1:image_735.png}}\\ | ||
Line 75: | Line 74: | ||
- Check to make sure that Pixy2 can track your object reliably. Bring up PixyMon to verify. If it doesn't track the object reliably, [[wiki:v2:some_tips_on_generating_color_signatures_2|this page]] has some helpful pointers. | - Check to make sure that Pixy2 can track your object reliably. Bring up PixyMon to verify. If it doesn't track the object reliably, [[wiki:v2:some_tips_on_generating_color_signatures_2|this page]] has some helpful pointers. | ||
- If your robot turns away from your object, make sure that the motor cables aren't crossed. That is, if you are facing the motor ports (the back of the robot), the left motor connects to port B, the right motor connects to port A. | - If your robot turns away from your object, make sure that the motor cables aren't crossed. That is, if you are facing the motor ports (the back of the robot), the left motor connects to port B, the right motor connects to port A. | ||
- | - If your robot gets too close to your object when it's chasing it, tilt Pixy2 such that it is looking more level. Alternatively, if your robot isn't getting close enough to your object while it's chasing it, tilt Pixy2 more down. | + | - If your robot gets too close to your object when it's chasing it, tilt Pixy2 such that it is looking more level. Alternatively, if your robot isn't getting close enough to your object while it's chasing it, tilt Pixy2 more down. |
+ | - Sometimes it's easier to debug things with the robot "up on blocks" such that it can't move, but its wheels are free to rotate. | ||
Line 131: | Line 131: | ||
translation = left_motor + right_motor | translation = left_motor + right_motor | ||
</code> | </code> | ||
- | If you've ever driven a tank, these equations probably make sense. But we're interested in the "inverted" equations. We want expressions for the left_wheel and the right_wheel in terms of rotation and translation. That is, we already know how we want our robot to rotate and translate -- these are the outputs of our PID controllers. So rotation and translation are our **knowns**. Our **unknowns** are left_wheel and right_wheel. Using some algebra, we get the inverted equations. | + | If you've ever driven a tank, these equations probably make sense. But we're interested in the "inverted" equations. We want expressions for the left\_wheel and the right\_wheel in terms of rotation and translation. That is, we already know how we want our robot to rotate and translate -- these are the outputs of our PID controllers. So rotation and translation are our **knowns**. Our **unknowns** are left\_wheel and right\_wheel. Using some algebra, we get the inverted equations. |
<code> | <code> |