Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LSM9DS1_Library2 MotorV2 SRF05 Tracker2 mbed nRF24L01P
Fork of DUMP_TRUCK_SPR2017 by
Revision 9:5a35e2a28a47, committed 2017-02-23
- Comitter:
- simplyellow
- Date:
- Thu Feb 23 20:01:28 2017 +0000
- Parent:
- 5:dc4cf6cc24b3
- Commit message:
- cleaned dumptruck.h
Changed in this revision
| DumpTruck.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DumpTruck.h Tue Feb 07 21:01:20 2017 +0000
+++ b/DumpTruck.h Thu Feb 23 20:01:28 2017 +0000
@@ -1,40 +1,51 @@
#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"
+
+// ADD SWITCHES & ULTRASONIC SENSOR implementation
class DumpTruck {
public:
DumpTruck(int truckId);
- void drive(); // Drive DC motors with a desired motor speed and distance
- void stop();
- void Calibrate();
- //void RotateTo();
- //void BedDown();
- //void BedUp();
- //void raiseTo();
- //void LowerBed();
-
-
+
+ // motor functions
+ void drive(float speed, float distance);// frontMotor
+ void turn(float angle); // turnMotor
+ void moveBed(bool raise, float angle); // bedMotor
+ void stop(); // all Motors
+
+ // ultrasonic functions
+ bool detect(); // returns bool for object too close
+
+
protected:
+ Tracker *track;
+ IMU *bed;
+ Motor *frontMotor;
+ Motor *turnMotor;
+ Motor *bedMotor;
+ Transceiver *nrf;
+
+ // add direct control for motor, switch, and ultrasonic sensor.
+
int truckNumber;
- float speed; // desired speed to drive the robot, a number between -1 and 1
- float distance;
- float getDistance(); // input of desired distance to be traveled
- float setTruckSpeed(); // set truck speed
- float setTruckDistance(); // set distance to be traveled
- //getBedAngle(); //Get data from Bed potentiometer, Hari is looking into the component for this
- //getPivotAngle(double PivotAngle); //Get data from potentiometer
- //SetPivotSpeed(double PivotSpeed); //Set arbitrary rotation of servo motor
- //SetBedSpeed(); //Set arbitrary rotation of DC Motor
- //bool GetBedUpperSwitch(); //Checks if bed is all the way up
- //bool GetBedLowerSwitch(); //Checks if bed is all the way down
- //bool SwitchState; //Switch state variable for Up and down bed functions
- //float DesiredPivotAngle; // User Input of desired angle for the bed to be pivoted
- //float DesiredBedAngle; //User Input of desired bed angle to be raised.
- //float BedSpeed; //User input of desired speed for the dump truck's bed to rotate
- //float PivotSpeed; //User input of desired speed for the dump truck to pivot its back at
-
- //bool isCalibrated;// returns 0 and 1 to check if the robot has been calibrated
+
+ // 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
