RoboSumo Tournament semester 2 2018-2019 – 2pm Wed 1/5/2019

This semester’s RoboSumo tournament
takes place at 2pm,
Wednesday 1st May 2019
in room KEG-036, DIT Kevin St

Click here for Live Tournament ranking
(Note: All rankings are provisional and subject to change)

Please review the following information carefully from start to finish.

Tournament time and location

The tournament will commence at 2pm on Wednesday 1st may 2019 in room KEG-036, which is located in one of the smaller side corridors on the ground floor of the main building in DIT Kevin St. Weigh-in and robot validation will take place from 14:00-14:45. The first bouts will commence at approximately 14:45. During the initial “sorting” phase of the tournament, competitors will be divided into two pools, each of which will be assigned to one of the two competition arenas. Within each pool, sorting will proceed based on the bubble sort process previously described in class. The initial ranking will be determined by the results of the Tip the Can competition.

The exact duration of the tournament will depend on how quickly things progress, but we aim to be completely finished by 5pm. To ensure that the tournament proceeds efficiently, teams must comply with the instructions of the referee(s) without dispute at all times.

Robot Weigh-in – 2:00pm in KEG-036

Before your robot can compete in any sumo bouts, it must weigh-in and be measured to ensure compliance with the competition rules.

  • The weight limit is 500 grams, as measured using the electronic scales in room KEG-036. This includes every part of the competing robot, including batteries.
  • The size limit is 10 cm x 10 cm x 10 cm (no part of the robot is allowed to be outside this boundary). The size limit will be strictly applied.

Teams should present their robots for the weigh-in at 2:00pm in room KEG-036. One of the tutors will act as compliance officer, managing the weigh-in. He/she will run through a checklist with each team.

Sumo Bouts – 2:45pm in KEG-036

From 2:45pm onwards, teams should be continuously present in room KEG-036 and ready to compete immediately whenever summoned to one of the arenas. When a referee summons two robots to the arena for a bout, if one robot is ready to compete but the other is not (e.g. the team fails to present themselves at the arena, or the robot is non-compliant, or the robot is non-functioning) the first robot will be granted a walkover victory in that bout. In that case, however, the losing team remains eligible to compete in subsequent bouts (until they are eliminated from the tournament).

Submitting Your Robot for Formal Assessment – KEG-036

Once your team is eliminated from the competition (or has won!), you must submit your robot for assessment. This is critically important for your final grade. The compliance officer (or another tutor) will be managing the submission of robots and will run through the following checklist with each team:

  1. Have you submitted your robot? A clear label showing the robot’s name should be securely attached. Suitable labels will be available in KEG-036.
  2. Optional: have you attached a 1-page feature guide to your robot? This sheet can be used to highlighting interesting design features that might not be immediately obvious to the assessment panel during the design assessment. There is no special format for this page – if you’re including one, just make it clear, fold it up, and attach it securely to your robot.
  3. Have you provided a completed robot information sheet? This sheet includes: team/robot name, team number, tutor name, programme code, name of every team member, blog address of every team member. Blank paper copies of the robot information sheet will be available in KEG-036.

Please do not leave without submitting your robot. Doing so may have a catastrophic effect on your grade.

DIT tournament rules

The RoboSumo tournament rules are those of the Robot Challenge “Mini” class, mostly as described in the Robot Challenge rules PDF document. However, those rules make provision for tournament organisers to introduce local rule changes as appropriate. The following rule variations apply in the DIT RoboSumo tournament:

The beginning of each bout:

  1. Infrared starting devices are not required (and generally are not used). Instead, each team nominates a single team member as the designated starter for each bout. The designated starter manually starts the robot at beginning of each bout, as instructed by the referee. The specific method of starting the robot is left up to each team – flicking a switch, pressing a button, inserting a wire, inserting a battery, etc. – but whatever method is used, the robot must remain stationary until it is started.
  2. The referee positions both robots before the bout begins (or instraucts the competitors where to position them). Ordinarily, the referee will place the robots on opposite quadrants of the arena, each facing along a line parallel to that of the other robot, but not in the direction of the opponent. However, the starting position and orientation of each robot within the arena is entirely at the discretion of the referee.
  3. Once the referee has positioned the robots, each robot must remain stationary until the referee says “Go”.
  4. When the referee says “Go” each team’s designated starter starts his/her robot.
  5. The designated starter is only allowed to start the robot – he/she may not change the position or orientation of the robot in the arena.
  6. Once the robot begins moving, the designated starter may not touch the robot again until the bout has ended. He/she must withdraw from the arena and have no further contact with the robot until the bout ends.
  7. The designated starter may not touch his/her robot after it has begun moving (or has moved from its initial position).
  8. The designated starter may not touch his/her robot after the opponent robot has made physical contact with it.
  9. The designated starter may not touch the opponent robot at any time.

