-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlsystem.cpp
28 lines (24 loc) · 1.34 KB
/
controlsystem.cpp
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
#include "controlsystem.h"
ControlSystem::ControlSystem(QObject *parent) :
QObject(parent)
,m_pMobilePlatform(new MobilePlatform())
,m_pMainWindow(new MainWindow())
{
QObject::connect(m_pMainWindow,SIGNAL(sgnForward()),m_pMobilePlatform,SLOT(moveForward()));
QObject::connect(m_pMainWindow,SIGNAL(sgnBackward()),m_pMobilePlatform,SLOT(moveBackward()));
QObject::connect(m_pMainWindow,SIGNAL(sgnRight()),m_pMobilePlatform,SLOT(turnRight()));
QObject::connect(m_pMainWindow,SIGNAL(sgnLeft()),m_pMobilePlatform,SLOT(turnLeft()));
QObject::connect(m_pMainWindow,SIGNAL(sgnStop()),m_pMobilePlatform,SLOT(stopMotion()));
QObject::connect(m_pMainWindow,SIGNAL(sgnSpeedValueChanged(int)),m_pMobilePlatform,SLOT(setPWM(int)));
QObject::connect(m_pMainWindow,SIGNAL(sgnReductionValueChanged(double)),m_pMobilePlatform,SLOT(setReductionFactor(double)));
QObject::connect(m_pMainWindow,SIGNAL(sgnLine()),m_pMobilePlatform,SLOT(startLineFollowing()));
QObject::connect(m_pMobilePlatform,SIGNAL(sgnFollowing(bool)),m_pMainWindow,SLOT(logLineResponse(bool)));
QObject::connect(m_pMobilePlatform,SIGNAL(sgnLogMsg(QString)),m_pMainWindow,SLOT(logMessage(QString)));
m_pMobilePlatform->initializeGPIO();
m_pMainWindow->emitStandardValues();
}
ControlSystem::~ControlSystem()
{
delete m_pMobilePlatform;
delete m_pMainWindow;
}