Robomagellan 2011

The Robomagellan competition will be held at Robogames on April 17, 2011 in the bay area. The rules are here: http://robogames.net/rules/magellan.php

The Sparkfun competition: http://www.sparkfun.com/products/10435

This project's GIT repository: http://ieee.ucsd.edu/gitorious/robomagellan-2011/robomagellan-2011

Design

The system will use GPS and compass to get within the general vicinity of the waypoints, then use the camera to search for the cone. The camera will be mounted on a gimbal so that it can scan 180 degrees. A sonar sensor will also be mounted on the gimbal so that we can gauge distance to the cone. We will use a fixed array of 3 sonar sensors, plus a sonar sensor mounted on the gimbal to detect and avoid objects. We can use the gimbal-mounted sonar sensor to generate a continuous depth map as a function of angle by scanning it 180 degrees. We will sample the fixed sonar array continuously while driving, which will detect whether an object is present or not. We can then use the gimbal-mounted sonar sensor to get a finer picture of object and determine a way around it.

We will use the LPC2148 for the microcontroller. The LPC2148 is a 32-bit ARM processor running at 60Mhz with 40kB SRAM and 512k flash. We are designing a single PCB for the system which will contain the LPC2148 header board, power supply electronics, level shifting circuitry, and connectors to all the off-board peripherals. The system will use a Zigbee wireless interface for debugging, communication, and kill switch. Voltage level translation between 3.3V and 5V will be performed by a pair of 74LVXC3245MTCX, one configured for transmit and the other configured for receive. This will also serve to buffer the microcontroller pins against large currents.

The electronics will be physically mounted on a sheet of aluminum which will be connected to system ground. The aluminum will serve as a shield against EM noise generated by the motors. The gimbal and sonar array will be mounted in front, the electronics will be mounted in the center, and the GPS and compass will be located at the rear.

We are using the Traxxas E-Maxx monster truck (same chassis as previous two years), which comes with the EVX-2 speed controller. The EVX-2 takes standard RC control signals, that is, 50Hz PWM signals with pulse width between 1us and 2us. The motor and servos are powered by a pair of 8.4V NiMH batteries that connect directly to the speed controller.

The electronics will be powered by a 7.4V Lipo battery. The electronics power and motor power are completely isolated. We are using linear regulators to generate 3.3V and 5V rails for the electronics. The power consumption of our system is so low that we can run the system for several hours without recharging, which is more than sufficient for the competition.

System Block Diagram

Attack Plan

  1. System design. Complete.
    1. Algorithm design
    2. Selection of all modules (GPS, compass, sonar, camera)
    3. Pin assignments, complete electrical schematic, peripheral assignments in microcontroller
    4. Budget
  2. Prototyping. In progress.
    1. Build entire system on a breadboard to verify electrical correctness (i.e smoke test) . Done.
    2. Write low-level drivers on LPC2148 for all modules to verify functional correctness
      1. Car – done
      2. GPS – done
      3. Compass – done
      4. Sonar – in progress
      5. Camera – in progress
    3. Test Milestone #1: car should be able to navigate autonomously between GPS coordinates, no object avoidance or cone recognition required.
      1. Done, demonstrated on 2/1. We taped down the LPC2148, compass, GPS, and wireless module to the chassis and programmed the car to drive to the EBU-I clock from any location. This proves that compass, GPS, car, wireless interface, and basic navigation algorithms are all working.
    4. Test Milestone #2: add object avoidance to previous milestone. Car should be able to navigate to a given goal coordinate in the presence of obstacles, using the sonar array for obstacle detection.
    5. Test Milestone #3: add cone detection to previous milestone. Car should be able to navigate to given coordinate, and bump into cone.
  3. PCB design. In progress
    1. We are designing a PCB to hold all the electronics. This was started after the smoke test is complete, and can be released to production after test milestone 3 is reached.
  4. Assemble final hardware.
    1. Solder and test PCB
    2. Mount all hardware to mechanical platform

Team

Name Role Email
Jordan Rhee Team Lead rhee.jordan@gmail.com
Jereme Barnett-Woods PCB jcbarnet@ucsd.edu
Frank Chang Sonar fychang@ucsd.edu
Nicolas Thien Camera nutella50g@gmail.com
Arthur Robertson Compass ayrobert89@gmail.com

Pin Assignments

These are also under source control in doc/Pin Assignments.txt.

LPC2148 Pin Assignments

Signal Name            Port            Pin Function        Notes
--------------------------------------------------------------
SONAR1_OUT            P0.30            CAP0.0                PWM output of sonar device (connected to CAPTURE inputs of lpc2148)
SONAR2_OUT            P0.29            CAP0.3
SONAR3_OUT            P0.28            CAP0.2
SONAR4_OUT            P0.4            CAP0.1

SONAR1_EN            P1.16            GPIO:output            Used to start or stop the sonars from ranging.
SONAR2_EN            P1.17            GPIO:output            High = ranging enabled
SONAR3_EN            P1.18            GPIO:output            Low = ranging disabled
SONAR4_EN            P1.19            GPIO:output

