NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

ZumoCC3200Demos

From Texas Instruments Wiki
Jump to: navigation, search

Building and Running the Zumo CC3200 Demos[edit]

This page describes applications and demos written for the Zumo CC3200 as well as how to build and run the demos.

Each demo below consists of two programs: an Energia program that runs on the Zumo CC3200 robot and a Processing sketch that runs on your laptop. These two programs communicate with one another via WiFi.

Before running any of the demos, there are a few simple one-time installation steps that must be done:

After these installation steps, it's an easy matter to build and run a demo.

Install Processing Libraries[edit]

All of the examples below use Processing 2.2.1 on a laptop to control and/or monitor the status of each Zumo. In order to run these examples, you must first install Processing as described in Software Installation. In addition, some of the examples require one or more of the following Processing libraries which can be downloaded from the Processing website and must be separately installed.

  • G4P Controls - a rich collection of 2D GUI controls that supports multiple windows and a simple event handling system.
  • ControlP5 - A GUI (graphical user interface) library for processing.
  • UDP - Enables simple UDP communication, as well as multicast support.

See How to Install a Contributed Library for detailed instructions on how to use contributed libraries in Processing. Don't worry, it's easy. In brief,

  • Start the Processing application
  • Locate your Processing sketchbook folder by selecting the File > Preferences menu item and looking for "Sketchbook location"
  • Copy the contributed library's folder into the libraries folder of your sketchbook. You'll need to create the libraries folder if this is your first contributed library installation.

Install the Energia ZumoCC3200 Library[edit]

Before building any of the demos below, you must first install the ZumoCC3200 library into your Energia sketchbook. The Energia library installation process is essentially the same as that for Processing libraries.

  • Start the Energia IDE
  • Locate your Energia sketchbook folder by selecting the File > Preferences menu item and looking for your "Sketchbook location" setting
  • Copy the entire ZumoCC3200 folder into the libraries folder of your sketchbook. If this is your first Energia library installation, you'll need to create the libraries folder.
  • Restart the Energia IDE (so it will rescan your sketchbook for newly installed libraries)

Build and Upload a Zumo CC3200 Example[edit]

After the ZumoCC3200 library has been installed in your Energia sketchbook, the process for building Energia applications that run on the Zumo CC3200 is as follows:

  1. Connect the Zumo's ReadBearLab CC3200 to your PC with a USB cable
    • Switch the Zumo Bot's power switch to "off" (power will be supplied to the CC3200 via the USB connection)
    • Connect the RedBearLab CC3200 USB to one of your PC's USB ports
  2. Within the Energia MT IDE, do a one-time board/serial port setup:
    • Select the RedBearLab CC3200 EMT board (via Tools > Board > RedBearLab CC3200 EMT (80MHz))
    • Select the COM port that's connected to the Zumo (via Tools > Serial Port > COM?)
    If you're using Windows, it's the "mbed Serial Port" that appears under "Ports (COM & LPT)" in the Device Manager.
  3. Within the Energia MT IDE, select an example and upload it:
    • Open one of the examples, say AssistedDrive (via File > Examples > ZumoCC3200 > AssistedDrive)
    • Click the "Upload" button to build, upload, and start the AssistedDrive sketch on the ReadBearLab CC3200.

Note: Sometimes Energia MT has trouble uploading sketches to the RedBearLab CC3200. In these cases, it often helps to disconnect and reconnect the USB cable, and try to uploading again.

Wireless Motor Control[edit]

Zumo, like most wireless motorized tanks, can be directly driven via a remote control. Zumo can be driven using a traditional WASD keyboard interface using the ManualDrive demo provided below. But, unlike most other tanks, Zumo also provides IMU assisted methods of control.

Manual Drive: Manual Drive With Sensor Feedback[edit]

This application is a basic system test that exercises the WiFi connection and the IMU sensors to enable remote control of the Zumo while simultaneously displaying real-time plots of its IMU sensor data.

Beyond illustrating the power of the Zumo CC3200 in less than 350 lines of code (including comments), this example combines a simple Wiring sketch with an equally simple application written in Processing, the original framework that inspired the creation of Wiring and Arduino.

Basics Source Code
Energia MT sketch ManualDrive
Processing sketches ManualDrive/zgraph or ManualDrive/zecho

Assisted Drive: Semi-Autonomous Drive With Sensor Feedback[edit]

Using the Zumo IMU sensors together with basic motor control it's possible to provide driver assistance to drive in a straight line and precisely turn by a pre-specified amount. For example, the video below shows how the Zumo can drive in a straight line even if the ground underneath it moves(!)

Driving Straight
id=8AW8HCAbBhE}}


The Processing sketch used to view the data above also allows you to display (and log to a file) real-time control data computed by the Zumo while driving. The screenshots below illustrate the data seen during an autonomous 90-degree turn.

Heading Angle Motor Power PID Error
Zumo ninty angle.png
Zumo ninty motor.png
Zumo ninty pid error.png

