Final Project files for mBed development.

Dependencies:   m3pi mbed

main.h

Committer:
lsaristo
Date:
2014-12-10
Revision:
34:3066686d5152
Parent:
32:8b589710632b
Child:
35:a1c14c6d9282

File content as of revision 34:3066686d5152:

/**
 * @file    main.h
 * @brief   Main header file for includes and whatnot 
 *          for the other project files.
 * @author  John Wilkey
 * @author  Alec Guertin
 * @author  Chester Chu
 */
 
#ifndef _MAIN_H
#define _MAIN_H

#include "mbed.h"
#include "m3pi.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#define TURN_SPEED  0.15
#define DRIVE_SPEED 0.25
#define ERR_SUCCESS 0
#define ERR_FAILURE 1
#define DRIVE_RATE  1/50
#define TIME_FACT 1780
#define CAL_SPEED .25
#define CLOSE_ENOUGH .0008

/** @brief Move the robot from its current position to (x,y) */
void move(int x, int y, int draw);

/**
 * @brief get values of next PostScript instruction.
 *
 * @param       buf     Buffer with PS instructions.
 * @param       x       Pointer to storage for x coordinate.
 * @param       y       Pointer to storage for y coordinate.
 * @param       draw    Pointer to storage for draw/move boolean.
 * 
 * @return              Success or failure code.
 */
int retrieve_inst(char *buf, int *x, int *y, int *draw);

/**
 * @brief Driver forward for a time.
 *
 * @param[in]   amt     Amount to drive forward. In milliseconds.
 */
void forward(int amt);

/**
 * @brief Drive backward for a time.
 *
 * @param[in]   amt     Amount to drive backward. In milliseconds.
 */
void backward(int amt);

/**
 * @brief Turn right by some angle.
 *
 * @param[in]   deg     Desired final turn angle in degrees from start.
 *                      Note that a negative angle will turn in the opposite
 *                      direction.
 */
void right(float deg);

/**
 * @brief Turn left by some angle.
 *
 * @param[in]   deg     Desired final turn angle in degrees from start.
 *                      Note that a negative angle will turn in the opposite
 *                      direction.
 */
void left (float deg);

/**
 * @brief   Wait for a number of seconds, possibly fractional.
 * 
 * Timer resolution is on the order of microseconds. A negative wait
 * time does nothing. 
 *
 * @param[in]   amt     Time to wait, in seconds.
 */
void timerWait(float amt);
#endif