Class DdsNlpConfigSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsNlpConfigSubscriber : public QObject

Subscriber for DDS type fkin::NlpConfig as a QML element.

This class is a QML element and enables QML applications to gain access to a DDS signal type as a read-only QML property.

Public Functions

explicit DdsNlpConfigSubscriber(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsNlpConfigSubscriber()

Destructor.

QString technique() const

Property accessor for technique in QML.

Returns

Discretization technique.

QString solver() const

Property accessor for solver in QML.

Returns

Name of NLP solver.

int degree() const

Property accessor for polynomial degree in QML.

Returns

degree.

double horizon() const

Property accessor for horizon [s] in QML.

Returns

Horizon.

unsigned int elements() const

Property accessor for number of discretization elements [-] in QML.

Returns

Elements.

unsigned int nx() const

Property accessor for number of decision variables in QML.

Returns

Number of x in NLP.

unsigned int np() const

Property accessor for number of parameters in QML.

Returns

Number of p in NLP.

unsigned int ng() const

Property accessor for number of constraints in QML.

Returns

Number of g in NLP.

QDateTime timestamp() const

Property accessor for timestamp in QML.

Returns

Timestamp as QML compatible type.

void init(QtToDds *dds, const QString &topic, const QString &id, bool with_listener = true)

Initializes DDS reader and connects Qt signals and slots.

Parameters
  • dds[in] Pointer to QtToDds instance.

  • topic[in] Name of DDS topic for which to subscribe.

  • id[in] Key identifier for the topic instance.

  • with_listener[in] Use DdsReaderListener callback to trigger eventHeard() signal.

Public Slots

void updateValues()

Takes all new samples from the subscribed topic and uses the last sample.

This slot calls take() from the DDS reader and stores the last new sample as the current value. If there were a new sample it emits valueChanged().

Signals

void techniqueChanged(QString technique)

A new sample has arrived.

This signal is connected to technique QML property.

Parameters

technique[out] New value.

void solverChanged(QString solver)

A new sample has arrived.

This signal is connected to solver QML property.

Parameters

solver[out] New value.

void degreeChanged(int degree)

A new sample has arrived.

This signal is connected to degree QML property.

Parameters

degree[out] New value.

void horizonChanged(double horizon)

A new sample has arrived.

This signal is connected to horizon QML property.

Parameters

horizon[out] New value.

void elementsChanged(unsigned int elements)

A new sample has arrived.

This signal is connected to elements QML property.

Parameters

elements[out] New value.

void nxChanged(unsigned int nx)

A new sample has arrived.

This signal is connected to nx QML property.

Parameters

nx[out] New value.

void npChanged(unsigned int np)

A new sample has arrived.

This signal is connected to np QML property.

Parameters

np[out] New value.

void ngChanged(unsigned int ng)

A new sample has arrived.

This signal is connected to ng QML property.

Parameters

ng[out] New value.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

This signal is connected to the QML DdsNlpConfigSubscriber::timestamp property.

Parameters

timestamp[out] New timestamp value.

void eventHeard()

DdsReaderListener calls this signal when there is data available on the subscribed topic.

If DdsIdVec1dSubscriber is initialized with_listener=true, eventHeard() will be connected to the slot updateValue().

Properties

QString technique
QString solver
int degree
double horizon
unsigned int elements
unsigned int nx
unsigned int np
unsigned int ng
QDateTime timestamp

Timestamp of sample.

Private Members

std::unique_ptr<sinspekto::Reader<fkin::NlpConfig>> m_reader

The DDS reader wrapper class.

QString m_id

Key identifier for topic instance.