2017-06-06 19:20:12 +00:00
|
|
|
/*
|
|
|
|
* PURPOSE: (DifferentialDriveController class)
|
|
|
|
*/
|
2016-02-18 22:14:44 +00:00
|
|
|
#ifndef DIFFERENTIAL_DRIVE_CONTROLER_HH
|
|
|
|
#define DIFFERENTIAL_DRIVE_CONTROLER_HH
|
|
|
|
|
|
|
|
#include "Motor/include/motorSpeedController.hh"
|
2020-07-09 19:08:40 +00:00
|
|
|
#include "Control/include/PIDController.hh"
|
2016-02-18 22:14:44 +00:00
|
|
|
|
|
|
|
class DifferentialDriveController {
|
|
|
|
|
|
|
|
public:
|
|
|
|
DifferentialDriveController( double distanceBetweenWheels,
|
|
|
|
double wheelRadius,
|
|
|
|
double wheelSpeedLimit,
|
|
|
|
double headingRateLimit,
|
|
|
|
double slowDownDistance,
|
|
|
|
MotorSpeedController& rightMotorController,
|
|
|
|
MotorSpeedController& leftMotorController
|
|
|
|
);
|
|
|
|
|
|
|
|
int update( double distance_err,
|
|
|
|
double heading_err);
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Do not allow the default constructor to be used.
|
|
|
|
DifferentialDriveController();
|
|
|
|
|
|
|
|
double distanceBetweenWheels;
|
|
|
|
double wheelRadius;
|
|
|
|
double wheelSpeedLimit;
|
|
|
|
double headingRateLimit;
|
|
|
|
double slowDownDistance;
|
|
|
|
|
|
|
|
MotorSpeedController& rightMotorController;
|
|
|
|
MotorSpeedController& leftMotorController;
|
|
|
|
|
|
|
|
double rightMotorSpeedCommand;
|
|
|
|
double leftMotorSpeedCommand;
|
|
|
|
double desiredHeadingRate;
|
|
|
|
double desiredRangeRate;
|
2020-07-09 19:08:40 +00:00
|
|
|
|
|
|
|
// PID Controller
|
|
|
|
PIDController headingctrl;
|
|
|
|
PIDController wheelspeedctrl;
|
2016-02-18 22:14:44 +00:00
|
|
|
};
|
|
|
|
#endif
|