Class DdsOptiStatsSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsOptiStatsSubscriber : public QObject

Subscriber for DDS type fkin::OptiStats 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 DdsOptiStatsSubscriber(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsOptiStatsSubscriber()

Destructor.

unsigned int iterations() const

Property accessor for number of iterations to solve NLP [-] in QML.

Returns

Iteration count.

bool status() const

Property accessor for status of NLP solve in QML.

Returns

status.

QString status_text() const

Property accessor for status_text in QML.

Returns

Status text for NLP.

double obj() const

Property accessor for NLP objective function in QML.

Returns

objective.

double solve_time() const

Property accessor for wall clock solve time [s] for NLP in QML.

Returns

solve time.

std::vector<double> p() const

Property accessor for NLP parameter vector in QML.

Returns

parameters.

std::vector<double> x0() const

Property accessor for NLP state initial condition vector in QML.

Returns

initial condition x0.

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 various <..>Changed().

Signals

void iterationsChanged(unsigned long iterations)

A new sample has arrived.

This signal is connected to iterations QML property.

Parameters

iterations[out] New value.

void statusChanged(bool status)

A new sample has arrived.

This signal is connected to status QML property.

Parameters

status[out] New value.

void status_textChanged(QString status_text)

A new sample has arrived.

This signal is connected to technique QML property.

Parameters

status_text[out] New value.

void objChanged(double objective)

A new sample has arrived.

This signal is connected to obj QML property.

Parameters

objective[out] New value.

void solve_timeChanged(double solve_time)

A new sample has arrived.

This signal is connected to solve_time QML property.

Parameters

solve_time[out] New value.

void pChanged(std::vector<double> parameters)

A new sample has arrived.

This signal is connected to p QML property.

Parameters

parameters[out] New value.

void x0Changed(std::vector<double> x0)

A new sample has arrived.

This signal is connected to x0 QML property.

Parameters

x0[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

unsigned int iterations
bool status
QString status_text
double obj
double solve_time
std::vector<double> p
std::vector<double> x0
QDateTime timestamp

Timestamp of sample.

Private Members

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

The DDS reader wrapper class.

QString m_id

Key identifier for topic instance.