RoboBara - Robot vs. Robot Duel
Inspiration
The name of our project, RoboBara, was inspired by the classic Japanese genre of sword fighting movies: Chanbara. This iconic brand heavily influenced western cinema and brought about many classics like Star Wars and 13 Assassins. The project itself is the intersection of fun, silly, and dangerous. We wanted to build something that was exciting and also technically challenging. Thus, the robot vs. robot sword fighting duel was born.
Build Process
Around the end of September, one group-mate began the first of two robots for HackGT. You can see their DevPost submission here! Following those steps the team worked to build the second robot and finalize the code starting in mid-November and finished just in time for finals.
Robot Arm Design and Build

The first picture of the to-be-adapted arm from Instructables.
Thankfully we didn't have to design an arm from the ground up! After a few hours of searching Thingiverse and Instructables we found an arm that was easily duplicated and had laser cutting files available for free. In the end we found this robot. After making a few adjustments in size and servo dimension we used the laser cutters at the Hive and some nuts and bolts from Ace Hardware to make our fighting fleet. If you want to make your own you can find the instructions here!
Proof of Concept
This is the very first video of the proof of concept project working at the HackGT 2018 final presentation.
We proved that it was possible but the robot multiplayer game was far from complete. A weapon mount still needed to be designed and the controls were still all wrong. The initial idea was to use an accelerometer along with inverse and forward kinematics to approximate position and control the robot's end effector position that way. The amount of math needed for those calculations slowed down the response time and didn't allow the user to experience real time movement. The group later pivoted to using the accelerometer to change position by tilting.
Progress and Final Product
Progress video showing the robot with nearly completed controls!
After purchasing some carving blades and dart balloons we had everything we needed to create a multiplayer robot knife fighting game. We mounted the blades to the robot arms in place of the placeholder popsicle sticks and attached two balloons to each arm. This would allow two players to control the robots with an accelerometer based controller with a button to control slicing.
The final product would be two robots mounted on a nice wooden slab a set distance apart from each other, each with a blade and two dart balloons. After a countdown, the players would be allowed to control their robots and try to pop their competitors balloons. After a little more work on the physical robots and tightening a few screws we were completely done with the robot construction!
Code
Information
Below you can import all of the libraries needed to run our code...
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Import libraryPinDetect
InterruptIn style DigitalIn debounced with callbacks for pin state change and pin state hold.
Import libraryMMA8452
Library for driving the MMA8452 accelerometer over I2C
Import libraryServo
A class to control a model R/C servo, using a PwmOut
Our code started off very complicated with multiple libraries to calculate forward and reverse kinematics for the end effector. That code was running on the robot demoed at HackGT. You can see the difference a change in code made between the first and second videos above! In the second video we changed from calculating position using inverse kinematics to changing position based on acceleration and tilt of the MMA8452. In the end our code was faster, simpler, and more reactive to changes.
main.cpp
#include "mbed.h"
#include "Servo.h"
#include "MMA8452.h"
#include "PinDetect.h"
Serial pc(USBTX,USBRX);
DigitalOut myLed(LED1);
PinDetect pb1(p20);
DigitalOut Comm(p11); //If master
//DigitalIn Comm(p11); //If slave
DigitalOut Red4(p5);
DigitalOut Red3(p6);
DigitalOut Yel2(p7);
DigitalOut Grn1(p8);
Servo _base(p21);
Servo _shoulder(p22);
Servo _elbow(p23);
Servo _sword(p24);
void countdown(){
Comm = 1;
Red4 = 1;
wait(1);
Red4 = 0;
Red3 = 1;
wait(1);
Red3 = 0;
Yel2 = 1;
wait(1);
Red4 = 1;
Red3 = 1;
Grn1 = 1;
wait(1);
Red4 = 0;
Red3 = 0;
Yel2 = 0;
Grn1 = 0;
Comm = 0;
}
void swing(){
_sword.write(1.0);
wait(.1);
_sword.write(0.0);
}
int main() {
pb1.mode(PullUp);
int timer = 0;
double x = 0, y = 0, z = 0;
MMA8452 acc(p28, p27, 40000); //instantiate an acc object
//set parameters -- use these and don't change
acc.setBitDepth(MMA8452::BIT_DEPTH_12);
acc.setDynamicRange(MMA8452::DYNAMIC_RANGE_4G);
acc.setDataRate(MMA8452::RATE_100);
countdown(); //If master
/*
while(Comm = 1) {
wait(.1);
}
*/
while(1) {
acc.readXYZGravity(&x,&y,&z); //notice this is passed by reference use pointers
_base.write((y+1)/2);
_shoulder.write((x+1)/2);
_elbow.write((x+1)/4);
if(!pb1){
myLed=1;
swing();
myLed=0;
}
// You can uncomment this line to see the values coming off the MMA8452
//printf("\n(%.2f,%.2f,%.2f)", x,y,z);
timer++;
} //infinite while loop
} //end main
Import programRoboBara
ECE 4180 Final Project
Picture Gallery
Demo Videos
Please log in to post comments.






