| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Files spread between Dropbox, Google Drive, Gmail, Slack, and more? Dokkio, a new product from the PBworks team, integrates and organizes them for you. Try it for free today.

View
 

AI NXT Sumobot: Jacob S

Page history last edited by Jacob 4 years, 3 months ago

 

Robot Build

The robot it self is based on the five minute bot (http://nxtprograms.com/five_minute_bot). I have added 4 sensors to it. 3 ultrasonic sensors are mounted on the front and a light sensor is mounted on the back. The light sensor are to track the edge of the arena while the ultrasonic sensors are for tracking movement

Core Mechanics For AI Tracking

The core mechanic for the AI to track its opponent is based on the ultrasonic sensor.  The whole robot will spin in a set direction until one of the 3 ultrasonic sensors detect something. When the main sensor is triggered the robot then moves forward in the direction of the censor.

 

 

This picture shows the main switch that controls searching vs attacking.

 

Things start to get more complicated when we bring in the other two ultrasonic sensors. These sensors are on either side of the robot so it can tell which way the enemy is going.  I will talk about this more when we look at the code.

 

 

This shows how the 3 ultrasonic sensors are mounted.

 

Since the sensors are positioned on either side of the robot we can easily follow the opponent when they withdraw from a attack or attack the robot. This also gives us 200% more area being searched opposed one s

Searching

The searching protocol is based on the same key switch but gets more complicated when we add the other sensors.

Key Switch

 

When we decide if we need to search first we check out behind. The light sensor.

In this picture we are checking behind us with the light sensor and if that's all good we check our ultrasonic sensor. If that sees something we go at it. If it doesn't we spin the robot to "Search' for something.

Things get more complicated when we add the two other ultrasonic sensors

This now shows the complete searching. For now just ignore the orange blocks. This is connected to the light sensor switch and ran only when that is clear.

First we are going to check the the main ultrasonic sensor to see if there's something in front of us. If there isn't anything there we then check the ultrasonic sensor of the area we are turning in. So if the robot is turning clock wise we check the left ultrasonic sensor and if the robot is turning counter clock wise we check the right ultrasonic sensor. This ensures that we are covering the side that is most vulnerable. If vulnerable spot isn't clear we then start turning towards the spot. We will continue this until one of two conditions are met. First the blind spot sensor is no longer triggered or the main sensor has been triggered and we are moving at the enemy. This system allows us to easily follow an opponent once they come within range of us.

 

To make the searching less predictable we randomize how long we search an area.  This is done by putting a counter in our loop and when that counter reaches a certain number(Random Number) we then switch what area we searching. The randomness of this number is dependent on the information learned.(More on that later)

 

 

This shows how we determine how long we search one area.

The robot continues to search one area until the counter has reached a high enough variable.

 

 

This is how we stop searching one area and check the next area. 

Learning Mechanic

Now that we have found the opponent we need to gain an upper hand against the human that is controlling the opponent. The AI program can "Learn" using variables. When the blind spot sensor is triggered we then add a number(50) to our variable. This is basically storing the fact that they prefer to attack that blind spot.  When then use to to determine how long we we search one area.

 

 

This shows how we process the data.

 

First we take our variable (Data learned) and add our minimum value to it. This is then inputted as the minimum value for our random block. The number the block picks determines how long we search an area.

Comments (0)

You don't have permission to comment on this page.