The end of each bout:

  1. The duration of each bout is limited to 30 seconds.
  2. If both robots remain in the arena when the time limit for the bout expires, the referee will decide the winner based on each robot’s distance from the centre of the table (the closer the better), robot activity/behaviour during the bout, attitude/behaviour of each team during the bout, and/or other criteria at his/her own discretion. The referee may explain the criteria upon which the winner of a bout was chosen, but is not required to do so.

Other rules:

  1. When a bout fails to produce a clear winner, the referee may, at his/her own discretion, order the bout to be replayed.
  2. During the sorting phase of the competition, matches will consist of a single bout. However, in the latter (knockout) stages of the competition the number of bouts in each match increases (best of 3 or best of 5).
  3. The dimensions of each arena will be similar to those described in the Robot Challenge rules (77cm diameter with a 2.5cm white border), but may deviate slightly from them. However, the white border will not be less than 2.5cm in width.
  4. A robot which displays no responsiveness to its opponent or its surroundings for a significant period of time may, at the referee’s discretion, be disqualified from a bout. In particular, please note that robots which simply spin on the spot will be viewed very unfavourably by the referees unless they exhibit other behaviour which provides evidence that the spinning forms part of a meaningful control strategy.
  5. Each team’s robot spending limit is €70. This figure must include the cost of all components included in the final robot, as it is presented for the tournament validation process, with the following specific exceptions. The €70 budget does not include the cost of components or materials purchased but not used in the final robot. It does not include any cost incurred for postage and packing. Most recycled materials which are obtained free of charge do not need to be accounted for in the robot budget, but specialised components which would not be available to other teams through normal scavenging (e.g. remote control servos) may need to be represented by an indicative cost. In general, the referees do not systematically verify the cost of every robot, but where a specific dispute arises or it is suspected that a robot may be in breach of this rule, a team may be asked to provide evidence of their total spending (e.g. by providing receipts or showing where each component used can be purchased for the claimed price). Where a team is suspected to be in breach of this rule and cannot prove otherwise, the referees may apply a penalty of some kind or even disqualify a robot from the tournament.

Important note: Every effort has been made to compose the rules of each bout and the structure of the tournament as a whole in a way that is fair and consistent, but since it is impossible to anticipate every eventuality, the referee(s) must have ultimate discretion to overrule any regulation or introduce a rule change at any time.

Tournament structure

The tournament is divided into two main phases – a sorting phase and a knockout phase. Each team must also complete a validation process prior to competing in their first match.

Validation process

The validation process ensures that each robot complies with the restrictions on size and mass imposed by the Mini class rules. Teams who do not successfully complete the validation process are not eligible to compete in competitive bouts and can therefore only move down in the tournament ranking. Teams who are unable to field a compliant robot may still be asked to compete in one or more exhibition bouts for assessment purposes, but they cannot progress to the knockout phase of the tournament.

  • The mass of the robot, including batteries and all parts which will be attached to the robot during a bout, must not exceed 500 grams.
  • The size of the robot must not exceed 10 cm by 10 cm by 10 cm. Note that robots are permitted to expand beyond their 10cm by 10cm footprint after the start of a bout, as described in the Robot Challenge rules.
  • All ground contact points that bear the weight of the main body of the robot must fit within the 10 cm x 10 cm footprint throughout the entire bout. It is permissible for parts of the robot to touch the ground outside the 10 cm x 10 cm footprint once the bout is underway, but the weight of the main body of the robot must not rest on them.

Following validation (the “weigh-in”), if a team makes any change to their robot which increases its size or mass, they must repeat the validation process prior to competing in a match.

Sorting phase

