Robo Sumo: Intelligent Robot Fights


( c )

Each year, about a thousand teams from all over Japan engage in a fierce battle in a robot tournament. In this contest you will not see chainsaws, torches and electric discharges - in short, nothing that comes to mind when you hear the phrase “battle of robots”.

It’s not just about the battle - it’s a robotic sumo that is valued for its special qualities: for elegance, simplicity and the ability to show intelligence in strategy. The competition takes place in a round metal ring with a diameter of only 1.5 m, along the perimeter of which a white line 5 cm wide is drawn. A robot crossing this border is considered to be a loser. And in this apparent simplicity lies an abyss of opportunity.

We will tell you how the “battle of robots” has become an intellectual competition for programmers, and give detailed instructions for assembling a robo-sumoist.

Border and enemy search sensors



( c ) The

eyes of the robot are infrared sensors. The degree of IR reflection is measured by a photosensitive element. The white color of the border was not chosen by chance - it reflects more light than the black surface of the ring.

The robot is equipped with several infrared sensors responsible for the "search" of the border. Front sensors, as a rule, help to control the speed of movement - the fighter should not leave the field due to excessive zeal. The rear sensors “follow” the approach to the border of the ring: having received a response from them, the robot changes direction.

And by measuring the time required to reflect the rays, you can understand the location of the enemy. Many robots (but not all) change direction, given this parameter.

Battle rules



In addition to the listed advantages, IR sensors have a drawback - the field of view remains narrow, due to which there are many blind spots, the use of which in attack is the main strategy of highly maneuverable robots.

However, this only works with autonomous robots. When an independent robotic sumoist encounters a radio-controlled opponent, he cannot use the blind zone attack strategy, since the operator sees more than the robot.

Instead of attacking blind spots, the Autobots use an attack strategy from the corners. In general, the wrestler does not have many maneuvers available: turning, pushing, braking and stopping.

However, to confuse the enemy, some fighters throw white flags on one or both sides of the hull. Luring the enemy to the flag, they attack its vulnerable side and push it out of the ring.

Of course, ways to defend against such an attack appeared. The appearance of flags on the left and right means that the robot body is in the center. If the robot threw the flag on one side, then its body is in the opposite place.

Some bots can not only lure the enemy, but also hide from his sensors. To do this, they are painted black or reflective coatings are added.

Armament



The battle of Sumoist robots is not just a butt. Many of them are equipped with a sharp edged bulldozer blade. It allows you to raise your opponent and move him off the court or even cause serious damage. True, this weapon reduces the maneuverability of the fighter.

In a human sumo, the fighter’s main weapon is his impressive mass. Oddly enough, in robots, mass also plays a "significant role".

Despite the fact that, according to the rules, the length of the robot (on either side) does not exceed 20 cm, and the weight should be no more than 3 kg, the robo-sumoist can "weigh" several tens of kilograms. This "weight" is achieved through magnets. Yes, sometimes the technique can practically “stick” to the floor, since the ring is based on a metal surface.

Machine mind


When creating robots, the main tactic of which is high maneuverability, fewer magnets are used. The main emphasis in this case is placed on a powerful motor. However, victory in battle rarely depends only on iron.

The main thing for sumo robots is the strategy, written in the form of code. The choice of iron also depends on it. Often robots move so fast that it is difficult to keep track of their movements. However, super-maneuverable behavior is based on strict program logic. Consider the principles by which it is created.

Sumo Robot Creation



Let us turn to the experience of experts from the site hackster.io , who prepared an exhaustive guide on the creation of a typical robot-sumoist.

The following components are used in the project:

  • CytronTechnologies × 1 controller ;
  • infrared sensor (3-80 cm) × 5;
  • set of silicone wheels JSumo (52 x 30 mm) × 2;
  • infrared tracking module × 2;
  • DC gear motor (12 V, 380 rpm) × 4;
  • LiPo battery (11.1 V, 1300 mAh) × 1.


1. Controller


You can use Arduino Uno, Mega or Nano. You will also need a board to connect all sensors. You can, of course, create your own expansion card and connect all the contacts to the Arduino, or buy a ready-made card and connect all the electronic components.


2. The engine


This is one of the most important parts on which the performance of the robot depends. Ideally, you need an engine with high speed and torque, but in this case its size will be large. You should make sure that all engines and wheels fit in a 20 x 20 cm box.

There are several types of engines that you can use in your project.

An engine with a cylindrical gear and planetary gear , in which the output shaft is parallel to the engine.


Worm gear motor . The output shaft here is perpendicular. This option may be preferable, since there will be more space in the robot for other components.


Two-wheel vs Four-Wheel


