trikRuntime
lineSensor.h
Go to the documentation of this file.
1 /* Copyright 2014 - 2015 CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/QObject>
18 #include <QtCore/QString>
19 #include <QtCore/QThread>
20 #include <QtCore/QScopedPointer>
21 #include <QtCore/QVector>
22 
23 #include "lineSensorInterface.h"
24 #include "deviceState.h"
25 
26 namespace trikKernel {
27 class Configurer;
28 }
29 
30 namespace trikHal {
31 class HardwareAbstractionInterface;
32 }
33 
34 namespace trikControl {
35 
36 class LineSensorWorker;
37 
40 {
41  Q_OBJECT
42 
43 public:
47  LineSensor(const QString &port, const trikKernel::Configurer &configurer
48  , trikHal::HardwareAbstractionInterface &hardwareAbstraction);
49 
50  ~LineSensor() override;
51 
52  Status status() const override;
53 
54 public slots:
55  void init(bool showOnDisplay) override;
56 
57  void detect() override;
58 
59  QVector<int> read() override;
60 
61  void stop() override;
62 
63  QVector<int> getDetectParameters() const override;
64 
65 private slots:
66  void onStopped();
67 
68 private:
70  DeviceState mState;
71 
73  QScopedPointer<LineSensorWorker> mLineSensorWorker;
74 
76  QThread mWorkerThread;
77 };
78 
79 }
Definition: analogSensor.h:23
Uses virtual line sensor to detect x coordinate of a center of an object that was in camera&#39;s field o...
Definition: lineSensorInterface.h:29
Generic configuration helper, parses configuration XML files and presents configuration as a set of a...
Definition: configurer.h:28
static const int port
Definition: trikCommunicatorTest.cpp:24
Implementation of virtual line sensor for real robot.
Definition: lineSensor.h:39
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
Definition: brickFactory.h:21
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29