The initial ranking will be determined primarily by the results of the Tip the Can challenge. The objective of the sorting phase is to select the top 8 teams. A variation on the so-called bubble sort will be used for the majority of the sorting phase. However, the referee(s) may deviate from this pattern at his/her/their own discretion to resolve any unforeseen ranking issues or anomalies.

In each of the two pools (odd and even), the sorting phase will continue until the referee is satisfied that he/she has identified which 4 teams should progress from that pool to the knockout phase of the tournament.

Knockout phase

The 8 (or 16 depending on the total number of competitors) top-ranked teams will proceed to the knockout phase of the tournament. When a team loses a match in this phase, they are eliminated from the tournament. The referees will decide the number of bouts per match in each stage of the knockout phase (ordinarily best of 3 bouts, apart from the final which is best of 5 bouts).

Laboratory access during the tournament

  • There will be no RoboSumo lecture from 2-3pm on the day of the tournament. Instead, teams will proceed directly to KEG-036 at 2pm for the tournament weigh-in.
  • Access to laboratories other than KEG-036 before 3pm on the day of the tournament will be subject to the limitations of the timetable for each laboratory (other classes may be timetabled in some rooms before 3pm).
  • Room KEG-036 will be open from 2pm onwards. However, space may be limited due to re-organisation of tables for the tournament.
  • The normal lab facilities will be available from 3pm onwards, to facilitate teams who wish to carry out repairs or adjustments to their robots. However, bear in mind that if the referee summons you to a match and you are not present, your opponent will be granted a walkover victory. The live ranking spreadsheet can provide a guide to when each team is likely to be called to compete.

Competitor check list

Inevitably, many teams will face technical issues on the day of the tournament, and it’s impossible to foresee every problem. However, there are certain issues which we see every year:

  1. PLEASE PLEASE PLEASE ensure that your robot is compliant with the size and weight limits. Yes, 101mm is too much! And yes, 501 grams is too much! To avoid unexpected problems, please leave some margin for error. We need to be absolutely strict about these limits and butchering your carefully crafted robot at the last minute to reduce its size or weight can be a heartbreaking experience.
  2. If you haven’t already tested your robot actually driving around, please do so BEFORE the tournament. Bizarrely, every year we see teams who leave it until the very last minute to attach the wheels to their motors for the first time. Unfortunately, many of them discover at that point that their gearing is totally inappropriate and the robot cannot actually move.
  3. Focus on the basics. This means getting your robot moving around and responding to its sensor(s).
  4. Make sure your robot doesn’t simply spin around the spot for the entire bout. This behaviour will be viewed very unfavourably by the referee.
  5. Make sure you bring spare batteries.

Finally, remember to get plenty of photos and videos of your robot (and team) in the run up to and during the tournament. Of all the evidence you will provide on your blog, photos and videos are some of the easiest to create, and they can really help to tell the story of your project.

Finally, best of luck to all of you!

Advertisements
Posted in Uncategorized | Leave a comment

Adding C/C++ code to a WordPress post

Adding code neatly to a post on your WordPress blog is easy when you know how. However, if you don’t know what you’re doing then WordPress makes it really easy to turn your code into a complete mess.

Most of the confusion stems from the different ways you can edit a post in WordPress. Over the last few years, WordPress has introduced newer versions of the editor that you use to write your posts. However, when I’m posting code I always always always use the Text view in the classic WordPress editor. Here, I’m going to show you how to

  1. Open your post in the classic editor.
  2. Display your post using the classic editor’s Text view.

Begin by navigating to the Dashboard of your blog. The Dashboard URL is the domain name of your blog followed by “/wp-admin“. For example, my Dashboard is located at

https://robosumo.wordpress.com/wp-admin

You need to replace “robosumo.wordpress.com” with the address of your blog. If you’re not already logged in then you’ll be prompted to enter your username and password.

If your post doesn’t already exist, you can create it from the Dashboard and open it for editing in the classic editor by clicking on “Add New” in the “Posts” sub-menu in the side bar on the left side of the Dashboard, as shown below:

If you want to add code to a post that already exists, click on “Posts” on the sidebar at the left side of the dashboard to list your existing posts. Locate the post you want to edit and click on the “edit” link that appears when you hover over it, as shown below:

Before you insert your code into the post, make sure you’re in “Text” view by clicking the tab at the top right corner of the edit box, as shown below:

