Ball Tracking Example

This example shows how to control a basic Robotic System using a Desktop Computer, a Kinect and an Arduino. As an example, this Robotic System will track a green ball by trying to keep it in the center of the Kinect's field of view and at a particular distance.

Three examples are provided, showing how to use MATLAB and Simulink to control the robotic system. Each method has its advantages and disadvantages. The first example uses MATLAB manage the robotic system without any code generation. The second and third examples show how to generate an executable out of MATLAB and Simulink code.

Contents

Hardware Layout

In this Robotic System, there are five major components that I am using:

The provided functions and models have been configured for the Arduino Mega 2560 with pins D47 and D46 controlling the left and right motors, respectively.

Overview

There are three examples that are shown:

  1. MATLAB on the host with MATLAB Support Package for Arduino
  2. MATLAB on the host with Simulink Target for Arduino
  3. Simulink on the host with Simulink Target for Arduino

All of the examples perform the same task, find the green ball using the Kinect's color and depth data and maintain the ball in the center of the Kinect's field of view at a specific distance from the Kinect.

The Kinect's view and data related to the ball's position and resulting control commands are overlaid onto the video feed and displayed. Here is an example of the Kinect's Video Player.

Examples

MATLAB on the host with MATLAB Support Package for Arduino

Open Example


Open Example


Open Example