A four-wheel drive will definitely give more opportunities to push an opponent robot. However, its mobility is lower than that of a two-wheeled one. Still, all-wheel drive was used in this demo project.

3. Wheels



There are not many options for good rubber for a sumo robot on the market. Engineers opted for silicone wheels manufactured by Jsumo. However, you can use wheels from a toy car.

Pay attention to the mounting - make sure that the selected wheel matches the size of the hole corresponding to the output shaft of the engine. This project uses a 6 mm shaft, respectively, the wheel has a 6 mm hole.

4. Sensors



To detect objects, you can use both infrared sensors, and, for example, ultrasonic.

Experts recommend starting an attack when the distance to the enemy is not more than 60 cm. Thus, it is possible to place a sensor with a sensitivity range of up to 1 m.


For this robot, three infrared sensors were installed - one per side.


An infrared sensor should also be installed at the bottom of the robot, which will help to detect a white line at the edge of the ring. You can install several sets of edge sensors in the front and rear, depending on your driving strategy.

5. Battery



A lithium polymer battery is usually used as it provides more power than other types of batteries with the same size.

6. The chassis of the robot


You can use the ready-made base from Cytron, which fits the allowed size of the robot (20 x 20 cm), or make it from scratch yourself.


Since 3D printing is more economical, the diver has shared files for home printing.


7. Assembly


The diagram and table below provide an overview of the wired connections for the Sumo robot.



First you need to solder two wires (the recommended size is 16-18 AWG) to the motor terminal, then connect it to the controller.


Further, all motors and sensors need to be soldered with wires.


Now we turn to the assembly inside the case. Use the M3x10 bolts to mount the motors on the lower housing.


Install infrared sensors on the right and left side.


Fasten the wheel rim with the M4 screw, then put on the silicone tape.

The set screw must be secured to the flat part of the round motor shaft.


Then, using a self-tapping screw, install the edge sensor at the bottom of the blade.


In the front part of the lower casing, you will see two holes intended for laying the wires of the edge sensors.


Assemble the blade with the lower casing using the M6x20 bolts and nuts.


Install infrared sensors on the front holder before attaching it to the lower case.


After mounting all sensors and motors, we recommend marking each wire so that it is easier to troubleshoot in the future.


Fix the support support for the circuit board.


Check the polarity of the battery and sensors before connecting to the board, and then remember to remove the battery before proceeding to connect other components to the board.


Since this is an all-wheel drive robot, two engines on one side must be connected to control them simultaneously.


When using a ready-made code example , it is better to connect all engines and sensors to the same ports, which are shown in the illustrations.


Finally, connect the battery.


Sumo robot is ready!

8. Sensor calibration


An important step is calibration before programming. Unfortunately, most newcomers do not pay due attention to this when setting up the robot.

Make sure that the sensors are operating within the required sensitivity range.

The maximum sensitivity range of the enemy search sensor is 80 cm. In this project, the robot should not respond to an object located at a distance of 60-80 cm, therefore the sensitivity range is reduced by 20 cm.


To do this, put the robot “facing” to a flat white surface at a distance of 60 cm and adjust the sensor until the LED indicator goes out. The procedure is shown in more detail in the video.


The edge sensors are adjusted using a screwdriver through the hole in the blade.

Using software, you can display the signals of two edge sensors on the LEDs D0 and D1.


This is necessary in order to make sure that the sensor gives a high output signal when it senses a white surface, and a low one on a black surface (pay attention to the LEDs on D0 and D1 in the video above).

9. Programming


Since the URC10 robot controller is compatible with Arduino UNO, the Arduino IDE is used for programming. You can take a ready-made code example .

The only library used in the project is CytronMotorDrivers .

If you do not know how to enable the library or download sample code, refer to the URC10 manual.

The sumo robot program can basically be divided into four parts:

  • start of performance;
  • Search;
  • attack;
  • retreat.

void loop() {
  //   .
  if (!digitalRead(EDGE_L)) {
    //     .
    backoff(RIGHT);
 
    //   .
    searchDir ^= 1;
  }
 
  //   .
  else if (!digitalRead(EDGE_R)) {
    //     .
    backoff(LEFT);
 
    //   .
    searchDir ^= 1;
  }
 
  //   .
  else {
    //  ,    .
    if ( digitalRead(OPPONENT_FC) &&
         digitalRead(OPPONENT_FL) &&
         digitalRead(OPPONENT_FR) &&
         digitalRead(OPPONENT_L) &&
         digitalRead(OPPONENT_R) ) {
      search();
    }
 
    // ,      .
    else {
      attack();
    }
  }
 
 
  //     .
  if (!digitalRead(BUTTON)) {
    //  .
    motorL.setSpeed(0);
    motorR.setSpeed(0);
 
    // .
    while (1);
  }
}