The code itself can be copied and pasted in directly from the Arduino development environment (or wherever you’re editing your text), but it should be wrapped in a pair of “code” shortcodes:

[code language="cpp"]

*** PASTE YOUR CODE IN HERE ***

[/code]

Before copying and pasting your code from the Arduino editor, make sure it’s neat and tidy. In particular,

  • Include your name in a comment at the top.
  • Include a short description of the program in a comment at the top.
  • Include the date it was last updated in a comment at the top.
  • All comments throughout the program should be clear and accurate.
  • The indentation should be perfect.
  • The variable names should be self-explanatory.

If you’ve inserted the code correctly, it should appear similar to the following (this is the same example code as shown in the editor screenshot above):

//
// RoboSumo code example: Flash an LED
// Written by Ted Burke, 18-4-2019
//
 
void setup()
{
  pinMode(2, OUTPUT); // LED pin
}
 
void loop()
{
  digitalWrite(2, HIGH); // LED on
  delay(250);
  digitalWrite(2, LOW);  // LED off
  delay(250);
}
Posted in Uncategorized | Leave a comment

Content from Paul’s lecture – circuit, code, robot compliance

Posted in Uncategorized | Leave a comment

State Machine example from today’s lecture

Please note that this is not a complete program – you need to add code that is specific to your robot!

//
// State machine example
// Written by Ted Burke
// Last updated 27-3-2019
//

// State variables
int state = 0;
unsigned long start_time_of_current_state;

void setup()
{
    //
    // Configure pins for motors, etc.
    //
    // YOU PUT CODE HERE!!!
    //
    
    // Select initial state
    state = 0;
    
    // Initialise state timer
    start_time_of_current_state = millis(); 
}

void loop()
{
    // Variables for sensor readings and state timer
    float distance;
    int button;
    unsigned long ms_in_current_state;
    
    // Read sensors
    distance = get_distance(); // assuming get_distance function is implemented below
    button = digitalRead(3);   // assuming switch is connected to D3
    
    // Update state timer
    ms_in_current_state = millis() - start_time_of_current_state; // update time in current state
    
    // Implement current state
    if (state == 0) // State 0: wait for start button
    {
        // Set motors
        set_motors(0, 0);
        
        // State transitions
        if (button == 1) change_state(1);
    }
    else if (state == 1) // state 1: spin and search
    {
        // Set motors
        set_motors(1, -1);
        
        // State transitions
        if (distance < 1.0) change_state(2);
    }
    else if (state == 2) // state 2: forward to can
    {
        // Set motors
        set_motors(1, 1);
        
        // State transitions
        if (button == 1) change_state(3);
        if (distance > 1.0) change_state(1);
    }
    else if (state == 3) // state 3: reverse away from can
    {
        // Set motors
        set_motors(-1, -1);
        
        // State transitions
        if (ms_in_current_state > 1000) change_state(4);
    }
    else if (state == 4) // state 4: stop forever
    {
        // Set motors
        set_motors(0, 0);
    }
}

void change_state(int state_number)
{
    state = state_number;
    start_time_of_current_state = millis();
}

void set_motors(int left, int right)
{
    // Control left motor direction
    if (left < 0)
    {
        // set pins to drive left motor in reverse
    }
    else if (left > 0)
    {
        // set pins to drive left motor forward
    }
    else
    {
        // set pins stop the left motor
    }

    // Control right motor direction
    if (right < 0)
    {
        // set pins to drive left motor in reverse
    }
    else if (right > 0)
    {
        // set pins to drive left motor forward
    }
    else
    {
        // set pins stop the left motor
    }
}

float get_distance()
{
  float d;
  
  //
  // PUT CODE HERE TO MEASURE DISTANCE IN METRES
  //

  return d;
}
Posted in Uncategorized | Leave a comment

Tip the Can – Live Results spreadsheet – Sem 2 2018-2019

Click here for live Results spreadsheet

Posted in Uncategorized | Leave a comment

Example code from today’s class

Here’s my program:

//
// Arduino code examples
// Written by Ted Burke
// Last updated 27-2-2019
//

void setup()
{
  pinMode(7, OUTPUT); // loudspeaker output
  
  pinMode(4, OUTPUT); // LED 1
  pinMode(5, OUTPUT); // LED 2

  Serial.begin(9600);
}

