Class DdsKinematics6DSubscriber

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsKinematics6DSubscriber : public QObject

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

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsKinematics6DSubscriber()

Destructor.

QVector3D position() const

Property accessor for position in QML.

Returns

Value as QML compatible vector.

QVector3D velocity() const

Property accessor for velocity in QML.

Returns

Value as QML compatible vector.

QVector3D euler() const

Property accessor for euler angles in QML.

Returns

Value as QML compatible vector.

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

Signals

void positionChanged(QVector3D position)

DDS Kinematics6D’s position has changed.

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

Parameters

position[out] New 3d position.

void velocityChanged(QVector3D velocity)

DDS Kinematics6D’s velocity has changed.

This signal is connected to the QML DdsKinematics6DSubscriber::velocity property.

Parameters

velocity[out] New 3d velocity.

void eulerChanged(QVector3D euler)

DDS Kinematics6D’s euler angle has changed.

This signal is connected to the QML DdsKinematics6DSubscriber::euler property.

Parameters

euler[out] New euler angles.

void timestampChanged(QDateTime timestamp)

Timestamp of DDS value has changed.

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

Parameters

timestamp[out] New timestamp value.

void eventHeard()

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

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

Properties

QVector3D position

3D position as QVector3D QML property.

QVector3D velocity

3D velocity as QVector3D QML property.

QVector3D euler

3D euler angles as QVector3D QML property.

QDateTime timestamp

Timestamp of sample.

Private Members

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

The DDS reader wrapper class.

QString m_id

Key identifier for topic instance.