#pragma once #include "messagebasic.h" /// /// 指定航路机动模式 /// enum class NavigateDriveMode { Cruise, // 巡航模式,长途奔袭模式 FullSpeed,// 全速模式,战斗机动 ReachStop, // 停驻模式 }; /// /// 依照指定名称路径机动 /// struct MESSAGEBASIC_EXPORT NavigateWithRoute : public AbstractMessage { QString _route_name; // 规划航线名称 NavigateDriveMode _drive_mode; // 驱动模式 NavigateWithRoute(); // Serializable void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; }; /// /// 平台机动命令,机体坐标系:主轴为Y,向右为X,向上为Z /// struct MESSAGEBASIC_EXPORT PlatformMotionCommand : public AbstractMessage { PlatformMotionCommand(const QString &nm); /// /// 机动起始时间 /// /// virtual double startTimepoint() const = 0; /// /// 消耗时间 /// /// virtual double timeExpend() const = 0; /// /// 指定时间点的相对位置 /// /// /// 机体坐标系 virtual QVector3D posAtTimespan(double time) const = 0; /// /// 指定时间点的速度矢量 /// /// /// 机体坐标系 virtual QVector3D speedAtTimespan(double time) const = 0; }; /// /// 推演指定时间点机动状态 /// struct MESSAGEBASIC_EXPORT MotionDeduceRequest : public AbstractMessage { double _target_time = 0; MotionDeduceRequest(); // Serializable void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; }; /// /// 查看指定目标实体的机动指令序列 /// struct MESSAGEBASIC_EXPORT MotionSequencePreviewGet : public AbstractMessage { MotionSequencePreviewGet(); }; /// /// 平台机动命令序列 /// struct MESSAGEBASIC_EXPORT PlatformMotionSequence : public AbstractMessage { QList> _cmd_sequence; PlatformMotionSequence(); // Serializable void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; }; // 机动命令实现 ======================================================= /// /// 直线机动 /// struct MESSAGEBASIC_EXPORT StrightLineMotion : public PlatformMotionCommand { /// /// 起始时间 /// double _start_time = 0; /// /// 机动速度,m/s /// double _speed_motion = 0; /// /// 加速度,m/s^2 /// double _accerlate_rates = 0; /// /// 路径长度 /// double _length_total = 0; StrightLineMotion(); double startTimepoint() const override; double timeExpend() const override; QVector3D posAtTimespan(double time) const override; QVector3D speedAtTimespan(double time) const override; void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; }; #include /// /// 基于机体坐标系的水平标准圆弧机动 /// struct MESSAGEBASIC_EXPORT HorizontalArcMotion : public PlatformMotionCommand { /// /// 起始时间 /// double _start_time = 0; /// /// 转弯圆心, /// QVector3D _center_point; /// /// 弧线转角,° /// double _rotate_deg = 0; /// /// 机动速度,m/s /// double _speed_motion = 0; HorizontalArcMotion(); double startTimepoint() const override; double timeExpend() const override; QVector3D posAtTimespan(double time) const override; QVector3D speedAtTimespan(double time) const override; void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; }; /// /// 基于机体坐标系的垂直标准圆弧机动 /// struct MESSAGEBASIC_EXPORT VerticalArcMotion : public PlatformMotionCommand { /// /// 起始时间 /// double _start_time = 0; /// /// 转弯圆心,<0, ypos, zpos> /// QVector3D _center_point; /// /// 弧线转角,° /// double _rotate_deg = 0; /// /// 机动速度,m/s /// double _speed_motion = 0; VerticalArcMotion(); double startTimepoint() const override; double timeExpend() const override; QVector3D posAtTimespan(double time) const override; QVector3D speedAtTimespan(double time) const override; void recoveryFrom(const QJsonObject& obj) override; void saveTo(QJsonObject& obj) const override; };