void loop()
{
  int n;

  n = 3;

  if (n > 5)
  {
    Serial.println("Big number!");
  }
  else
  {
    Serial.println("Small number.");
  }

  while (n > 0)
  {
    digitalWrite(4, HIGH);
    delay(100);
    digitalWrite(4, LOW);
    delay(100);

    n = n - 1;

    Serial.println(n);
  }

  delay(2000);
}

That was my program.

Posted in Uncategorized | Leave a comment

Arduino code examples from today’s lecture

This is the demonstration circuit I made for today’s lecture. The code examples below are running on an Arduino with these peripheral components connected.

Serial printing example:

//
// Arduino code examples
// Written by Ted Burke
// Last updated 20-2-2019
//

void setup()
{
  // LED on pin D4
  pinMode(4, OUTPUT);

  // Open a serial connection to the PC at 9600 bits per second
  Serial.begin(9600);
}

void loop()
{
  int du;  // stores analog input value in digital units

  // du will range from 0du (0V) up to 1023du (5V)
  du = analogRead(6); // Read the voltage from pin A6

  // Print the measured value in du over the serial link
  Serial.print("0 1200 "); // sets axis limits
  Serial.println(du);      // measured signal value
    
  delay(100);
}

Print analog input voltage in volts:

//
// Print analog input voltage in volts
// Written by Ted Burke
// Last updated 20-2-2019
//

void setup()
{
  // Open a serial connection to the PC at 9600 bits per second
  Serial.begin(9600);
}

void loop()
{
  int du;  // stores analog input value in digital units
  float v; // output voltage of the TCRT5000 sensor

  // du will range from 0du (0V) up to 1023du (5V)
  du = analogRead(6); // Read the voltage from pin A6

  // Convert from du to volts
  v = 5.0 * (du/1023.0);

  Serial.print(du);
  Serial.print("du ");
  Serial.print(v);
  Serial.println("V");
    
  delay(100);
}

Musical note example:

//
// Musical note example
// Written by Ted Burke
// Last updated 20-2-2019
//

void setup()
{
  pinMode(7, OUTPUT); // loudspeaker is connected to D7
}

void loop()
{
  musical_note(5000, 250); // waveform period 5000us, duration 250ms 
  musical_note(4000, 250); // waveform period 4000us, duration 250ms
  musical_note(3333, 250); // waveform period 3333us, duration 250ms
  delay(250);              // silence for 250ms
}

// This function plays a musical note.
// The period in us and duration in ms are specified as arguments.  
void musical_note(int period, int duration)
{
  unsigned long end_time;

  // Calculate what time the note should end
  end_time = micros() + 1000L*duration;

  // Generate a square wave with the specified period
  // until the end time arrives
  while(micros() < end_time)
  {
    // Alternated between high and low on pin D7
    digitalWrite(7, (micros()%period > period/2));
  }

  // Switch loudspeaker pin low when finished
  digitalWrite(7, LOW);
}

Theremin example:

//
// Musical note example
// Written by Ted Burke
// Last updated 20-2-2019
//

void setup()
{
  pinMode(7, OUTPUT); // loudspeaker is connected to D7

  pinMode(2, OUTPUT); // trigger
  pinMode(3, INPUT);  // echo

  Serial.begin(9600);
}

void loop()
{
  float d;

  d = get_distance();
  Serial.println(d);
  musical_note(10000*d, 100); 
}

float get_distance()
{
  unsigned long us;
  float distance;
  
  digitalWrite(2, HIGH);
  delayMicroseconds(20);
  digitalWrite(2, LOW);

  us = pulseIn(3, HIGH, 10000);

  distance = 170e-6 * us;

  delay(100);
  
  return distance;
}

// This function plays a musical note.
// The period in us and duration in ms are specified as arguments.  
void musical_note(int period, int duration)
{
  unsigned long end_time;

  // Calculate what time the note should end
  end_time = micros() + 1000L*duration;

  // Generate a square wave with the specified period
  // until the end time arrives
  while(micros() < end_time)
  {
    // Alternated between high and low on pin D7
    digitalWrite(7, (micros()%period > period/2));
  }

  // Switch loudspeaker pin low when finished
  digitalWrite(7, LOW);
}
Posted in Uncategorized | Leave a comment