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)


The initialization is deferred to an init() function.


parent[in] QObject pointer.

virtual ~DdsOptiStatsSubscriber()


unsigned int iterations() const

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


Iteration count.

bool status() const

Property accessor for status of NLP solve in QML.



QString status_text() const

Property accessor for status_text in QML.


Status text for NLP.

double obj() const

Property accessor for NLP objective function in QML.



double solve_time() const

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


solve time.

std::vector<double> p() const

Property accessor for NLP parameter vector in QML.



std::vector<double> x0() const

Property accessor for NLP state initial condition vector in QML.


initial condition x0.

QDateTime timestamp() const

Property accessor for timestamp in QML.


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.

  • 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().


void iterationsChanged(unsigned long iterations)

A new sample has arrived.

This signal is connected to iterations QML property.


iterations[out] New value.

void statusChanged(bool status)

A new sample has arrived.

This signal is connected to status QML property.


status[out] New value.

void status_textChanged(QString status_text)

A new sample has arrived.

This signal is connected to technique QML property.


status_text[out] New value.

void objChanged(double objective)

A new sample has arrived.

This signal is connected to obj QML property.


objective[out] New value.

void solve_timeChanged(double solve_time)

A new sample has arrived.

This signal is connected to solve_time QML property.


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[out] New value.

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

A new sample has arrived.

This signal is connected to x0 QML property.


x0[out] New value.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

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


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


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.