Start of performance


The start strategy depends on the rules of the competition. A robot can only start moving after 5 seconds, and sometimes in 1 second.

It happens that the rules allow you to place the robot anywhere in the ring. In other cases, the robot must be in a certain “start zone”.

In this example, the robot is programmed to move around and attack the opponent from the side as soon as the game starts.

void startRoutine() {
  // .
  delay(1000);
 
  //    45 .
  motorL.setSpeed(255);
  motorR.setSpeed(0);
  delay(180);
 
  //  .
  motorL.setSpeed(255);
  motorR.setSpeed(255);
  delay(450);
 
  //  ,     .
  motorL.setSpeed(-0);
  motorR.setSpeed(255);
  uint32_t startTimestamp = millis();
  while (digitalRead(OPPONENT_FC)) {
    // ,        .
    if (millis() - startTimestamp > 400) {
      break;
    }
  }
 
}


Search


If immediately after the start it was not possible to attack the enemy, the robot will go around the ring in a circle to find the opponent. Once it is detected, the search mode will be stopped and the robot will proceed to attack.

void search() {
  //   .
  if (searchDir == LEFT) {
    motorL.setSpeed(100);
    motorR.setSpeed(255);
  } else {
    motorL.setSpeed(255);
    motorR.setSpeed(100);
  }
}


Attack


When an enemy is detected by one of five sensors, the robot turns in his direction and attacks at full speed.

The accuracy of the attack depends on how clearly your robot can track the enemy when moving forward at full speed. If the enemy manages to escape, the program will resume work in search mode.

void attack() {
  uint32_t attackTimestamp = millis();
  //    .
  //     .
  if (!digitalRead(OPPONENT_FC)) {
    motorL.setSpeed(255);
    motorR.setSpeed(255);
  }
 
  //   .
  //  .
  else if (!digitalRead(OPPONENT_FL)) {
    motorL.setSpeed(0);
    motorR.setSpeed(255);
  }
 
  //   .
  //  .
  else if (!digitalRead(OPPONENT_FR)) {
    motorL.setSpeed(255);
    motorR.setSpeed(0);
  }
 
  //   .
  //     ,     .
  else if (!digitalRead(OPPONENT_L)) {
    motorL.setSpeed(-150);
    motorR.setSpeed(150);
    while (digitalRead(OPPONENT_FC)) {
      // ,    .
      if (millis() - attackTimestamp > 400) {
        break;
      }
    }
  }
 
  //   .
  //     ,     .
  else if (digitalRead(OPPONENT_R) == 0) {
    motorL.setSpeed(150);
    motorR.setSpeed(-150);
    while (digitalRead(OPPONENT_FC)) {
      // ,    .
      if (millis() - attackTimestamp > 400) {
        break;
      }
    }
  }
}


Retreat


When one of the edge sensors detects a white line, the robot needs to step back and turn around. During rotation, the robot will continue to search for the enemy. If it comes into view, it will be attacked.

void backoff(uint8_t dir) {
  //  .
  motorL.setSpeed(0);
  motorR.setSpeed(0);
  delay(100);
 
  // .
  motorL.setSpeed(-255);
  motorR.setSpeed(-255);
  delay(200);
 
  //  .
  motorL.setSpeed(0);
  motorR.setSpeed(0);
  delay(100);
 
  // .
  if (dir == LEFT) {
    motorL.setSpeed(-150);
    motorR.setSpeed(150);
  } else {
    motorL.setSpeed(150);
    motorR.setSpeed(-150);
  }
  delay(100);
 
  //   
  //  -   .
  uint32_t uTurnTimestamp = millis();
  while (millis() - uTurnTimestamp < 300) {
    //   ,     .
    if ( !digitalRead(OPPONENT_FC) ||
         !digitalRead(OPPONENT_FL) ||
         !digitalRead(OPPONENT_FR) ||
         !digitalRead(OPPONENT_L) ||
         !digitalRead(OPPONENT_R) ) {
      //  .
      motorL.setSpeed(0);
      motorR.setSpeed(0);
      delay(100);
 
      //    .
      return;
    }
  }
 
  //    ,         .
  motorL.setSpeed(255);
  motorR.setSpeed(255);
  delay(200);
}


That's all. Now you can watch a video that demonstrates how the robot moves from this lesson.


Do you already have experience building a robot for similar competitions? Share winning strategies in the comments.

Sources


DIY robot assembly: https://www.hackster.io/cytron-technologies/building-a-sumo-robot-45d703

All-Japan National Sumo Robot Competition: http://www.fsi.co.jp/sumo/en /index.html

Illustrated Ruleset : http://www.robotroom.com/SumoRules.html

All Articles