Sooner Competitive Robotics / Mbed 2 deprecated IEEE_14_Freescale

Dependencies:   mbed

Fork of IEEE_14_Freescale by IEEE 2014 Mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers absMotorControl.h Source File

absMotorControl.h

00001 #ifndef __ABSMOTORCONTROL_H__
00002 #define __ABSMOTORCONTROL_H__
00003 
00004 #include "mbed.h"
00005 #include "dbgprint.h"
00006 #include "absMotors.h"
00007 
00008 class absMotorControl{
00009 private:
00010     absMotors &motors;
00011     int leftSpeed;
00012     int rightSpeed;
00013     int maxLeftSpeed;
00014     int maxRightSpeed;
00015     int leftDest;
00016     int rightDest;
00017     int leftTicks;
00018     int rightTicks;
00019     int leftFalloffDist;
00020     int rightFalloffDist;
00021     int updateCount;
00022     char limited;
00023     Ticker motorKeeper;
00024     void updateMotors();
00025     int slowMode;
00026 public:
00027     absMotorControl(absMotors &motorsIn);
00028     //direct setting of speed, dangerous
00029     void setSpeed(int left, int right);
00030     //ramps each motor separately to given destinations
00031     void setDest(int left, int right);
00032     //ramps each motor to a set speed
00033     void rampSpeed(int left,int right);
00034     //sets max speed for each motor
00035     void setMaxSpeed(int newLeftMax, int newRightMax);
00036     // start and stop the ticker that runs this controller
00037     void start();
00038     void stop();
00039     //returns true if the robot has stopped moving, so it's safe to stop the controller
00040     int stopped();
00041     //returns true when the speeds are equal to the maximums
00042     int steady();
00043     //reset the counters on distance traveled
00044     void resetTicks();
00045     int avgTicks();
00046     void setSlowMode(int factor);
00047 };
00048 
00049 #endif