Software

Software

On this page you will find instructions into how to set up the software necessary to drive the car. You will not find code that will help in programming the processing of data from the sensor as to drive the car.
Setup

  1. Install  Ubuntu with a USB CD drive
    1. During installation, ther will be some pixelation and trouble reading the menus. This problem will be fixed after installation is finished.
  2. During the initial boot, hold shift to enter grub menu
    1. Press ‘e’ to get to the options
    2. On line 8, replace “quiet splash” (not in quotes) with “nomodeset” (not in quotes)
    3. boot (F10)
  3. Now we need to permanantly fix those graphical issues
    1. Connect wired ethernet cable and open a terminal window
    2. enter the following:
      1. sudo add-apt-repository ppa:tjaalton/ppa
      2. sudo apt-get update
      3. sudo apt-get dist-upgrade
  4. There is some issues with a window stating that there are system errors, to fix this we need to do the following in a terminal:
    1. gksu gedit /etc/default/apport
    2. change value of “enabled” from 1 to 0
    3. save and exit
  5. Reboot
  6. Download Spread
    1. www.spread.org/download/spread-src-4.1.0.tar.gz
    2. extract and open a terminal and change directory to the spread directory that you just extracted to
      1. ./configure
      2. make
      3. sudo make install
  7. reboot
  8. Install java
    1. in a terminal, type:
      1. “sudo apt-get install openjdk-7-jdk openjdk-7-jre icedtea-7-plugin”
  9. Install Matlab
    1. login to mathworks site
    2. download matlab
    3. click “manual download”
    4. follow instructions
    5. during the install, select custom install
    6. check the box to create a symbolic link
  10. Download vader lab matlab files from svn
    1. sudo apt-get install subversion
    2. sudo svn co http://vader.cse.lehigh.edu/svn/matlab/trunk matlab
    3. sudo apt-get install g++
    4. change directory to /home/vader/matlab/spread_api
      1. sudo make
  11. Install Xbox 360 Driver
    1. sudo apt-get install xboxdrv
  12. Setup servo controller
    1. Install Servo Controller Linux Software
      1. http://www.pololu.com/docs/0J40/3.b
      2. follow site instructions and README
    2. Plug in servo controller
    3. sudo ./MaestroControlCenter
      1. under serial settings, change to: Serial Mode:USB Dual Port
      2. click apply settings(bottom right)

Download

Servo Controller and Xbox code

Servo Controller

To gain access to the servo controller, the only requirement is the “maestro.m” file. Some example code to move the servo plugged into channel 0 from its minimum to maximum position is:

c = 0;
%create a maestro servo controller object
m = maestro();
while c<255
    %change the position of servo attached to slot 0 to c, where 0<c<255 
    m.setpos(0,c);
    c = c+1;
end

In addition to accessing the servo position, it is also possible to alter the servo acceleration and speed. For further information, please reference “maestro.m”

In addition, be sure to download the 99PololuRules file to the robot.

Xbox Controller
it is necessary to start a spread daemon a terminal window with:

spread -n localhost

Now you will need to open two separate matlab processes, and run “xboxsend.m” in one and “xboxrec.m” in the other. Assuming that the car is powered on, you should now be able to control the car:

Left Joystick = steering
Right Trigger = forward throttle
Left Trigger = reverse throttle
X = 1/4 speed activate
A = 1/2 speed activate
B = full speed activate

If the car loses the controller signal, it will reset all servo positions to neutral(127) until connection is regained.
Speed Encoder

  1. How to test to make sure the encoder is working by running encoderPhidgetAPI Matlab program:
    1. Open a new terminal
    2. matlab -nodesktop
    3. cd robot_nascar
    4. encoderPhidgetAPI(‘c’)
    5. while(1)
    6. encoderPhidgetAPI(‘g’)
    7. end
  2. Also try running encode.m program if running encoderPhidgetAPI only returns zeros.

Operating the Car

In order for the vehicle to be functional, you will need to:

  1. Connect the car battery to the ESC
  2. Connect the PC to either AC adaptor or PC battery and power on
  3. Hold “EZ SET” button on ESC until there is no light, then it should go to solid red after release
    1. make sure that both servos are set to position 127 before turning on the ESC (you can do this with maestro.reset(0) and maestro.reset(1))