Implement AXIS parity UI and execution baseline
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "sim_motion_queue.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
static sim_posemath_segment line(double x0, double x1) {
|
||||
sim_posemath_segment segment = {
|
||||
@@ -21,13 +22,28 @@ int main(void) {
|
||||
command.tag = 42;
|
||||
assert(sim_motion_init(&queue, 0.1, 10.0) == SIM_MOTION_OK);
|
||||
assert(sim_motion_enqueue(&queue, &command, &id) == SIM_MOTION_OK && id == 1);
|
||||
assert(sim_motion_set_paused(&queue, 1) == SIM_MOTION_OK);
|
||||
assert(sim_motion_step(&queue) == SIM_MOTION_ERR_STATE && queue.tick == 0);
|
||||
assert(sim_motion_set_paused(&queue, 0) == SIM_MOTION_OK);
|
||||
command.segment = line(1, 2);
|
||||
assert(sim_motion_enqueue(&queue, &command, 0) == SIM_MOTION_OK);
|
||||
assert(sim_motion_set_profile(&queue, SIM_MOTION_PROFILE_BLEND) == SIM_MOTION_OK);
|
||||
assert(sim_motion_set_lookahead(&queue, 2) == SIM_MOTION_OK);
|
||||
assert(sim_motion_set_dynamics(&queue, 2.0, 20.0) == SIM_MOTION_OK);
|
||||
assert(sim_motion_plan_hash(&queue) != 0);
|
||||
{
|
||||
sim_motion_command peek = {0};
|
||||
assert(sim_motion_peek(&queue, 0, &peek) == SIM_MOTION_OK && peek.id == 1);
|
||||
}
|
||||
assert(sim_motion_step(&queue) == SIM_MOTION_OK);
|
||||
assert(sim_motion_read_state(&queue, &state) == SIM_MOTION_OK);
|
||||
assert(state.tick == 1 && state.queue_depth == 2 && state.position.tran.x > 0.09);
|
||||
assert(state.tick == 1 && state.queue_depth == 2 && state.position.tran.x > 0.01);
|
||||
assert(sim_motion_state_hash(&queue) != 0);
|
||||
assert(sim_motion_canonical(&queue, canonical, sizeof(canonical)) > 1);
|
||||
assert(strstr(canonical, "\"profile\":\"blend\"") != NULL);
|
||||
assert(sim_motion_set_profile(&queue, SIM_MOTION_PROFILE_EXACT_STOP) == SIM_MOTION_OK);
|
||||
assert(sim_motion_set_lookahead(&queue, 0) == SIM_MOTION_ERR_RANGE);
|
||||
assert(sim_motion_set_dynamics(&queue, 0.0, 1.0) == SIM_MOTION_ERR_RANGE);
|
||||
command.segment = line(9, 10);
|
||||
assert(sim_motion_enqueue(&queue, &command, 0) == SIM_MOTION_ERR_STATE);
|
||||
command.segment.motion_type = 99;
|
||||
|
||||
Reference in New Issue
Block a user