Prototypes‎ > ‎PRODOS‎ > ‎

Programming

Tools and Code

Here is what you'll need to program Prodos:

Installation Instructions


Follow the instructions below to set up your computer to be able to program Prodos:

  1. Install the Arduino development environment.  

  2. Move the Menu folder from the Prodos Control Code into the libraries folder for your Arduino installation:
       example : "C:\Projects\Biped\Controllers\arduino-0022\libraries\Menu"

  3. I couldn't figure out how to get the relative linking to work properly for the Menu libary, 
    so the following changes will need to be made in the code files:

    in Menu.h:
      change the path in line 19:
         #include "C:\Projects\Biped\Controllers\arduino-0022\libraries\Servo\Servo.h"

      to whever your Arduino installation is
         #include "<your Arduino installation directory>\libraries\Servo\Servo.h"

    in Menu.cpp:
      change the path in line 18:
         #include "C:\Projects\Biped\Controllers\arduino-0022\libraries\uOLED\uOLED.h"     

      to whever your Arduino installation is
         #include "<your Arduino installation directory>\libraries\uOLED\uOLED.h"

      change the path in line 19:
         #include "C:\Projects\Biped\Controllers\arduino-0022\libraries\Servo\Servo.h"

      to whever your Arduino installation is
         #include "<your Arduino installation directory>\libraries\Servo\Servo.h"

  4. Remove the jumper connector on the OLED board (the jumper puts the display in slide show mode)
    Make sure to copy the uOLED folder to the libraries folder in your Arduino installation 
       example : "C:\Projects\Biped\Controllers\arduino-0022\libraries\uOLED"

  5. install the images file (data.gcs) for the OLED.  
    Open up the graphics composer 
      example : "C:\Projects\Biped\Controllers\arduino-0022\hardware\oled160\GraphicsComposer\GraphicsComposer.exe"
    from the main menu : 
      File->Open
      Navigate to data.gcs (it is in the same folder as this text file)

    insert the microSD card into your computer (use the converter card if necessary)
    upload the images to the card

    *note that for adding new images to the card : use 96x64 pixel png files.  When adding new files you'll need to type in "*.png" in the browser dialog to see the png files because it only looks for jpg files by default (and jpg files get horribly compressed when it loads them).

Discussion

The code for Prodos is composed of the following files:

    Menu.cpp : This is the code file for the Menu library (for Arduino).  It contains most of the code that runs the robot.  It has several classes that provide structure for the menu system and animation.

    Menu.h : This is the header file for the Menu library (for Arduino).  It defines all of the classes used in the library.

    keywords.txt : This text file defines key words used in the Menu library. It is used by the Arduino Development Environment to be able to highlight key words and prevent duplicate names.

    prodos_control.pde : This is the Arduino code file that sets up the graphical user interface (GUI), and controls the walking animation.  It uses the Menu library.

    data.gcs : This is an images file (in the Graphics Composer format) that contains all of the images needed to display the animations and menus for Prodos.


Writing code for the Arduino is done using the C++ language and there are lots of good tutorials online.  There are also several tutorials that come with the Arduino Development Environment (File->Examples).  You won't need to do any coding to get Prodos working, as all of the necessary programs have already been written.  However if you'd like to modify or extend the functionality of Prodos feel free.  

Basic tasks such as sensor reading, servo position setting, and OLED output can be accomplished by adding a few commands to the loop method in an Arduino program (such as prodos_control.pde).  Advanced functionality (such as nice menus) comes from writing classes and leveraging the object oriented features of C++.  A good place to put classes is in custom Arduino libraries ... which is where most of the code for Prodos lives (in the Menu library).  

The Arduino has a limited amount of memory, so be careful about how much memory you use in code.  I had to remove several features of Prodos because the memory was full.  When the memory is full unpredictable behavior can result and is difficult to debug.  To get around this issue in future prototypes the control code will be shifted to a more capable processing platform (such as Android or PC) and the Arduino code will simply route commands to the servos and pass back sensor information.