关节契约扩为槽位制:以 LinuxCNC 联合号标识关节,轴字母降为槽位属性, 重复轴(bridge-mill 的两个 Y)、并联杆长(hexapod/pentapod)和被动槽位 (max5 第 6 关节)都能表达。v1 规则保持不变并合成 jointOrder,已保存 GLB 与既有测试不受影响。 13 个结构 GLB 由 scripts/generate_physical_case_glbs.mjs 统一重建, 可动关节均为按槽位命名的 Group 并写 userData.linuxcncJoint,共 71 个 关节,槽位数与运行目录的 joint_count 逐条一致。 新增 machine-visual-bindings.json 与纯函数模块,以 machine id 为键: 坐标字母不能作键,因为三个案例共用 XYZAB、三个共用 XYZABC。主界面切换 案例时自动装载对应模型,失败时保留内置模型并显式提示。 消除前端五关节截断:visual 适配器的 joints 改为数组并新增 jointsAuthoritative;allHomed 按 joint_count 判断;面板按 worker 断言的 machine id 查找机型。 管理器解锁:坐标与案例下拉以"存在完整视觉绑定"为启用条件,13 案例全部 可选;machine-urdf.ts 新增 generic-wasm/1 profile,AC/BC 严格校验路径 不变;新增 machine-kinematics-specs.json 保存逐关节限位,INI 未声明的 限位保持 null 而不编造。 修复三个真实缺陷:构建漏发 woodpecker/gmoccapy/qtdragon 配置目录( DEFECT-02 根因);案例切换沿用"装载需要已上电"的门控,导致关机状态下 第二次切换被静默拒绝;重复轴机型上 React 列表键冲突。 验收:13 案例逐个切换装载成功、槽位键与绑定定义逐一一致、浏览器错误 0; typecheck 与生产构建通过;视觉绑定、GLB 命名、关节契约、投影、store、 双画布、运动学规格漂移、11 案例 Worker 闭环、管理器浏览器回归全部通过。 证据在 coverage/glb-machine-manager/physical-drive/。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
87 lines
2.8 KiB
C
87 lines
2.8 KiB
C
#ifndef LINUXCNC_WEB_WASM_SIM_MOTION_QUEUE_H
|
|
#define LINUXCNC_WEB_WASM_SIM_MOTION_QUEUE_H
|
|
|
|
#include "sim_posemath.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum sim_motion_result {
|
|
SIM_MOTION_OK = 0,
|
|
SIM_MOTION_ERR_ARGUMENT = -600,
|
|
SIM_MOTION_ERR_NONFINITE = -601,
|
|
SIM_MOTION_ERR_RANGE = -602,
|
|
SIM_MOTION_ERR_GEOMETRY = -603,
|
|
SIM_MOTION_ERR_MOTION_TYPE = -604,
|
|
SIM_MOTION_ERR_STATE = -605,
|
|
SIM_MOTION_ERR_CAPACITY = -606,
|
|
SIM_MOTION_ERR_BUFFER = -607,
|
|
};
|
|
|
|
enum sim_motion_profile {
|
|
SIM_MOTION_PROFILE_BLEND = 0,
|
|
SIM_MOTION_PROFILE_EXACT_STOP = 1,
|
|
};
|
|
|
|
#define SIM_MOTION_QUEUE_CAPACITY 64u
|
|
|
|
typedef struct sim_motion_command {
|
|
sim_posemath_segment segment;
|
|
uint32_t id;
|
|
uint32_t tag;
|
|
} sim_motion_command;
|
|
|
|
/* The high tag bit is reserved for Rapid blocks so the command ABI remains
|
|
compatible with existing checkpoints and WASM clients. */
|
|
#define SIM_MOTION_COMMAND_TAG_RAPID (UINT32_C(1) << 31)
|
|
|
|
typedef struct sim_motion_state {
|
|
sim_posemath_pose position;
|
|
double velocity;
|
|
double progress;
|
|
uint32_t tick;
|
|
uint32_t queue_depth;
|
|
uint32_t active_id;
|
|
uint32_t active_tag;
|
|
int motion_type;
|
|
int status;
|
|
} sim_motion_state;
|
|
|
|
typedef struct sim_motion_queue {
|
|
sim_motion_command commands[SIM_MOTION_QUEUE_CAPACITY];
|
|
uint32_t head;
|
|
uint32_t count;
|
|
uint32_t next_id;
|
|
uint32_t tick;
|
|
double cycle_time;
|
|
double velocity_limit;
|
|
sim_motion_state state;
|
|
} sim_motion_queue;
|
|
|
|
int sim_motion_init(sim_motion_queue *queue, double cycle_time, double velocity_limit);
|
|
uint32_t sim_motion_size(void);
|
|
uint32_t sim_motion_command_size(void);
|
|
uint32_t sim_motion_state_size(void);
|
|
int sim_motion_reset(sim_motion_queue *queue);
|
|
int sim_motion_set_position(sim_motion_queue *queue, const sim_posemath_pose *position);
|
|
int sim_motion_enqueue(sim_motion_queue *queue, const sim_motion_command *command, uint32_t *id_out);
|
|
int sim_motion_step(sim_motion_queue *queue);
|
|
int sim_motion_set_profile(sim_motion_queue *queue, int profile);
|
|
int sim_motion_set_lookahead(sim_motion_queue *queue, uint32_t depth);
|
|
int sim_motion_set_dynamics(sim_motion_queue *queue, double acceleration_limit, double jerk_limit);
|
|
int sim_motion_set_feed_override(sim_motion_queue *queue, double feed_override);
|
|
int sim_motion_set_paused(sim_motion_queue *queue, uint32_t paused);
|
|
int sim_motion_peek(const sim_motion_queue *queue, uint32_t offset, sim_motion_command *command);
|
|
int sim_motion_read_state(const sim_motion_queue *queue, sim_motion_state *state);
|
|
uint32_t sim_motion_queue_depth(const sim_motion_queue *queue);
|
|
uint64_t sim_motion_state_hash(const sim_motion_queue *queue);
|
|
uint64_t sim_motion_plan_hash(const sim_motion_queue *queue);
|
|
uint32_t sim_motion_canonical(const sim_motion_queue *queue, char *output, uint32_t capacity);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|