EEEN21000
GROUP 30 Line Following Buggy
Loading...
Searching...
No Matches
wheelcontrol.h
Go to the documentation of this file.
1#ifndef WHEEL_CONTROL_H
2#define WHEEL_CONTROL_H
3
4#include "debug1.h"
5#include "mbed.h"
6#include "PID.h"
7#include <utility>
8#include <vector>
9
11#define ENCODER_LIMIT 4000.0f
13typedef pair<int, float> pif;
14
19 private:
22
25
28
30 float m_target;
31
33 void m_setSetPoint(float left_val, float right_val);
35 void m_setProcessValue(float left_val, float right_val);
36
37 public:
44
52 void setSpeedController(float Kc, float tauI, float tauD);
53
61 void setLineController(float Kc, float tauI, float tauD);
62
69 void setLineLimits(float low, float high);
70
77 void setPWMLimits(float low, float high);
78
83 void setTargetSpeed(float speed);
84
86 void reset();
87
96 vector<pif> computeSpeed(float position, const Encoder &left_encoder, const Encoder &right_encoder);
97};
98
99#endif // WHEEL_CONTROL_H
Encoder class with helper functions, derived from QEI.
Definition: encoder.h:28
Proportional-integral-derivative controller.
Definition: PID.h:57
Controller class to handle speed and steering of the buggy.
Definition: wheelcontrol.h:18
void m_setProcessValue(float left_val, float right_val)
Set process value for left controller and right controller.
void setTargetSpeed(float speed)
Set the target speed in m/s.
PID m_linecontroller
PID controller for line position.
Definition: wheelcontrol.h:27
vector< pif > computeSpeed(float position, const Encoder &left_encoder, const Encoder &right_encoder)
Compute the speed in pps for the left and right motors.
void setSpeedController(float Kc, float tauI, float tauD)
Set the speed controller tuning parameters.
PID m_rightcontroller
PID controller for right speed.
Definition: wheelcontrol.h:24
void setLineController(float Kc, float tauI, float tauD)
Set the line controller tuning parameters.
float m_target
PID output for line controller.
Definition: wheelcontrol.h:30
void m_setSetPoint(float left_val, float right_val)
Set setpoint for left controller and right controller.
void reset()
Reset the PID controllers to initial state.
void setPWMLimits(float low, float high)
Set the PWM controller output limits.
PID m_leftcontroller
PID controller for left speed.
Definition: wheelcontrol.h:21
void setLineLimits(float low, float high)
Set the line controller input limits.
WheelControl()
Constructor.
pair< int, float > pif
Pair<int,float> as pair<direction,PWMOut>.
Definition: wheelcontrol.h:13