Class DdsKinematics2DSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsKinematics2DSubscriber : public QObject

Subscriber for DDS type Kinematics2D 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 DdsKinematics2DSubscriber(QObject *parent = nullptr)


The initialization is deferred to an init() function.


parent[in] QObject pointer.

virtual ~DdsKinematics2DSubscriber()


QVector2D position() const

Property accessor for position in QML.


Value as QML compatible vector.

double speed() const

Property accessor for speed in QML.


Value as QML double.

double course() const

Property accessor for course in QML.


Value as QML double.

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 Real value. If there were a new sample it emits {position, speed, course, timestamp}Changed().


void positionChanged(QVector2D position)

DDS Kinematics2D’s position has changed.

This signal is connected to the QML DdsKinematics2DSubscriber::position property.


position[out] New 2d position.

void speedChanged(double speed)

DDS Kinematics2D’s speed has changed.

This signal is connected to the QML DdsKinematics2DSubscriber::speed property.


speed[out] New speed.

void courseChanged(double course)

DDS Kinematics2D’s course has changed.

This signal is connected to the QML DdsKinematics2DSubscriber::course property.


course[out] New course.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

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


timestamp[out] New timestamp value.

void eventHeard()

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

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


QVector2D position

2D position as QVector2D QML property.

double speed

Speed of vehicle as double.

double course

Course of vehicle as double.

QDateTime timestamp

Timestamp of sample.

Private Members

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

The DDS reader wrapper class.

QString m_id

Key identifier for topic instance.