Examples | Shop
 
Sumo Robot
 
 
This example code is provided as a starting point for programming an autonomous sumo robot.

We've put together a powerful Sumo Robot Kit that includes the following:
• Lynxmotion Terminator (with 12VDC Gear Head Motors)
• Brainstem Moto 1.0 Board
• BrainStem 3-Amp Back-EMF H-Bridge (x2)
• 14.4 / 9.6 V rechargeable battery pack and charger
• Easy connection kit.
Once the Terminator kit has been assembled it’s then just a case of drilling 3 x 3mm holes in the base, to mount the BrainStem Moto board and 2 x 6mm holes in the lid to mount the switches (motors and controller). We’ve put together a connection kit to make it easy to wire up the motors, controller, battery and switches. The rechargeable battery pack sits inside the robot next to the controller. It should take approximately 2/3 hours to build this robot.

To create a fully autonomous sumo robot that can detect its opponent and the edge of the ring, you’ll need appropriate sensors that you can find on our accessories page.

The simple code below shows how PWM from the BrainStem is used to drive the motors to move the sumo forwards, backwards and to turn on the spot.

Download the code here.

 

/**************************************************************************
Description: Brainstem Moto board 1.0 with two 3-Amp Back-EMF H-Bridges used to control the Terminator Sumo Bot Kit. A simple program using PWM to move the robot in different directions.
Created: 06/02/03 Revision 1.00
Compiler Version: 1.0 build 14
Written by: Total Robots (Jamie Finnan)

***************************************************************************/
#include <aCore.tea>
#include <aMotion.tea>
void main()
{
aCore_Sleep(30000);
while(1)
{
aCore_Sleep(5000);
aMotion_SetSetpoint(0,-32767);
aMotion_SetSetpoint(1,32767);
aCore_Sleep(20000);
aMotion_SetSetpoint(0,0);
aMotion_SetSetpoint(1,0);
aCore_Sleep(10000);
aMotion_SetSetpoint(0,32767);
aMotion_SetSetpoint(1,32767);
aCore_Sleep(20000);
aMotion_SetSetpoint(0,0);
aMotion_SetSetpoint(1,0);
aCore_Sleep(10000);y
aMotion_SetSetpoint(0,32767);
aMotion_SetSetpoint(1,-32767);
aCore_Sleep(20000);
aMotion_SetSetpoint(0,0);
aMotion_SetSetpoint(1,0);
aCore_Sleep(10000);
aMotion_SetSetpoint(0,-32767);
aMotion_SetSetpoint(1,-32767);
aCore_Sleep(20000);
aMotion_SetSetpoint(0,0);
aMotion_SetSetpoint(1,0);

}
}
//Used in sleep object
// Controls for Moto board


// 3 second start up delay


// 0.5 second delay
// Set module 0 to full reverse PWM
// Set module 1 to full forward PWM
// 2 second delay
// Set Module 0 to stop PWM
// Set module 1 to stop PWM
// 1 second delay
// Set module 0 to full forward PWM
// Set module 0 to full forward PWM
// 2 second delay
// Set module 0 to stop PWM
// Set module 1 to stop PWM
1 second delay
// Set module 0 to full forward PWM
// Set module 1 to full reverse PWM
// 2 second delay
// Set module 0 to stop PWM
// Set module 1 to stop PWM
// 1 second delay
// Set module 0 to full reverse PWM
// Set module 1 to full reverse PWM
// 2 second delay
// Set module 0 to stop PWM
// Set module 1 to stop PWM


/**************************************************************************
***************************************************************************/


Examples | Shop