Extend simulation runtime coverage and kinematics support
This commit is contained in:
@@ -8,7 +8,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIM_HAL_NAME_CAPACITY 48U
|
||||
#define SIM_HAL_PIN_CAPACITY 64U
|
||||
#define SIM_HAL_PIN_CAPACITY 256U
|
||||
#define SIM_HAL_THREAD_CAPACITY 16U
|
||||
#define SIM_HAL_FUNCTION_CAPACITY 64U
|
||||
|
||||
|
||||
151
wasm-core/include/sim_io.h
Normal file
151
wasm-core/include/sim_io.h
Normal file
@@ -0,0 +1,151 @@
|
||||
#ifndef LINUXCNC_WEB_WASM_SIM_IO_H
|
||||
#define LINUXCNC_WEB_WASM_SIM_IO_H
|
||||
|
||||
#include "sim_posemath.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIM_IO_MAX_SPINDLES 8u
|
||||
#define SIM_IO_MAX_TOOLS 1001u
|
||||
|
||||
enum sim_io_result {
|
||||
SIM_IO_OK = 0,
|
||||
SIM_IO_ERR_ARGUMENT = -900,
|
||||
SIM_IO_ERR_RANGE = -901,
|
||||
SIM_IO_ERR_STATE = -902,
|
||||
SIM_IO_ERR_NOT_READY = -903,
|
||||
SIM_IO_ERR_ESTOP = -904,
|
||||
SIM_IO_ERR_FAULT = -905,
|
||||
SIM_IO_ERR_LIMIT = -906,
|
||||
SIM_IO_ERR_NONFINITE = -907,
|
||||
SIM_IO_ERR_PIN = -908,
|
||||
SIM_IO_ERR_CAPACITY = -909,
|
||||
SIM_IO_ERR_BUSY = -910,
|
||||
SIM_IO_ERR_PROBE = -911,
|
||||
SIM_IO_ERR_TIMEOUT = -912,
|
||||
SIM_IO_ERR_RECOVERY = -913,
|
||||
};
|
||||
|
||||
enum sim_io_tool_state {
|
||||
SIM_IO_TOOL_IDLE = 0,
|
||||
SIM_IO_TOOL_PREPARING = 1,
|
||||
SIM_IO_TOOL_PREPARED = 2,
|
||||
SIM_IO_TOOL_CHANGING = 3,
|
||||
SIM_IO_TOOL_READY = 4,
|
||||
SIM_IO_TOOL_ABORTED = 5,
|
||||
SIM_IO_TOOL_FAULT = 6,
|
||||
};
|
||||
|
||||
enum sim_io_probe_status {
|
||||
SIM_IO_PROBE_IDLE = 0,
|
||||
SIM_IO_PROBE_ARMED = 1,
|
||||
SIM_IO_PROBE_TRIPPED = 2,
|
||||
SIM_IO_PROBE_FAILED = 3,
|
||||
};
|
||||
|
||||
typedef struct sim_io_spindle_state {
|
||||
uint32_t registered;
|
||||
uint32_t enabled;
|
||||
uint32_t inhibit;
|
||||
uint32_t amp_fault;
|
||||
uint32_t at_speed;
|
||||
uint32_t brake;
|
||||
uint32_t forward;
|
||||
uint32_t reverse;
|
||||
uint32_t index_enable;
|
||||
uint32_t orient;
|
||||
uint32_t locked;
|
||||
uint32_t is_oriented;
|
||||
int32_t orient_mode;
|
||||
int32_t orient_fault;
|
||||
double command_rpm;
|
||||
double speed_rpm;
|
||||
double max_rpm;
|
||||
double accel_rpm_s;
|
||||
double tolerance_rpm;
|
||||
double orient_angle;
|
||||
double revs;
|
||||
uint32_t tick;
|
||||
} sim_io_spindle_state;
|
||||
|
||||
typedef struct sim_io_probe_state {
|
||||
uint32_t input;
|
||||
uint32_t probe_type;
|
||||
uint32_t state;
|
||||
uint32_t tripped;
|
||||
uint32_t tick;
|
||||
sim_posemath_pose position;
|
||||
} sim_io_probe_state;
|
||||
|
||||
typedef struct sim_io_state {
|
||||
uint32_t ready;
|
||||
uint32_t estop;
|
||||
uint32_t fault;
|
||||
int32_t fault_reason;
|
||||
uint32_t tick;
|
||||
uint32_t recovery_epoch;
|
||||
uint32_t spindle_count;
|
||||
uint32_t tool_capacity;
|
||||
sim_io_spindle_state spindles[SIM_IO_MAX_SPINDLES];
|
||||
uint32_t tool_state;
|
||||
int32_t current_tool;
|
||||
int32_t prepared_tool;
|
||||
int32_t prepared_pocket;
|
||||
uint32_t tool_prepare;
|
||||
uint32_t tool_prepared;
|
||||
uint32_t tool_change;
|
||||
uint32_t tool_changed;
|
||||
uint32_t toolchanger_fault;
|
||||
int32_t toolchanger_reason;
|
||||
sim_io_probe_state probe;
|
||||
int32_t last_error;
|
||||
} sim_io_state;
|
||||
|
||||
typedef struct sim_io {
|
||||
sim_io_state state;
|
||||
double cycle_time;
|
||||
uint32_t pins_registered;
|
||||
} sim_io;
|
||||
|
||||
int sim_io_init(sim_io *io, uint32_t spindle_count, uint32_t tool_capacity,
|
||||
double cycle_time, double spindle_accel_rpm_s,
|
||||
double spindle_tolerance_rpm);
|
||||
int sim_io_reset(sim_io *io);
|
||||
int sim_io_register_pins(sim_io *io);
|
||||
int sim_io_spindle_command(sim_io *io, uint32_t spindle, double rpm,
|
||||
uint32_t enabled);
|
||||
int sim_io_spindle_set_inhibit(sim_io *io, uint32_t spindle, uint32_t inhibit);
|
||||
int sim_io_spindle_set_fault(sim_io *io, uint32_t spindle, uint32_t fault);
|
||||
int sim_io_spindle_set_index_enable(sim_io *io, uint32_t spindle, uint32_t enable);
|
||||
int sim_io_spindle_set_feedback(sim_io *io, uint32_t spindle, double rpm);
|
||||
int sim_io_spindle_orient(sim_io *io, uint32_t spindle, double angle,
|
||||
int32_t mode);
|
||||
int sim_io_spindle_set_oriented(sim_io *io, uint32_t spindle,
|
||||
uint32_t oriented, int32_t fault);
|
||||
int sim_io_tool_prepare(sim_io *io, int32_t tool, int32_t pocket);
|
||||
int sim_io_tool_set_prepared(sim_io *io, uint32_t prepared);
|
||||
int sim_io_tool_change(sim_io *io);
|
||||
int sim_io_tool_set_changed(sim_io *io, uint32_t changed);
|
||||
int sim_io_tool_abort(sim_io *io, int32_t reason);
|
||||
int sim_io_tool_set_fault(sim_io *io, uint32_t fault, int32_t reason);
|
||||
int sim_io_tool_clear_fault(sim_io *io);
|
||||
int sim_io_probe_arm(sim_io *io, uint32_t probe_type);
|
||||
int sim_io_probe_update(sim_io *io, const sim_posemath_pose *pose,
|
||||
uint32_t input);
|
||||
int sim_io_probe_disarm(sim_io *io);
|
||||
int sim_io_set_estop(sim_io *io, uint32_t estop);
|
||||
int sim_io_recover(sim_io *io);
|
||||
int sim_io_step(sim_io *io, uint32_t ticks);
|
||||
int sim_io_read_state(const sim_io *io, sim_io_state *state);
|
||||
uint64_t sim_io_state_hash(const sim_io *io);
|
||||
uint32_t sim_io_canonical(const sim_io *io, char *output, uint32_t capacity);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -16,6 +16,12 @@ enum sim_kinematics_result {
|
||||
SIM_KIN_ERR_SINGULAR = -704,
|
||||
SIM_KIN_ERR_UNKNOWN_TYPE = -705,
|
||||
SIM_KIN_ERR_UNSUPPORTED = -706,
|
||||
SIM_KIN_ERR_INVALID_MODE = -707,
|
||||
SIM_KIN_ERR_MISSING_MODULE = -708,
|
||||
SIM_KIN_ERR_SWITCH_INTERRUPTED = -709,
|
||||
SIM_KIN_ERR_ABI_VERSION = -710,
|
||||
SIM_KIN_ERR_CAPABILITY = -711,
|
||||
SIM_KIN_ERR_DYNAMIC_MODULE = -712,
|
||||
};
|
||||
|
||||
enum sim_kinematics_type {
|
||||
@@ -60,6 +66,34 @@ enum sim_kinematics_mode {
|
||||
#define SIM_KIN_MAX_JOINTS 9u
|
||||
#define SIM_KIN_GENHEX_STRUTS 6u
|
||||
#define SIM_KIN_PENTA_STRUTS 5u
|
||||
#define SIM_KIN_SWITCH_MAX_TYPES 3u
|
||||
#define SIM_KIN_USER_ABI_VERSION 1u
|
||||
#define SIM_KIN_USER_CAP_FORWARD UINT32_C(1)
|
||||
#define SIM_KIN_USER_CAP_INVERSE UINT32_C(2)
|
||||
#define SIM_KIN_USER_CAP_STATIC UINT32_C(4)
|
||||
#define SIM_KIN_USER_NAME_CAPACITY 32u
|
||||
#define SIM_KIN_REGISTRY_ABI_VERSION 1u
|
||||
#define SIM_KIN_REGISTRY_NAME_CAPACITY 32u
|
||||
#define SIM_KIN_CAP_FORWARD UINT32_C(1)
|
||||
#define SIM_KIN_CAP_INVERSE UINT32_C(2)
|
||||
#define SIM_KIN_CAP_IDENTITY UINT32_C(4)
|
||||
#define SIM_KIN_CAP_ITERATIVE UINT32_C(8)
|
||||
#define SIM_KIN_CAP_SWITCHABLE UINT32_C(16)
|
||||
#define SIM_KIN_CAP_EXTRA_JOINTS UINT32_C(32)
|
||||
#define SIM_KIN_CAP_DUPLICATE_COORDINATES UINT32_C(64)
|
||||
#define SIM_KIN_PARAM_MAPPING UINT64_C(1)
|
||||
#define SIM_KIN_PARAM_LIMITS UINT64_C(2)
|
||||
#define SIM_KIN_PARAM_OFFSETS UINT64_C(4)
|
||||
#define SIM_KIN_PARAM_TOOL UINT64_C(8)
|
||||
#define SIM_KIN_PARAM_PIVOT UINT64_C(16)
|
||||
#define SIM_KIN_PARAM_GEOMETRY UINT64_C(32)
|
||||
#define SIM_KIN_PARAM_DH UINT64_C(64)
|
||||
#define SIM_KIN_PARAM_SOLVER UINT64_C(128)
|
||||
|
||||
enum sim_kinematics_user_implementation {
|
||||
SIM_KIN_USER_IDENTITY = 1,
|
||||
SIM_KIN_USER_GENSER = 2,
|
||||
};
|
||||
|
||||
typedef struct sim_kinematics_config {
|
||||
int type;
|
||||
@@ -149,6 +183,52 @@ typedef struct sim_kinematics_result_info {
|
||||
uint32_t branch_id;
|
||||
} sim_kinematics_result_info;
|
||||
|
||||
/* A bounded switchkins container matching LinuxCNC's three registered
|
||||
* kinematics slots. The container owns switching state, not the modules. */
|
||||
typedef struct sim_kinematics_switch {
|
||||
sim_kinematics *modules[SIM_KIN_SWITCH_MAX_TYPES];
|
||||
uint8_t registered[SIM_KIN_SWITCH_MAX_TYPES];
|
||||
uint8_t fwd_iterates_mask;
|
||||
uint8_t switching;
|
||||
int active_mode;
|
||||
int pending_mode;
|
||||
uint32_t generation;
|
||||
uint32_t switch_count;
|
||||
uint32_t abort_count;
|
||||
sim_posemath_pose last_pose[SIM_KIN_SWITCH_MAX_TYPES];
|
||||
uint8_t have_last_pose[SIM_KIN_SWITCH_MAX_TYPES];
|
||||
} sim_kinematics_switch;
|
||||
|
||||
/* User kinematics are selected from implementations already linked into the
|
||||
* WASM module. No function pointers, host paths, or dynamic libraries enter
|
||||
* this descriptor. */
|
||||
typedef struct sim_kinematics_user_descriptor {
|
||||
uint32_t abi_version;
|
||||
uint32_t capabilities;
|
||||
int implementation;
|
||||
char name[SIM_KIN_USER_NAME_CAPACITY];
|
||||
sim_kinematics_config config;
|
||||
} sim_kinematics_user_descriptor;
|
||||
|
||||
typedef struct sim_kinematics_user {
|
||||
sim_kinematics_user_descriptor descriptor;
|
||||
sim_kinematics module;
|
||||
uint32_t initialized;
|
||||
uint32_t forward_calls;
|
||||
uint32_t inverse_calls;
|
||||
} sim_kinematics_user;
|
||||
|
||||
typedef struct sim_kinematics_capability {
|
||||
uint32_t abi_version;
|
||||
int type;
|
||||
char name[SIM_KIN_REGISTRY_NAME_CAPACITY];
|
||||
char required_coordinates[16];
|
||||
uint32_t min_joints;
|
||||
uint32_t max_joints;
|
||||
uint32_t capabilities;
|
||||
uint64_t parameter_mask;
|
||||
} sim_kinematics_capability;
|
||||
|
||||
int sim_kinematics_init(sim_kinematics *kinematics, const sim_kinematics_config *config);
|
||||
int sim_kinematics_forward(const sim_kinematics *kinematics, const double *joints,
|
||||
uint32_t joint_count, sim_posemath_pose *pose);
|
||||
@@ -167,6 +247,60 @@ uint64_t sim_kinematics_state_hash(const sim_kinematics *kinematics,
|
||||
const double *joints, uint32_t joint_count,
|
||||
const sim_posemath_pose *pose);
|
||||
|
||||
int sim_kinematics_switch_init(sim_kinematics_switch *switcher, int default_mode,
|
||||
uint8_t fwd_iterates_mask);
|
||||
int sim_kinematics_switch_register(sim_kinematics_switch *switcher, int mode,
|
||||
sim_kinematics *module, uint8_t fwd_iterates);
|
||||
int sim_kinematics_switch_begin(sim_kinematics_switch *switcher, int mode);
|
||||
int sim_kinematics_switch_abort(sim_kinematics_switch *switcher);
|
||||
int sim_kinematics_switch_commit(sim_kinematics_switch *switcher, double *joints,
|
||||
uint32_t joint_count, sim_posemath_pose *pose,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_switch_select(sim_kinematics_switch *switcher, int mode,
|
||||
double *joints, uint32_t joint_count,
|
||||
sim_posemath_pose *pose,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_switch_forward(sim_kinematics_switch *switcher,
|
||||
const double *joints, uint32_t joint_count,
|
||||
sim_posemath_pose *pose,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_switch_inverse(sim_kinematics_switch *switcher,
|
||||
const sim_posemath_pose *pose, double *joints,
|
||||
uint32_t joint_count,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_switch_active(const sim_kinematics_switch *switcher);
|
||||
uint64_t sim_kinematics_switch_state_hash(const sim_kinematics_switch *switcher,
|
||||
const double *joints, uint32_t joint_count,
|
||||
const sim_posemath_pose *pose);
|
||||
int sim_kinematics_user_init(sim_kinematics_user *user,
|
||||
const sim_kinematics_user_descriptor *descriptor);
|
||||
int sim_kinematics_user_bind_switch(sim_kinematics_user *user,
|
||||
sim_kinematics_switch *switcher, int mode,
|
||||
uint8_t fwd_iterates);
|
||||
int sim_kinematics_user_forward(sim_kinematics_user *user, const double *joints,
|
||||
uint32_t joint_count, sim_posemath_pose *pose,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_user_inverse(sim_kinematics_user *user,
|
||||
const sim_posemath_pose *pose, double *joints,
|
||||
uint32_t joint_count,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_user_reject_dynamic(const char *module_path);
|
||||
uint64_t sim_kinematics_user_state_hash(const sim_kinematics_user *user,
|
||||
const double *joints, uint32_t joint_count,
|
||||
const sim_posemath_pose *pose);
|
||||
uint32_t sim_kinematics_registry_count(void);
|
||||
int sim_kinematics_registry_get(uint32_t index,
|
||||
sim_kinematics_capability *capability);
|
||||
int sim_kinematics_registry_find(const char *name,
|
||||
sim_kinematics_capability *capability);
|
||||
int sim_kinematics_registry_require(const char *name, uint32_t capabilities,
|
||||
uint64_t parameter_mask,
|
||||
sim_kinematics_capability *capability);
|
||||
int sim_kinematics_registry_validate_config(const char *name,
|
||||
const sim_kinematics_config *config,
|
||||
sim_kinematics_capability *capability);
|
||||
uint64_t sim_kinematics_registry_state_hash(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
52
wasm-core/include/sim_kinematics_feedback.h
Normal file
52
wasm-core/include/sim_kinematics_feedback.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef LINUXCNC_WEB_WASM_SIM_KINEMATICS_FEEDBACK_H
|
||||
#define LINUXCNC_WEB_WASM_SIM_KINEMATICS_FEEDBACK_H
|
||||
|
||||
#include "sim_kinematics.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum sim_kinematics_feedback_result {
|
||||
SIM_KIN_FEEDBACK_OK = 0,
|
||||
SIM_KIN_FEEDBACK_ERR_ARGUMENT = -820,
|
||||
SIM_KIN_FEEDBACK_ERR_CONFIGURATION = -821,
|
||||
SIM_KIN_FEEDBACK_ERR_NONFINITE = -822,
|
||||
SIM_KIN_FEEDBACK_ERR_FORWARD = -823,
|
||||
SIM_KIN_FEEDBACK_ERR_STATE = -824,
|
||||
};
|
||||
|
||||
typedef struct sim_kinematics_feedback_state {
|
||||
sim_posemath_pose pose;
|
||||
uint64_t forward_flags;
|
||||
uint64_t inverse_flags;
|
||||
double joints[SIM_KIN_MAX_JOINTS];
|
||||
uint32_t joint_count;
|
||||
uint32_t tick;
|
||||
uint32_t valid;
|
||||
int last_error;
|
||||
int kinematics_error;
|
||||
} sim_kinematics_feedback_state;
|
||||
|
||||
typedef struct sim_kinematics_feedback {
|
||||
sim_kinematics *kinematics;
|
||||
sim_kinematics_feedback_state state;
|
||||
} sim_kinematics_feedback;
|
||||
|
||||
int sim_kinematics_feedback_init(sim_kinematics_feedback *feedback,
|
||||
sim_kinematics *kinematics,
|
||||
uint32_t joint_count);
|
||||
int sim_kinematics_feedback_reset(sim_kinematics_feedback *feedback);
|
||||
int sim_kinematics_feedback_update(sim_kinematics_feedback *feedback,
|
||||
const double *joints, uint32_t joint_count,
|
||||
uint64_t inverse_flags,
|
||||
sim_kinematics_result_info *info);
|
||||
int sim_kinematics_feedback_read(const sim_kinematics_feedback *feedback,
|
||||
sim_kinematics_feedback_state *state);
|
||||
uint64_t sim_kinematics_feedback_state_hash(const sim_kinematics_feedback *feedback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
55
wasm-core/include/sim_kinematics_home_limit.h
Normal file
55
wasm-core/include/sim_kinematics_home_limit.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef LINUXCNC_WEB_WASM_SIM_KINEMATICS_HOME_LIMIT_H
|
||||
#define LINUXCNC_WEB_WASM_SIM_KINEMATICS_HOME_LIMIT_H
|
||||
|
||||
#include "sim_kinematics.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum sim_kinematics_home_limit_result {
|
||||
SIM_KIN_HOME_OK = 0,
|
||||
SIM_KIN_HOME_ERR_ARGUMENT = -840,
|
||||
SIM_KIN_HOME_ERR_CONFIGURATION = -841,
|
||||
SIM_KIN_HOME_ERR_UNHOMED = -842,
|
||||
SIM_KIN_HOME_ERR_LIMIT = -843,
|
||||
SIM_KIN_HOME_ERR_FORWARD = -844,
|
||||
SIM_KIN_HOME_ERR_NONFINITE = -845,
|
||||
SIM_KIN_HOME_ERR_SEQUENCE = -846,
|
||||
};
|
||||
|
||||
typedef struct sim_kinematics_home_limit_state {
|
||||
sim_posemath_pose pose;
|
||||
double joints[SIM_KIN_MAX_JOINTS];
|
||||
uint32_t joint_count;
|
||||
uint32_t homed;
|
||||
uint32_t home_sequence;
|
||||
uint32_t tick;
|
||||
int last_error;
|
||||
int limit_error;
|
||||
int kinematics_error;
|
||||
} sim_kinematics_home_limit_state;
|
||||
|
||||
typedef struct sim_kinematics_home_limit {
|
||||
sim_kinematics *kinematics;
|
||||
sim_kinematics_home_limit_state state;
|
||||
} sim_kinematics_home_limit;
|
||||
|
||||
int sim_kinematics_home_limit_init(sim_kinematics_home_limit *home_limit,
|
||||
sim_kinematics *kinematics,
|
||||
uint32_t joint_count);
|
||||
int sim_kinematics_home_limit_reset(sim_kinematics_home_limit *home_limit);
|
||||
int sim_kinematics_home_limit_home(sim_kinematics_home_limit *home_limit,
|
||||
uint32_t home_sequence);
|
||||
int sim_kinematics_home_limit_check(sim_kinematics_home_limit *home_limit,
|
||||
const double *joints,
|
||||
uint32_t joint_count);
|
||||
int sim_kinematics_home_limit_read(const sim_kinematics_home_limit *home_limit,
|
||||
sim_kinematics_home_limit_state *state);
|
||||
uint64_t sim_kinematics_home_limit_state_hash(const sim_kinematics_home_limit *home_limit);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
68
wasm-core/include/sim_kinematics_motion.h
Normal file
68
wasm-core/include/sim_kinematics_motion.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef LINUXCNC_WEB_WASM_SIM_KINEMATICS_MOTION_H
|
||||
#define LINUXCNC_WEB_WASM_SIM_KINEMATICS_MOTION_H
|
||||
|
||||
#include "sim_kinematics.h"
|
||||
#include "sim_posemath.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum sim_kinematics_motion_result {
|
||||
SIM_KIN_MOTION_OK = 0,
|
||||
SIM_KIN_MOTION_ERR_ARGUMENT = -800,
|
||||
SIM_KIN_MOTION_ERR_STATE = -801,
|
||||
SIM_KIN_MOTION_ERR_CAPACITY = -802,
|
||||
SIM_KIN_MOTION_ERR_PLANNER = -803,
|
||||
SIM_KIN_MOTION_ERR_INVERSE = -804,
|
||||
SIM_KIN_MOTION_ERR_NONFINITE = -805,
|
||||
SIM_KIN_MOTION_ERR_CONFIGURATION = -806,
|
||||
};
|
||||
|
||||
#define SIM_KIN_MOTION_QUEUE_CAPACITY 64u
|
||||
|
||||
typedef struct sim_kinematics_motion_sample {
|
||||
sim_posemath_pose pose;
|
||||
double joints[SIM_KIN_MAX_JOINTS];
|
||||
uint32_t joint_count;
|
||||
uint32_t tick;
|
||||
uint32_t planner_id;
|
||||
} sim_kinematics_motion_sample;
|
||||
|
||||
typedef struct sim_kinematics_motion {
|
||||
sim_tp planner;
|
||||
sim_kinematics *kinematics;
|
||||
sim_kinematics_motion_sample samples[SIM_KIN_MOTION_QUEUE_CAPACITY];
|
||||
uint32_t head;
|
||||
uint32_t count;
|
||||
uint32_t tick;
|
||||
uint32_t joint_count;
|
||||
uint32_t paused;
|
||||
int last_error;
|
||||
int planner_error;
|
||||
int kinematics_error;
|
||||
sim_posemath_pose last_pose;
|
||||
double last_joints[SIM_KIN_MAX_JOINTS];
|
||||
} sim_kinematics_motion;
|
||||
|
||||
int sim_kinematics_motion_init(sim_kinematics_motion *adapter,
|
||||
sim_kinematics *kinematics, double cycle_time,
|
||||
double velocity_limit, double acceleration_limit);
|
||||
int sim_kinematics_motion_reset(sim_kinematics_motion *adapter);
|
||||
int sim_kinematics_motion_enqueue(sim_kinematics_motion *adapter,
|
||||
const sim_posemath_segment *segment,
|
||||
uint32_t *id_out);
|
||||
int sim_kinematics_motion_pause(sim_kinematics_motion *adapter, uint32_t paused);
|
||||
int sim_kinematics_motion_step(sim_kinematics_motion *adapter);
|
||||
int sim_kinematics_motion_peek(const sim_kinematics_motion *adapter,
|
||||
sim_kinematics_motion_sample *sample);
|
||||
int sim_kinematics_motion_pop(sim_kinematics_motion *adapter,
|
||||
sim_kinematics_motion_sample *sample);
|
||||
uint32_t sim_kinematics_motion_depth(const sim_kinematics_motion *adapter);
|
||||
uint64_t sim_kinematics_motion_state_hash(const sim_kinematics_motion *adapter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user