Class DdsKinematics2DPublisher

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsKinematics2DPublisher : public QObject

Publisher for DDS type Kinematics2D as a QML element.

This class is a QML element and enables QML applications to publish a DDS signal type from a writable QML property.

Public Functions

explicit DdsKinematics2DPublisher(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsKinematics2DPublisher()

Destructor.

QVector2D position() const

Property accessor for position in QML.

Returns

Value as QML compatible vector.

double speed() const

Property accessor for speed in QML.

Returns

Value as QML double.

double course() const

Property accessor for course in QML.

Returns

Value as QML double.

void init(QtToDds *dds, const QString &topic, const QString &id)

Initializes DDS writer and sets initial value.

Parameters
  • dds[in] Pointer to QtToDds instance.

  • topic[in] Name of DDS topic to publish.

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

Public Slots

void setPosition(QVector2D position)

Write function for the QML property, does not publish value on DDS.

This slot updates the DDS sample with the new position. It emits a positionChanged().

Note

It only emits a signal if the QML property value has changed!

Note

This function does not publish the DDS sample. sendSample() must be called.

Parameters

position[in] New vector value.

void setSpeed(double speed)

Write function for the QML property, does not publish value on DDS.

This slot updates the DDS sample with the new speed. It emits a speedChanged().

Note

It only emits a signal if the QML property value has changed!

Note

This function does not publish the DDS sample. sendSample() must be called.

Parameters

speed[in] New speed value.

void setCourse(double course)

Write function for the QML property, does not publish value on DDS.

This slot updates the DDS sample with the new course. It emits a courseChanged().

Note

It only emits a signal if the QML property value has changed!

Note

This function does not publish the DDS sample. sendSample() must be called.

Parameters

course[in] New course value.

void publish()

Publishes the sample value on DDS.

The currently stored sample is sent over DDS. Typically setPosition(), setSpeed(), and setCourse() are called before sending the sample.

Signals

void positionChanged(QVector2D position)

DDS Kinematics2D’s position has changed.

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

Parameters

position[out] New 2d position.

void speedChanged(double speed)

DDS Kinematics2D’s speed has changed.

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

Parameters

speed[out] New speed.

void courseChanged(double course)

DDS Kinematics2D’s course has changed.

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

Parameters

course[out] New course.

Properties

QVector2D position

2D position as QVector2D QML property.

double speed

Speed of vehicle as double.

double course

Course of vehicle as double.

Private Members

std::unique_ptr<sinspekto::Writer<fkin::Kinematics2D>> m_writer

The DDS writer wrapper class.