Mobile Robot Behaviors for Battle Bots

Directions:

For this activity, you will be given a set of robot behaviors for your robot to perform.  Using a basic robot or your battle bot, implement each behavior and demonstrate it.  To assist you, each behavior has a diagram, a description, and pseudo code.  You are encouraged to write your own code and use the code samples for reference.


Behavior #1:  Stop Before Collision

Description:

  • Your robot will travel at some forward velocity, v0
  • If the distance threshold is violated, the robot stops, forward velocity=0

Tips and Tricks:

How could you adapt this behavior to instead have the robot stop whenever it sees a line such as the arena's edge?


Behavior #2:  Single Threshold Attack

Description:

  • Your robot will travel at some forward velocity, v0
  • If the distance threshold, t,  is violated, the robot changes its velocity to attack, v1

Tips and Tricks:

  • Experiment with different thresholds and velocities.  Some robots work better at slower speeds.  
  • You can have a simple evade behavior if you set v1 to a negative velocity.

Behavior #3:  Dual-Threshold Attack

Description:

  • Your robot will wait until something is close.  If the distance sensor reports a distance greater than threshold t0, stop the robot and do nothing.
  • If the distance sensor senses something closer than the far threshold, t0, the robot changes its velocity to v0
  • If the distance sensor senses something closer than the near threshold, t1, the robot changes its velocity to v1

Tips and Tricks:

  • Experiment with different thresholds and velocities.  Some robots work better at slower speeds.  

Behavior #4:  Scan for Opponent

Description:

  • In a loop, your robot will scan by rotating counter clockwise.  This involves setting your left motor to a negative velocity V0 and your right motor to a positive velocity v0.  Your robot will "turn on a dime".
  • When the distance sensor returns a value less than a threshold, t, the loop stops.
  • The robot then sets both motors to a common forward velocity, 0, to stop.  
  • Opponent has been found.  We are facing them. 

Tips and Tricks:

  • Experiment with different thresholds and velocities for attack and turn.  Some robots work better at slower speeds.  

Behavior #5:  Search and Destroy

Description:

  • This is the same as scan for opponent.  However, now the robot will attack by setting its forward velocity for both motors to V1

Tips and Tricks:

  • Experiment with different thresholds and velocities for attack and turn.  Some robots work better at slower speeds.  
  • Think of different behaviors for your robot when attacking.  Maybe a head first charge might not be the smartest solution.   How would you change your code?

Behavior #6:  Evade (sometimes running is the smarter solution)

Description:

  • Using your bump sensor, sense to see if you have been bumped from behind.
  • If your bump sensor is triggered, turn for some random amount of time. 
  • Then, run away.

Look at the sample code below to see how this can be done.

Tips and Tricks:

  • Think about how you can integrate the evade behavior into a battle bot strategy.  You don't always want to run.  
  • Wrap the evade behavior around your normal battle bot behavior.  When it is not bumped from behind, everything runs as normal.  It only changes behavior when bumped.