Robotics (CSE 378) Final Project

Robot I


Robot II

Robot I
Webcam I
Comp I


For our CSE 378 Final Project, we create two robots and program them to play a game of tag. For each robot, the hardware setup consists of a webcam feeding visual information to a desktop computer which sends motor commands to a Lego NXT Mindstorm Robot. The language setup consists of a Matlab and C++ pipeline, with Matlab doing the visual processing and C++ doing the motor control. The algorithm consists of having each robot compare its current utility function to its previous utility function and then proceeding when utility increases and pivoting otherwise.


Our Matlab code uses the Image Aquisition Toolkit to read in images from the webcam. We then perform a background subtraction including normalizing for brightness. This gives us the foreground which we use RegionProps on to get the coordinates of both centroids (the center of both robots). Comparing this to the past step we then know whether to proceed or pivot. We do a system call to C++ to send motor commands to the robot.


Our C++ code reads in the motion information from Matlab. C++ using the NXT libraries then executes either a forward command or a pivot command. For pivoting, we select a random left or right direction followed by a random angle from 0 to 180 degrees.


The NXT Robot body is optimised to run our algorithm. Since forward and pivoting are the only important movements we used a 2 wheel design like a Segway but with an outrigger for balance. The 2 wheel design allows for optimal pivoting, and the simple body plan leaves little opportunity for anything to go wrong.

Robot II
Webcam II
Comp II