Main repository for dump truck API development in Spring 2017

Dependencies:   Tracker mbed MotorV2 SRF05 nRF24L01P

Fork of DUMP_TRUCK_TEST_V1 by Terrabots

Activities

This Week

If needed, please contact Milo Pan at mpan9@gatech.edu for rights and access to this repository.

DumpTruck.h

Committer:
simplyellow
Date:
2017-02-28
Revision:
10:cf77da9be0b8
Parent:
8:9c94865bd087
Child:
12:502cf4fc6d98

File content as of revision 10:cf77da9be0b8:

/**
*   @file   DumpTruck.h
*
*   @brief  DumpTruck class integrates multiple sensors into one API.
*
*   @author Terrabots Team
*
*/

#ifndef MBED_DUMP_TRUCK_H
#define MBED_DUMP_TRUCK_H

#include "mbed.h"
#include "Tracker.h"
//#include "IMU.h"
#include "Motor.h"
//#include "Transceiver.h"
#include "SRF05.h"

// ADD SWITCHES & ULTRASONIC SENSOR implementation

/**
*   @class DumpTruck
*
*   @brief  Interface for controlling a Dump truck.
*/

class DumpTruck {
public:
    /**
    *   Constructor for the Tracker object.
    *
    *   @param[in]  truckId     The dump truck's identifier
    */
    DumpTruck(int truckId);

    // motor functions
    /*
    *   Drive a certain distance at a desired speed.
    */
    void driveDistance(float speed, float distance);// frontMotor
    /*
    *   Drive at a desired speed.
    */
    void drive(float speed);
    /*
    *   Turn the rear wheels a certain angle.
    */
    void turn(float angle);                 // turnMotor
    /*
    *   Move the dump truck's bed up/down a certain angle.
    */
    void moveBed(bool raise, float angle);  // bedMotor
    /*
    *   Stop driving.
    */
    void stop();                            // all Motors

    // ultrasonic functions
    /*
    *   Read from the ultrasonic sensor and determine the dump truck's
    *   proximity from objects.
    */
    bool detect();                          // returns bool for object too close


protected:
    Tracker *track;
    //IMU *bed;
    Motor *frontMotor;
    Motor *turnMotor;
    Motor *bedMotor;
    //Transceiver *nrf;
    SRF05 *srf;

    // add direct control for motor, switch, and ultrasonic sensor.

    int truckNumber;

    // motor variables
    float speed;                            // drive
    float distance;                         // drive
    float potAngle;                         // turn
    float bedAngle;                         // bed

    // bed-specific variables
    bool switchState;   // BusIn the two limit switches

    // ultrasonic-specific variables
    bool tooClose;
    float proximity;
};
#endif