In addition to the control data, raw IMU data can also be displayed in real-time.

3-axis Gyro Data 3-axis Accelerometer Data
Zumo ninty rgyro.png
Zumo ninty acc.png
Assisted Drive Source Code
Energia MT sketch AssistedDrive
Processing sketch AssistedDrive

Spline Drive: Autonomous Motion Planning With Sensor Feedback[edit]

Given a set of control points, the Zumo can use the motion planning library to interpolate between those points to generate a trajectory, then follow that trajectory with guidance from the IMU-based PID control.

The Spline Drive example demonstrates this functionality by allowing the user to draw a spline in Processing, then send that spline (i.e. the control points that determine the spline) to the Zumo and have it execute the drive.


Spline Path to Follow
Zumo spline.png

Note: This example currently uses an Open Source C++ spline class that uses STL vectors. As a result, the demo contains C++ exception handling code that requires approximately 67K of memory which significantly reduces the length of the longest support path. The longest spline is roughly 2000 pixels in Processing. It's possible to triple this length by eliminating the need for C++ exception handling.

Spline Drive Source Code
Energia MT sketch SplineDrive
Processing sketch SplineDrive

Balance[edit]

In addition to IMU assisted driving in the plane, the Zumo CC3200 is also capable of balancing on two wheels(!)

This example makes use of the IMU library's complementary filter data, which combines the accelerometer and gyroscope data to provide an accurate and responsive tilt (pitch) angle reading. PID control is then used to regulate the tilt angle to (approximately) -90 or 0 degrees.

Balance Controller Design Balancing(!)
Zumo balance design.png
id=7EQD7zh444k}}

The Processing sketch for this example allows one to tune PID control parameters in real time as well as monitor current tilt angle (as measured by the Zumo), motor power, and y-axis angular velocity.

Startup Tilt Data Steady-State Tilt Data
Zumo balance rt0.png
Zumo balance rt.png
Zumo Balance Source Code
Energia MT sketch Balancing
Processing sketch Balancing

Attitude and Heading Display[edit]

Using the DCM module of the ZumoCC3200 library, the Zumo can calculate and send its direction cosine matrix to a Processing application which displays the matrix as a set of X, Y, and Z unit vectors which represent the zumo's three dimensional orientation with respect to the global coordinate system.

A brief screen capture of the Processing application's display.

{{#ev:youtube|FhwlkFKjh1U|Zumo CC3200 Attitude Display}}

In this example, the Zumo undergoes a calibration sequence for the magnetometer in order to normalized the incoming data. While this calibration is ongoing, the Zumo's LED indicator will light up, and the user will need to rotate the Zumo around until the LED shuts off to complete the calibration.

Zumo Attitude Source Code
Energia MT sketch AttitudeDisplay
Processing sketch AttitudeDisplay

Networking[edit]

Although the most of the demos involve a single Zumo server talking with a single Processing client, there are many other possible setups.

UDP[edit]

Using Energia's WiFiUDP class and the UDP Processing library, it's possible to run the basic example (WASD motor commands and IMU data display) using UDP connection as opposed to the original server/client TCP design, as demonstrated by the UDPExample project. Although TCP is generally preferred for one-to-one connections due to it's superior reliability, UDP is useful in situations which multiple parties are involved.

Group Control Source Code
Energia MT sketch UDPExample
Processing sketch UDPExample

Multi-Control[edit]

It's possible to control multiple bots through a single Processing application.

In this example, all parties involved are connected to an external network (not a Zumo access point). Processing then sends motor commands via UDP broadcast. Zumos receiving commands send an IMU data packet in reply so that Processing can display sensor data from all Zumos it controls.

{{#ev:youtube|k7v4j5z_wFU|Zumo CC3200 UDP Broadcast Control}}

In this video you can see that all the Zumo CC3200's respond to the same drive commands. But, because the commands executed don't leverage the IMU sensors to "assist" their actions and there are mechanical and power-level variations among the Zumos, the Zumos quickly become disorganized, bump into one another, and ultimately end by driving in opposite directions(!)

It would be interesting to see if adding "assisted drive control" to this example would help keep the Zumos in sync.

Group Control Source Code
Energia MT sketch UDPBroadcast
Processing sketch UDPBroadcast

RSSI Tracking[edit]

Another app that takes advantage of the WiFi libraries and networking capabilities of the Zumo is the Tracker example, in which one "tracking" Zumo attempts to track and locate (to a considerable tolerance) a "target" Zumo by monitoring changes in RSSI levels.

[To Be Developed]

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article ZumoCC3200Demos here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article ZumoCC3200Demos here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article ZumoCC3200Demos here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article ZumoCC3200Demos here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article ZumoCC3200Demos here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article ZumoCC3200Demos here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article ZumoCC3200Demos here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article ZumoCC3200Demos here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article ZumoCC3200Demos here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity