The ActivityBot 360° can also be programmed to track a color signature on both the X and Y axis. This sample code allows the ActivityBot to center the object in the middle of the Pixy2 camera by driving left, right, forward and backward as shown in the video.
- Just download the new example code and give it a try!
Download Pixy2_X-Y_Axis_Roaming.svg
The Pixy2_X-Y_Axis_Roaming.svg project is a modified version of the original Pixy2_Terminal_Display.svg. The following changes were made:
- Added an IF-DO statement in the navigate_by_signatures function to do the following:
- Check for presence of color signature 1
- Calculate a left and right wheel speed based on the position of the X and Y position of detected color signatures
- Left and right wheel speeds account for changes in bXpos and bYpos
- Added an additional function call to display the servo speeds on Terminal
- Disabled all terminal blocks in the main program loop in order to increase the sampling/motor drive frequency