-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobileplatform.h
56 lines (46 loc) · 1.29 KB
/
mobileplatform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef MOBILEPLATFORM_H
#define MOBILEPLATFORM_H
#include <QObject>
#include <sstream>
#include <string>
#include <QApplication>
#include "dcmotor.h"
#include "linesensor.h"
class MobilePlatform : public QObject
{
Q_OBJECT
public:
explicit MobilePlatform(QObject *parent = 0);
signals:
void sgnLogMsg(const QString& msg);
void sgnFollowing(bool bTriggered);
public slots:
void moveForward();
void moveBackward();
void turnLeft();
void turnRight();
void stopMotion();
void startLineFollowing();
void initializeGPIO();
void setReductionFactor(double dbFactor);
void setPWM(int spnbxValue);
private:
void followLine();
static const int s_nMotorLeftPin1 = 10;
static const int s_nMotorLeftPin2 = 11;
static const int s_nMotorLeftPinPWM = 6;
static const int s_nMotorRightPin1 = 2;
static const int s_nMotorRightPin2 = 3;
static const int s_nMotorRightPinPWM = 0;
static const int s_nLineSensorRight = 27;
static const int s_nLineSensorLeft = 28;
int m_nLastCmdSpeedRight;
int m_nLastCmdSpeedLeft;
bool m_bFollowing;
double m_fReductionFactor;
DCMotor m_MotorLeft;
DCMotor m_MotorRight;
LineSensor m_LineSensorLeft;
LineSensor m_LineSensorRight;
};
#endif // MOBILEPLATFORM_H