Implement WebAssembly runtime and kinematics coverage
This commit is contained in:
66
wasm-core/include/sim_motion_queue.h
Normal file
66
wasm-core/include/sim_motion_queue.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#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,
|
||||
};
|
||||
|
||||
#define SIM_MOTION_QUEUE_CAPACITY 64u
|
||||
|
||||
typedef struct sim_motion_command {
|
||||
sim_posemath_segment segment;
|
||||
uint32_t id;
|
||||
uint32_t tag;
|
||||
} sim_motion_command;
|
||||
|
||||
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);
|
||||
int sim_motion_reset(sim_motion_queue *queue);
|
||||
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_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);
|
||||
uint32_t sim_motion_canonical(const sim_motion_queue *queue, char *output, uint32_t capacity);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user