update
This commit is contained in:
parent
819bd70426
commit
300b31a578
|
@ -105,12 +105,14 @@
|
|||
<ClCompile Include="DeduceFramework.cpp" />
|
||||
<ClCompile Include="InvisibleComponent.cpp" />
|
||||
<ClCompile Include="RouteManage.cpp" />
|
||||
<ClCompile Include="SurfaceMotionPlugin.cpp" />
|
||||
<ClCompile Include="VisibleCube.cpp" />
|
||||
<ClInclude Include="componentbasic_global.h" />
|
||||
<ClInclude Include="componentbasic.h" />
|
||||
<QtMoc Include="DeduceFramework.h" />
|
||||
<ClInclude Include="InvisibleComponent.h" />
|
||||
<ClInclude Include="RouteManage.h" />
|
||||
<ClInclude Include="SurfaceMotionPlugin.h" />
|
||||
<ClInclude Include="VisibleCube.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<ClInclude Include="InvisibleComponent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SurfaceMotionPlugin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VisibleCube.cpp">
|
||||
|
@ -55,6 +58,9 @@
|
|||
<ClCompile Include="InvisibleComponent.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfaceMotionPlugin.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="DeduceFramework.h">
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "SurfaceMotionPlugin.h"
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
/// <summary>
|
||||
/// 水面平台机动组件
|
||||
/// </summary>
|
||||
class SurfaceMotionControlPlugin : public ProcList<
|
||||
|
||||
>{
|
||||
};
|
||||
|
|
@ -100,10 +100,12 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="motion_access.cpp" />
|
||||
<ClCompile Include="route_access.cpp" />
|
||||
<ClInclude Include="messagebasic_global.h" />
|
||||
<ClInclude Include="messagebasic.h" />
|
||||
<ClCompile Include="messagebasic.cpp" />
|
||||
<ClInclude Include="motion_access.h" />
|
||||
<ClInclude Include="route_access.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -35,10 +35,16 @@
|
|||
<ClInclude Include="route_access.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="motion_access.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="route_access.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="motion_access.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,115 @@
|
|||
#include "motion_access.h"
|
||||
#include <QVariant>
|
||||
|
||||
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 <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
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<PlatformMotionCommand>();
|
||||
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.");
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
#pragma once
|
||||
#include "messagebasic.h"
|
||||
|
||||
/// <summary>
|
||||
/// 依照指定名称路径机动
|
||||
/// </summary>
|
||||
struct MESSAGEBASIC_EXPORT NavigateWithRoute : public AbstractMessage {
|
||||
QString _route_name;
|
||||
|
||||
NavigateWithRoute();
|
||||
|
||||
// Serializable
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 机动类型
|
||||
/// </summary>
|
||||
enum MotionType {
|
||||
None, // 没有
|
||||
StraightLine,// 直线机动
|
||||
StandardArc, // 标准圆弧
|
||||
ParabolaLine,// 抛物线
|
||||
Bezier2tArc, // 二次贝塞尔曲线
|
||||
Bezier3tArc, // 三次贝塞尔曲线
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 机动角度方向
|
||||
/// </summary>
|
||||
enum class MotionRotate {
|
||||
Horizontal, Vertical
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 正交机动命令抽象接口
|
||||
/// </summary>
|
||||
struct OrthogonalMotionCommand : public Serializable {
|
||||
/// <summary>
|
||||
/// 机动平面方向
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual MotionRotate rotateType() const = 0;
|
||||
/// <summary>
|
||||
/// 机动类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual MotionType motionType() const = 0;
|
||||
/// <summary>
|
||||
/// 计算指定百分比位置
|
||||
/// </summary>
|
||||
/// <param name="percent"></param>
|
||||
/// <returns></returns>
|
||||
virtual LonLatAltPos posAtPercent(double percent) = 0;
|
||||
/// <summary>
|
||||
/// 指定百分比位置的速度
|
||||
/// </summary>
|
||||
/// <param name="percent"></param>
|
||||
/// <returns></returns>
|
||||
virtual double speedAtPercent(double percent) = 0;
|
||||
/// <summary>
|
||||
/// 指定百分比位置速度方向
|
||||
/// </summary>
|
||||
/// <param name="percent"></param>
|
||||
/// <returns></returns>
|
||||
virtual QVector2D speedVectorAtPercent(double percent) = 0;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 平台机动命令
|
||||
/// </summary>
|
||||
struct PlatformMotionCommand : public AbstractMessage {
|
||||
QHash<MotionRotate, std::shared_ptr<OrthogonalMotionCommand>> _motion_set; //合成机动命令
|
||||
double _arrived_time = 0; // 抵达终点时间
|
||||
double _start_time = 0;
|
||||
|
||||
PlatformMotionCommand();
|
||||
|
||||
// Serializable
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 查看指定目标实体的机动指令序列
|
||||
/// </summary>
|
||||
struct MESSAGEBASIC_EXPORT MotionSequencePreviewGet : public AbstractMessage {
|
||||
MotionSequencePreviewGet();
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 平台机动命令序列
|
||||
/// </summary>
|
||||
struct MESSAGEBASIC_EXPORT PlatformMotionSequence : public AbstractMessage {
|
||||
QList<std::shared_ptr<PlatformMotionCommand>> _cmd_sequence;
|
||||
|
||||
PlatformMotionSequence();
|
||||
|
||||
// Serializable
|
||||
void recoveryFrom(const QJsonObject& obj) override;
|
||||
void saveTo(QJsonObject& obj) const override;
|
||||
};
|
||||
|
||||
|
||||
// 正交机动命令实现 =======================================================
|
||||
|
||||
/// <summary>
|
||||
/// 水平直线机动
|
||||
/// </summary>
|
||||
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 {
|
||||
|
||||
};
|
Loading…
Reference in New Issue