From 300b31a5787c14b21f61ff4faba43889e8d74361 Mon Sep 17 00:00:00 2001
From: codeboss <2422523675@qq.com>
Date: Sun, 15 Jun 2025 00:05:57 +0800
Subject: [PATCH] update
---
ComponentBasic/ComponentBasic.vcxproj | 2 +
ComponentBasic/ComponentBasic.vcxproj.filters | 6 +
ComponentBasic/SurfaceMotionPlugin.cpp | 1 +
ComponentBasic/SurfaceMotionPlugin.h | 10 ++
MessageBasic/MessageBasic.vcxproj | 2 +
MessageBasic/MessageBasic.vcxproj.filters | 6 +
MessageBasic/motion_access.cpp | 115 +++++++++++++++
MessageBasic/motion_access.h | 131 ++++++++++++++++++
8 files changed, 273 insertions(+)
create mode 100644 ComponentBasic/SurfaceMotionPlugin.cpp
create mode 100644 ComponentBasic/SurfaceMotionPlugin.h
create mode 100644 MessageBasic/motion_access.cpp
create mode 100644 MessageBasic/motion_access.h
diff --git a/ComponentBasic/ComponentBasic.vcxproj b/ComponentBasic/ComponentBasic.vcxproj
index f19f805..608216c 100644
--- a/ComponentBasic/ComponentBasic.vcxproj
+++ b/ComponentBasic/ComponentBasic.vcxproj
@@ -105,12 +105,14 @@
+
+
diff --git a/ComponentBasic/ComponentBasic.vcxproj.filters b/ComponentBasic/ComponentBasic.vcxproj.filters
index cf48e34..c5ba88a 100644
--- a/ComponentBasic/ComponentBasic.vcxproj.filters
+++ b/ComponentBasic/ComponentBasic.vcxproj.filters
@@ -38,6 +38,9 @@
Header Files
+
+ Header Files
+
@@ -55,6 +58,9 @@
Source Files
+
+ Source Files
+
diff --git a/ComponentBasic/SurfaceMotionPlugin.cpp b/ComponentBasic/SurfaceMotionPlugin.cpp
new file mode 100644
index 0000000..35249ac
--- /dev/null
+++ b/ComponentBasic/SurfaceMotionPlugin.cpp
@@ -0,0 +1 @@
+#include "SurfaceMotionPlugin.h"
diff --git a/ComponentBasic/SurfaceMotionPlugin.h b/ComponentBasic/SurfaceMotionPlugin.h
new file mode 100644
index 0000000..15f8e7d
--- /dev/null
+++ b/ComponentBasic/SurfaceMotionPlugin.h
@@ -0,0 +1,10 @@
+#pragma once
+
+///
+/// 水面平台机动组件
+///
+class SurfaceMotionControlPlugin : public ProcList<
+
+>{
+};
+
diff --git a/MessageBasic/MessageBasic.vcxproj b/MessageBasic/MessageBasic.vcxproj
index 47ae430..2f830c0 100644
--- a/MessageBasic/MessageBasic.vcxproj
+++ b/MessageBasic/MessageBasic.vcxproj
@@ -100,10 +100,12 @@
+
+
diff --git a/MessageBasic/MessageBasic.vcxproj.filters b/MessageBasic/MessageBasic.vcxproj.filters
index 20f25c0..ba7057e 100644
--- a/MessageBasic/MessageBasic.vcxproj.filters
+++ b/MessageBasic/MessageBasic.vcxproj.filters
@@ -35,10 +35,16 @@
Header Files
+
+ Header Files
+
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/MessageBasic/motion_access.cpp b/MessageBasic/motion_access.cpp
new file mode 100644
index 0000000..a49d412
--- /dev/null
+++ b/MessageBasic/motion_access.cpp
@@ -0,0 +1,115 @@
+#include "motion_access.h"
+#include
+
+NavigateWithRoute::NavigateWithRoute()
+ :AbstractMessage(NAME(NavigateWithRoute)) {
+}
+
+void NavigateWithRoute::recoveryFrom(const QJsonObject& obj)
+{
+ AbstractMessage::recoveryFrom(obj);
+
+ STRING_PEAK(_route_name);
+}
+
+void NavigateWithRoute::saveTo(QJsonObject& obj) const
+{
+ AbstractMessage::saveTo(obj);
+
+ STRING_SAVE(_route_name);
+}
+
+PlatformMotionCommand::PlatformMotionCommand()
+ :AbstractMessage(NAME(PlatformMotionCommand))
+{
+
+}
+
+#include
+#include
+void PlatformMotionCommand::recoveryFrom(const QJsonObject& obj)
+{
+ AbstractMessage::recoveryFrom(obj);
+ DOUBLE_PEAK(_arrived_time);
+ DOUBLE_PEAK(_start_time);
+
+ auto cmd_array = obj["array"].toArray();
+ for (auto idx = 0; idx < cmd_array.size(); ++idx) {
+ auto cmd_obj = cmd_array.at(idx).toObject();
+
+ }
+}
+
+void PlatformMotionCommand::saveTo(QJsonObject& obj) const
+{
+ AbstractMessage::saveTo(obj);
+ DOUBLE_SAVE(_arrived_time);
+ DOUBLE_SAVE(_start_time);
+
+ QJsonArray cmd_array;
+ for (auto k : this->_motion_set.keys()) {
+ QJsonObject cmd;
+ cmd["type"] = (int)k;
+ QJsonObject objx;
+ this->_motion_set[k]->saveTo(objx);
+ cmd["content"] = objx;
+
+ cmd_array.append(cmd);
+ }
+ obj["array"] = cmd_array;
+}
+
+MotionSequencePreviewGet::MotionSequencePreviewGet()
+ :AbstractMessage(NAME(MotionSequencePreviewGet)) {
+}
+
+
+PlatformMotionSequence::PlatformMotionSequence()
+ :AbstractMessage(NAME(PlatformMotionSequence))
+{
+
+}
+
+void PlatformMotionSequence::recoveryFrom(const QJsonObject& obj)
+{
+ this->_cmd_sequence.clear();
+
+ AbstractMessage::recoveryFrom(obj);
+ auto cmd_array = obj["cmd_array"].toArray();
+ for (auto idx = 0; idx < cmd_array.size(); idx++) {
+ auto cmd_object = cmd_array.at(idx).toObject();
+ auto ptr = std::make_shared();
+ ptr->recoveryFrom(cmd_object);
+ this->_cmd_sequence.append(ptr);
+ }
+}
+
+void PlatformMotionSequence::saveTo(QJsonObject& obj) const
+{
+ AbstractMessage::saveTo(obj);
+
+ QJsonArray cmd_array;
+ for (auto info : _cmd_sequence) {
+ QJsonObject cmd_object;
+ info->saveTo(cmd_object);
+ cmd_array.append(cmd_object);
+ }
+ obj["cmd_array"] = cmd_array;
+}
+
+HorizontalLineMotionCmd::HorizontalLineMotionCmd(){}
+
+MotionRotate HorizontalLineMotionCmd::rotateType() const
+{
+ MotionRotate::Horizontal;
+}
+
+MotionType HorizontalLineMotionCmd::motionType() const
+{
+ MotionType::ParabolaLine;
+}
+
+LonLatAltPos HorizontalLineMotionCmd::posAtPercent(double percent)
+{
+ throw std::logic_error("The method or operation is not implemented.");
+}
diff --git a/MessageBasic/motion_access.h b/MessageBasic/motion_access.h
new file mode 100644
index 0000000..d7eb60d
--- /dev/null
+++ b/MessageBasic/motion_access.h
@@ -0,0 +1,131 @@
+#pragma once
+#include "messagebasic.h"
+
+///
+/// 依照指定名称路径机动
+///
+struct MESSAGEBASIC_EXPORT NavigateWithRoute : public AbstractMessage {
+ QString _route_name;
+
+ NavigateWithRoute();
+
+ // Serializable
+ void recoveryFrom(const QJsonObject& obj) override;
+ void saveTo(QJsonObject& obj) const override;
+};
+
+///
+/// 机动类型
+///
+enum MotionType {
+ None, // 没有
+ StraightLine,// 直线机动
+ StandardArc, // 标准圆弧
+ ParabolaLine,// 抛物线
+ Bezier2tArc, // 二次贝塞尔曲线
+ Bezier3tArc, // 三次贝塞尔曲线
+};
+
+///
+/// 机动角度方向
+///
+enum class MotionRotate {
+ Horizontal, Vertical
+};
+
+///
+/// 正交机动命令抽象接口
+///
+struct OrthogonalMotionCommand : public Serializable {
+ ///
+ /// 机动平面方向
+ ///
+ ///
+ virtual MotionRotate rotateType() const = 0;
+ ///
+ /// 机动类型
+ ///
+ ///
+ virtual MotionType motionType() const = 0;
+ ///
+ /// 计算指定百分比位置
+ ///
+ ///
+ ///
+ virtual LonLatAltPos posAtPercent(double percent) = 0;
+ ///
+ /// 指定百分比位置的速度
+ ///
+ ///
+ ///
+ virtual double speedAtPercent(double percent) = 0;
+ ///
+ /// 指定百分比位置速度方向
+ ///
+ ///
+ ///
+ virtual QVector2D speedVectorAtPercent(double percent) = 0;
+};
+
+///
+/// 平台机动命令
+///
+struct PlatformMotionCommand : public AbstractMessage {
+ QHash> _motion_set; //合成机动命令
+ double _arrived_time = 0; // 抵达终点时间
+ double _start_time = 0;
+
+ PlatformMotionCommand();
+
+ // 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 HorizontalLineMotionCmd : public OrthogonalMotionCommand {
+ LonLatPos _lonlat_anchor;// 起始点
+ double _azimuth_deg = 0; // 起始方位角
+ double _speed_value = 0;// 起始速度
+ double _accerlate_rate = 0;// 加速度
+
+ HorizontalLineMotionCmd();
+
+ // Serializable
+ void recoveryFrom(const QJsonObject& obj) override;
+ void saveTo(QJsonObject& obj) const override;
+
+ MotionRotate rotateType() const override;
+ MotionType motionType() const override;
+ LonLatAltPos posAtPercent(double percent) override;
+
+};
+
+struct MESSAGEBASIC_EXPORT VerticalLineMotionCmd : public OrthogonalMotionCommand {
+
+};
\ No newline at end of file