CAR_SERVO            P0.21            PWM5                PWM output for car steering servo (50Hz, pulse width = 1us - 2us) - white wire on car connector
CAR_MOTOR            P0.7            PWM2                PWM output for motors    (50Hz, pulse width = 1us - 2us) - red wire on car connector

CAM_CS                P0.20            SSEL1                SPI bus for camera communication
CAM_MOSI            P0.19            MOSI1
CAM_MISO            P0.18            MISO1
CAM_SCK                P0.17            SCK1
CAM_RESET            P0.16            GPIO:tristate        Connected to reset pin of camera
CAM_EN                P0.15            GPIO:tristate        Connected to power enable pin of camera. Externally pulled up.

ZIGBEE_CTS            P0.11            CTS1                Zigbee debug interface - UART 115200, 81N, RTS/CTS flow control
ZIGBEE_RTS            P0.10            RTS1
ZIGBEE_RXD            P0.9            RXD1
ZIGBEE_TXD            P0.8            TXD1

GIMBAL_SERVO        P0.6            GPIO:output            Connected to control signal of gimbal servo (50Hz, pulse width = 1us - 2us)

COMPASS_SDA            P0.3            SDA0                Connected over I2C to ATMEGA168 (for compass)
COMPASS_SCL            P0.2            SCL0
ATMEGA_RESET        P0.12            GPIO:tristate        Connected to RESET pin of ATMEGA. Externally pulled high. Should be TRI-STATED when not in use.

GPS_RXD                P0.1            RXD0                Connected to GPS (UART 8N1 57600)
GPS_TXD                P0.0            TXD0

BOOTLOADER            P1.26            GPIO                This pin is used by the bootloader to decide whether to enter bootloader mode or not

Getting Started

0.Join IEEE

1. Install Git and Get Source Code

  1. Go to http://code.google.com/p/msysgit/ and download the latest version
  2. Run installer.
  3. Close any open command prompts. Open up the Git Bash console (Start → Programs → Git → Git Bash) and type 'git'. If installation was successful, you will see the help message.
  4. Configure Git local settings by running the following two commands, substituting your name and email address in the quotes:
    1. git config --global user.name "Charlie Root"

    2. git config --global user.email "you@blah.com"

  5. Go to http://ieee.ucsd.edu/gitorious/users/new and enter your information. When you get the confirmation email, click on the link. Forward the email to me to let me know that you've created your account.
  6. Go to your dashboard at http://ieee.ucsd.edu/gitorious/.
  7. Click “Manage SSH keys”
  8. Click “Add SSH key”
  9. On your computer, browse to your home folder (e.g. C:/Users/jerhee) and look for a folder called ”.ssh”. Enter the .ssh folder and look for a file called “id_rsa.pub”. If the .ssh folder or the id_rsa.pub file do not exist, open a GIT command prompt (Start → All Programs → Git → Git Bash), and execute
    1. ssh-keygen -t rsa

      and hit 'enter' for every question it asks. You should then be able to find the “id_rsa.pub” file in the ”.ssh” folder.

  10. Open “id_rsa.pub” in notepad and copy+paste the entire contents of the file into the textbox on the “Add a new public SSH key” webpage on Gitorious.
  11. Click “Save”
  12. To get a copy of the source code, execute the following command:

git clone git@ieee.ucsd.edu:robomagellan-2011/robomagellan-2011.git

You now have the source code. Whenever you sit down to work on RM, always get the latest copy of the code by executing

git fetch origin master
git merge FETCH_HEAD

As you're working, commit your changes frequently

git commit -a

To push your changes to the server so that everyone can see your changes, execute:

git push origin HEAD:master

2. Read the rules: http://www.robogames.net/rules/magellan.shtml 

3. Install ARM compiler

Follow these instructions to install a compiler for the LPC2148: https://sites.google.com/a/eng.ucsd.edu/ece30/lab-1

4. Install Eagle: http://www.cadsoftusa.com/download.htm

Priorities as of 3/29/2011

  1. Done. Need to create a video of the robot to send to Sparkfun to qualify for the competition by April 1st. Need to rebuild the robot the way it was and shoot a video. I will do this today to get it out of the way. We need to decide who's going to the Sparkfun AVC competition.
  2. Done. Need to get compass working. Arthur, could you send the latest copy of the Arduino code?
  3. Need to get cone recognition working in Matlab. Nicolas, I only want you to focus on the algorithms and coding in Matlab. Don't even think about how to implement it on the camera, I will do that. Embedded coding is my strength, so I want you to focus on the algorithm. You should write a function that takes an image as input (or reads an image), and returns 3 values: x position of cone, y position of cone, and a “confidence” value between 0 and 1.0 that indicates how sure you are that you've found the cone. I ordered the camera on the 7th, but apparently it got lost in the mail, so I've been in contact with Seattle Robotics to ship a new one, which should show up by thursday.
  4. Need to verify with 100% confidence that the sonar driver is bug free.
  5. Need to incorporate object avoidance into the navigation algorithm. I have some ideas on this but would be easier to explain in person.
  6. Need to hold a mock competition and fill in all the details. They give us 30 minutes between runs and we are allowed to take a hand-held GPS over the course, but we can't take the actual robot on the course. We can use this to generate a route that avoids most large obstacles. We need to work out the details of how to do this.
  7. Need to write code for the Sparkfun AVC.

