Program Listing for File DdsKinematics6D.hpp¶
↰ Return to documentation for file (sinspekto/DdsKinematics6D.hpp
)
#pragma once
#include "sinspekto/QtToDds.hpp"
#include "QDateTime"
#include "QVector3D"
class DdsKinematics6DSubscriber : public QObject
{
Q_OBJECT
Q_PROPERTY(QVector3D position READ position NOTIFY positionChanged)
Q_PROPERTY(QVector3D velocity READ velocity NOTIFY velocityChanged)
Q_PROPERTY(QVector3D euler READ euler NOTIFY eulerChanged)
Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged)
public:
explicit DdsKinematics6DSubscriber(QObject *parent = nullptr);
virtual ~DdsKinematics6DSubscriber();
QVector3D position() const;
QVector3D velocity() const;
QVector3D euler() const;
QDateTime timestamp() const;
Q_INVOKABLE void init(
QtToDds* dds,
const QString& topic,
const QString& id,
bool with_listener=true);
signals:
void positionChanged(QVector3D position);
void velocityChanged(QVector3D velocity);
void eulerChanged(QVector3D euler);
void timestampChanged(QDateTime timestamp);
void eventHeard();
public slots:
void updateValues();
private:
std::unique_ptr<sinspekto::Reader<fkin::Kinematics6D>> m_reader;
QString m_id;
};
class DdsKinematics6DPublisher : public QObject
{
Q_OBJECT
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(QVector3D velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
Q_PROPERTY(QVector3D euler READ euler WRITE setEuler NOTIFY eulerChanged)
public:
explicit DdsKinematics6DPublisher(QObject *parent = nullptr);
virtual ~DdsKinematics6DPublisher();
QVector3D position() const;
QVector3D velocity() const;
QVector3D euler() const;
Q_INVOKABLE void init(
QtToDds* dds,
const QString& topic,
const QString& id);
signals:
void positionChanged(QVector3D position);
void velocityChanged(QVector3D velocity);
void eulerChanged(QVector3D euler);
public slots:
void setPosition(QVector3D position);
void setVelocity(QVector3D velocity);
void setEuler(QVector3D euler);
void publish();
private:
std::unique_ptr<sinspekto::Writer<fkin::Kinematics6D>> m_writer;
};