P11212: LV for Education: Controls, RF Module
/public/

Software Documentation

Table of Contents

Code Structure

The Processing environment uses one of the files as the base class, and all other classes included in the project are inner classes of this file.

The main program files are:

LVE.pde
Main file, contains drawing loop and global variables.
LVE_Input.pde
All controller input handling, as well as deciding which input to use.
LVE_GUI.pde
Contains all code pertaining to the GUI and handling it's input.
LVE_JoySet.pde
Dialog for reconfiguring controller layout.
LVE_Output.pde
Responsible for all output of state.

The main storage files are:

LVE_InputMessage.pde
Stores controller or GUI input for use by GUI and output.
LVE_JoySettings.pde
Stores all ontroller configuration data, including default controls.

All other PDE files are helper classes, or extensions partially .implemented:

LVE_KeySetup.pde
Same as JoySet.pde, but for keyboard. Does nothing but display itself currently.
LVE_MSAButtonListener.pde.
An ActionListener for the MSA menu items, containing the filename.
LVE_MultiBox.pde
A combination label/combobox or label/textfield. For use in KeySetup and JoySet dialogs.

Environment

The code is meant to be placed inside the Processing sketchbook, in a folder named "LVE". Inside this folder is one named "MSA", which contains the image of the controller, as well as the files needed for the MSA. Currently, this is a .msa file, and a 420x200 .jpg image.

MSA File

The MSA file is made up of two parts. The first is the image to use, and the second is a list of motors separated by line. This list includes their placements, sizes, and labels. It should be structured like so, where Negative corresponds to one direction of the servo, and Positive the other:

image name
[For each servo]NegativeLeft, NegativeTop - NegativeRight, NegativeBottom; PositiveLeft, PositiveTop - PositiveRight, PositiveBottom; "negative label" "positive label"

This is the top left corner of the button, followed by the bottom right, for two buttons. This gives a button for each direction of the servo.

An example file, for the claw implemented by 11213:

Claw.jpg
204,118-288,130; 110,118-167,130; "MSAForward" "MSABack"
275,88-314,100; 335,88-369,100; "Close" "Open"

Wireless Message

This is the message sent from the PC through the WOCCS to the Arduino. There are two forms. One for the MSA instruction, and another for all other instructions.

MSA Instruction: 00

The MSA instruction requires 3 bytes. In this case, instruction will always be 00.

| Instruction | Unused | |MSAHigh| |MSALow|
|-----2bit----|--6bit--| |-8bit--| |-8bit-|

MSAHigh and MSALow are bytes, 1-hot encoding the states of the MSA servos. Again, + corresponds to one direction of the servo, and - the other. For MSALow, the structure is as follows.

| MSA4+ | MSA4- | MSA3+ | MSA3- | MSA2+ | MSA2- | MSA1+ | MSA1- |
|-1bit--|-1bit--|-1bit--|-1bit--|-1bit--|-1bit--|-1bit--|-1bit--|

MSAHigh is similar, but for MSA5 to MSA8.

Other instructions

All other instructions require only a single byte, and are structured as follows:

|Instruction | Sign | Speed|
|----2bit----|-1bit-|-5bit-|

Instructions:

Sign:

Speed:

Installation

This program was written in Processing 1.2.1. It may work in other versions, but there can be no guarantee. Please use the links provided on this page to be sure you have the correct version.

To Install and Run

Install

  1. Download all Software
    1. Download Processing from here
    2. Download the newest LVEGui release here
  2. Install Processing, following its documentation
  3. Unzip the LVEGui zip file to the Processing sketchbook
    • NOTE : the sketchbook folder can be found by opening Processing and going to File->Preferences
  4. Start Processing (Or restart if already open)
  5. In Processing, go to File->Sketchbook->LVE. The LVE program will open in a new window. You can now close the original Processing window.
  6. Connect Logitech Dual Action to the computer, and install any drivers if necessary
  7. Connect WOCCS board, and install CC1111 driver from Software/cc1111drivers.zip

Run

  1. In the new Processing window, click the play button.
  2. A popup will ask which control scheme to use. Select the one you want from the drop down menu and click OK.
  3. Another popup will appear. This will ask which communications port to use. Select the port that the WOCCS is connected to.
  4. A final popup will open, asking which LVE to use. The LVE we have built is LVE 1.

Things to finish

Arranged in order of importance:
  1. Implement multiple LVE configuration
  2. Implement calibration
  3. Implement Keyboard control
  4. Remove cancel button from control selection dialog
  5. Fine tune values, and perhaps implement an external file for settings like acceleration multiplier.
  6. Refactor some things, removing the requirement to pass around a reference to the main PApplet
  7. Move to a single instance of LVE_InputMessage. It should be passed into the function, modified, and returned.
  8. Make cross platform
    • Currently, the joypad library used shows the controller having a different ordering of buttons depending on the OS. Two different default control schemes would have to be added.