Specification for waypoint generator

The program must compile and run on Ubuntu linux. The code should be contained in 'rmwaypoint.c'. You can compile the code with the following command:

gcc -std=gnu99 rmwaypoint.c tinygpsc.c -o rmwaypoint

and you can run the program with

./rmwaypoint

At the beginning of the competition, we need to detach our GPS module from the robot, and plug it into a 3.3V FTDI cable connected to Alex's netbook. We then need to launch a program with the following usage:

rmwaypoint -b BAUD -t TTY

Where BAUD is a number that corresponds to the baud rate of the GPS device. If not specified on the command line, should default to 57600. TTY should be serial port to connect to, for example ”/dev/ttyUSB0”. If not specified on the command line, should default to ”/dev/ttyUSB0”.

First you should create an output file called “waypoints.txt” in write mode. If waypoints.txt already exists, then open waypoints1.txt. If waypoints1.txt already exists, open waypoints2.txt, and so on, until you find a filename that is not in use. We do not want to overwrite previous outputs from the program. You should then write the following to the file:

const waypoint waypoints[] = {

The program should then connect to the serial port using the provided parameters (or defaults if not specified), and enter a loop where it receives characters from the GPS device and parses them. For this, you can use the same code that's running on the LPC2148. Look at gps.c and tinygpsc.c.

You should then wait for the user to enter a character. If at any time the user enters EOF (by typing ctrl + d), the program should write the following to the output file and exit:

};

If the user types ENTER, your program should print the following to the console:

Is there a cone at this waypoint (Y/N): 

at this point, the user will either type in Y or N and hit ENTER

Additional Notes:

at this point, the user can type any string and hit enter. This string is optional and will be included as a comment in the source code file that you generate.

You should then write out the current latitude and longitude to the output file in this format:

    {DEG2RAD(latitude), DEG2RAD(longitude), cone},    // Additional Notes   

Where cone is either 0 or 1 corresponding to whether the user typed 'Y' or 'N' in response to the cone question. When the program is all done, here's an example of what the output file should look like:

const waypoint waypoints[] = {
    {DEG2RAD(32.88125), DEG2RAD(-117.23544), 0},    // start coordinate
    {DEG2RAD(32.88428), DEG2RAD(-117.236004), 1},    // first cone coordinate
    {DEG2RAD(32.88372), DEG2RAD(-117.23688), 0}    // end coordinate
};

Here is the definition of the waypoint structure:

typedef struct {
    double lat;        // latitude (radians)
    double lon;        // longitude (radians)
    int cone;        // 0 = do not expect cone, nonzero = expect cone
} waypoint;

Compass Calibration Procedure

  1. Put the robot on the ground somewhere (anywhere) and record the GPS coordinate that it reports. Mark the point with a piece of tape on the ground. Put the latitude/longitude in robomagellan.h in the COMPASS_CALIBRATE1 variable.
  2. Put the robot on the ground 50-100 ft away from from the first point, and record the GPS coordinate that it reports. Mark the point with a piece of tape on the ground. Put the latitude/longitude in robomagellan.h in the COMPASS_CALIBRATE2 variable.
  3. Use a string to make a straight line between the two points.
  4. Place the robot on the first point, aligned with the string in the direction of the second point. Record the compass heading that the robot reports and put it in COMPASS_CALIBRATE_HEADING variable.

Zigbee Settings

38400 Baud, RTS/CTS Flow Control (aka Hardware flow control)

Camera UART Settings

Power Sequence

  1. Open a serial connection to the zigbee module using the configuration pictured above.
  2. Ensure the the speed controller is OFF. The green light on the speed controller should be off.
  3. Turn on the main power switch.
  4. It is now safe to turn on the speed controller.
  5. Follow the instructions on screen.
  6. When it's running, you can hit any key at any time to pause the robot

Powering Off

  1. First turn off the speed controller
  2. It is now safe to turn off main power.

How to Program Camera

  1. Unplug ribbon cable from camera.
  2. Plug in auxillary power to outside (rightmost) connector
  3. While holding down the button, turn the power switch to ON.
  4. Open Flash Magic and set the configuration as shown above.
  5. Hit Start.
  6. When it's done, turn the camera off, then back on to run the new code.
  7. You can connect to it over the serial port using baud of 115200, 8N1, No Flow Control. As with all the FTDI adapters, look in 'My Computer' under 'Ports' to see which COM number the adapter is assigned to. You must close putty before you can program the device again (since both the serial programmer and putty use the FTDI serial adapter.)

Datasheets

 
projects/robomagellan/robomagellan_2011.txt · Last modified: 2011/04/24 23:44 by jerhee
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki