<< return to Pixycam.com

Pixy2 with Zumo sumo code

Hello,

I am trying to modify the zumo chase code that came with my pixy2 to work with my zumo sumo robot. Our competition is very soon and I have yet to figure out how to integrate the line following sensors on the zumo bot with my pixy2. I am trying to get my robot to detct another robot in close proximity and chase him down. Since it is a sumo competition, I am also trying to utilize the line sensor to detect a black line so it keeps from exiting the sumo ring. Any help you can provide will be extremely appreciated!!!

Hi,

Pixy2 has its own line following system, which you can access using the Arduino API or similar. It doesn’t interface with any sensors on the Zumo bot - just sends servo control data to the motors.

Hope this helps!

Jesse

Thank you for your reply, but that only brings up more questions… Is there a way to program the arduino to use both sensors together? I want the pixy to send commands to control the motors and track an object but i also want the line following sensors on the zumo to keep it from leaving the sumo ring. I can get the zumo to do both independently but I have not been successful in combining the two.

There is :slight_smile: You’ll need to integrate reading Pixy (e.g. getBlocks()) with reading your line sensor and then acting (moving motors) accordingly with both sets of sensor values or either sets. Will your robot move based on both sensors simultaneously or will your robot work using a “modal” method – using Pixy2 sensor values to move the robot, followed by using your line sensor to move the robot?

I’m guessing you just want to use the line sensors to make sure you stay in the ring.

Here is some pseudo-code:

while(1)
   line = getLineSensor()
   if (line)
       turn30degrees()  // avoid line
   else
       pixy.getBlocks()
       move_based_on_detected_blocks(pixy.blocks)

Edward

Thank you very much, we will try it tonight!

I think we are making progress, but have come to a roadblock! Can you please look at our code and point us in the right direction? I tried uploading the code here but it said I am unable to have more than 2 links because I am a noob. I have posted the code at this weblink because I cannot figure out how to post it on this forum.
Our code: https://drive.google.com/open?id=1IJznRkiPYHu2mLP4Gc6OhW_sYMNsSnEC

Hello,
We are here to support Pixy products, not so much help with programming (sorry). Perhaps you can find a friend or someone more comfortable with C programming to help?

Edward