trikRuntime
|
Worker object that processes line sensor output and updates stored reading. More...
#include <lineSensorWorker.h>
Public Slots | |
void | init (bool showOnDisplay) |
Initializes a camera. More... | |
void | detect () |
Detects the color of an object in center of current frame and memorizes it. More... | |
QVector< int > | read () |
Returns current raw x coordinate of detected object. More... | |
QVector< int > | getDetectParameters () const |
Get values returned by last "detect" operation. More... | |
Public Slots inherited from trikControl::AbstractVirtualSensorWorker | |
virtual void | stop () |
Stops detection until init() will be called again. More... | |
Public Member Functions | |
LineSensorWorker (const QString &script, const QString &inputFile, const QString &outputFile, qreal toleranceFactor, DeviceState &state, trikHal::HardwareAbstractionInterface &hardwareAbstraction) | |
Constructor. More... | |
~LineSensorWorker () override | |
Public Member Functions inherited from trikControl::AbstractVirtualSensorWorker | |
AbstractVirtualSensorWorker (const QString &script, const QString &inputFile, const QString &outputFile, DeviceState &state, trikHal::HardwareAbstractionInterface &hardwareAbstraction) | |
Constructor. More... | |
~AbstractVirtualSensorWorker () override | |
Status | status () const override |
Returns current status of the device. More... | |
Public Member Functions inherited from trikControl::DeviceInterface | |
DeviceInterface ()=default | |
virtual | ~DeviceInterface ()=default |
Additional Inherited Members | |
Public Types inherited from trikControl::DeviceInterface | |
enum | Status { Status::permanentFailure, Status::temporaryFailure, Status::off, Status::starting, Status::ready, Status::stopping } |
Device status. More... | |
Signals inherited from trikControl::AbstractVirtualSensorWorker | |
void | stopped () |
Emitted when sensor is stopped successfully. More... | |
Static Public Member Functions inherited from trikControl::DeviceInterface | |
static Status | combine (const DeviceInterface &underlying, const DeviceInterface::Status &dependent) |
Helper method to return status of a device relying on other device to work. More... | |
Protected Member Functions inherited from trikControl::AbstractVirtualSensorWorker | |
void | init () |
Launch sensor. More... | |
void | sendCommand (const QString &command) |
If sensor is ready, sends a command to its input FIFO, otherwise queues this command and sends it later. More... | |
Worker object that processes line sensor output and updates stored reading.
Meant to be executed in separate thread.
LineSensorWorker::LineSensorWorker | ( | const QString & | script, |
const QString & | inputFile, | ||
const QString & | outputFile, | ||
qreal | toleranceFactor, | ||
DeviceState & | state, | ||
trikHal::HardwareAbstractionInterface & | hardwareAbstraction | ||
) |
Constructor.
script | - file name of a scrit used to start or stop a sensor. |
inputFile | - sensor input fifo. Note that we will write data here, not read it. |
outputFile | - sensor output fifo. Note that we will read sensor data from here. |
toleranceFactor | - a value on which hueTolerance, saturationTolerance and valueTolerance is multiplied after "detect" command. Higher values allow to count more points on an image as tracked object. |
|
override |
|
slot |
Detects the color of an object in center of current frame and memorizes it.
|
slot |
Get values returned by last "detect" operation.
Returned vector has 6 components - hue, saturation and value of a dominant color (got by "detect") and hue, saturation and value tolerance factors.
|
slot |
Initializes a camera.
showOnDisplay | - true if we want an image from a camera to be drawn on robot display. |
|
slot |
Returns current raw x coordinate of detected object.
Sensor returns 0 if detect() was not called. Can be accessed directly from other thread.