trikRuntime
objectSensor.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/QThread>
18 #include <QtCore/QScopedPointer>
19 
20 #include "objectSensorInterface.h"
21 #include "deviceState.h"
22 
23 namespace trikKernel {
24 class Configurer;
25 }
26 
27 namespace trikHal {
28 class HardwareAbstractionInterface;
29 }
30 
31 namespace trikControl {
32 
33 class ObjectSensorWorker;
34 
37 {
38  Q_OBJECT
39 
40 public:
44  ObjectSensor(const QString &port, const trikKernel::Configurer &configurer
45  , trikHal::HardwareAbstractionInterface &hardwareAbstraction);
46 
47  ~ObjectSensor() override;
48 
49  Status status() const override;
50 
51 public slots:
52  void init(bool showOnDisplay) override;
53 
54  void detect() override;
55 
56  QVector<int> read() override;
57 
58  void stop() override;
59 
60  QVector<int> getDetectParameters() const override;
61 
62 private slots:
63  void onStopped();
64 
65 private:
67  DeviceState mState;
68 
70  QScopedPointer<ObjectSensorWorker> mObjectSensorWorker;
71 
73  QThread mWorkerThread;
74 };
75 
76 }
Implementation of object sensor for real robot.
Definition: objectSensor.h:36
Definition: analogSensor.h:23
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
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
Uses virtual line sensor to detect x coordinate of a center of an object that was in camera&#39;s field o...
Definition: objectSensorInterface.h:28
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29