Sumobot Info Request...

14 views
Skip to first unread message

Everseeker

unread,
Jan 4, 2017, 1:56:58 PM1/4/17
to LVL1 - Louisville's Hackerspace

Greetings all,

I am currently getting involved in a sumo event at work.

I am OK with designing a bot… But I have always had issues with the software.

So, open ask here… could any of you who has a script, send it to me?

If they’re not made for the Arduino, that’s fine. I am mostly interested in overall sensor/motor/time management

If sending something “in the clear” is an issue, feel free to send to Everseeker@ Gmail. Com

(And I promise NOT to use your code against you at a future event J)

Brian Wagner

unread,
Jan 4, 2017, 2:19:06 PM1/4/17
to LVL1 - Louisville's MakerSpace
Here is some code.  Basically in an infinite loop, check your line sensors first and if the robot is driving out of the ring then back up and turn.  Then check your ultrasonics and if it sees another robot then chase otherwise just drive around.  The sumo ring is at the space so use it to test.

Brian



//************************************************************************************************
//
// GREEN - SUMOBOT FIGHT!!!
//
//************************************************************************************************
void Green() {
  Serial.println("Green");
  int LineThreshold = 750;
  int backspeed = SUPER_SLOW;
  int tmpspeed;
  unsigned int uS_R;
  unsigned int uS_L;
  int PingThreshold = 1200;
  
  ////QTRSensorsRC qtrrc((unsigned char[]) {LINE_SENSOR_LEFT, LINE_SENSOR_RIGHT},  2, 2048, QTR_NO_EMITTER_PIN); 
  unsigned int sensorValues[2];  //variable for line sensors
  //MB.setTrim(10);

  MB.sumoCountdown(5);
  
  while(true){
    
    //check the line sensors
     qtrrc.read(sensorValues);
     if (sensorValues[1]<LineThreshold) {
        MB.setRGB(255, 0, 0);
        MB.reverse(FAST);
        delay(500);
        MB.MotorRun(3,backspeed, true);
        MB.MotorRun(2,backspeed, false);
        delay(750);
        MB.setRGB(0, 0, 0);
        delay(50);
     }    
     else if (sensorValues[0]<LineThreshold) {
        MB.setRGB(0, 255, 0);
        MB.reverse(FAST);
        delay(500);
        MB.MotorRun(3,backspeed, false);
        MB.MotorRun(2,backspeed, true);
        delay(750);
        MB.setRGB(0, 0, 0);
        delay(50); 
     }
    
     uS_R = MB.usPing_R(); // Send ping, get ping time in microseconds (uS).
     uS_L = MB.usPing_L(); // Send ping, get ping time in microseconds (uS).
     
     
     if (uS_R < PingThreshold && uS_R != 0) {
        MB.MotorRun(3,200, true);
        MB.MotorRun(2,0, true);
        delay(50);
     }    
     else if (uS_L < PingThreshold && uS_L != 0) {
        MB.MotorRun(3,0, true);
        MB.MotorRun(2,200, true);
        delay(50);
     }
     else {
       MB.forward(255);
     }
     

    
  }
};

--
You received this message because you are subscribed to the Google Groups "LVL1 - Louisville's Hackerspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lvl1+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Greg Miller

unread,
Jan 4, 2017, 7:00:45 PM1/4/17
to lv...@googlegroups.com
Pololu has their example sketch available on Github:
https://www.pololu.com/docs/0J57/6

In the Halloween Sumo Bot challenge both the first and second place winners were just the stock BorderDetect script with the only modifications being the constants defined at the top:
https://github.com/pololu/zumo-shield/blob/master/ZumoExamples/examples/BorderDetect/BorderDetect.ino
--
You received this message because you are subscribed to the Google Groups "LVL1 - Louisville's Hackerspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lvl1+uns...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages