CMake模块构建工程

This commit is contained in:
chen
2026-07-02 10:24:20 +00:00
parent e606b9e53c
commit d9813ea8fe
8 changed files with 311 additions and 16 deletions
+63
View File
@@ -0,0 +1,63 @@
/**
* @file Axis.h
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2026-07-02
*
* @copyright Copyright (c) 2026
*
*/
#include "Types.h"
namespace plcopen {
/**
* \enum MotionCommandType
* \brief 内部运动指令类型(功能块 → 轴模型映射)
*/
enum class MotionCommandType {
None, /*!< 无活动指令 */
PointToPoint, /*!< MC_MoveAbsolute / MC_MoveRelative */
Velocity, /*!< MC_MoveVelocity */
Stop, /*!< MC_Stop */
Halt, /*!< MC_Halt */
Home, /*!< MC_Home */
};
/**
* \struct MotionCommand
* \brief 当前活动运动指令的参数快照
*/
struct MotionCommand {
MotionCommandType type = MotionCommandType::None;
REAL targetPosition = 0.0;
REAL targetVelocity = 0.0;
REAL maxVelocity = 0.0;
REAL acceleration = 0.0;
REAL deceleration = 0.0;
REAL homePosition = 0.0;
MC_AXIS_STATE resultingState = MC_AXIS_STATE::DiscreteMotion;
};
/**
* \class Axis
* \brief 单轴仿真对象,实现 PLCopen 轴状态机与运动学
* \note 不要在功能块 cycle() 之外直接修改 Axis 内部状态。
*/
class Axis {
public:
/**
* \brief 构造轴
* \param axisNo 轴编号
* \param name 轴名称
*/
explicit Axis(UINT axisNo = 1, std::string name = "Axis1");
private:
AXIS_REF ref_;
MC_AXIS_STATE state_ = MC_AXIS_STATE::Disabled;
};
}