Make feed override control the WASM trajectory

This commit is contained in:
2026-08-31 06:19:36 +08:00
parent 2cda55e724
commit 51ba923cb5
13 changed files with 181 additions and 15 deletions

View File

@@ -44,6 +44,28 @@ int main(void) {
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);
{
sim_motion_queue override_queue = {0};
sim_motion_state override_state = {0};
sim_motion_command override_command = {0};
override_command.segment = line(0, 1);
assert(sim_motion_init(&override_queue, 0.1, 10.0) == SIM_MOTION_OK);
assert(sim_motion_set_feed_override(&override_queue, 0.5) == SIM_MOTION_OK);
assert(sim_motion_set_feed_override(&override_queue, 0.5) == SIM_MOTION_OK);
assert(sim_motion_set_feed_override(&override_queue, -0.1) == SIM_MOTION_ERR_RANGE);
assert(sim_motion_set_feed_override(&override_queue, 2.1) == SIM_MOTION_ERR_RANGE);
assert(sim_motion_enqueue(&override_queue, &override_command, 0) == SIM_MOTION_OK);
assert(sim_motion_step(&override_queue) == SIM_MOTION_OK);
assert(sim_motion_read_state(&override_queue, &override_state) == SIM_MOTION_OK);
assert(override_state.position.tran.x > 0.049 && override_state.position.tran.x < 0.051);
assert(override_state.velocity > 0.49 && override_state.velocity < 0.51);
sim_motion_reset(&override_queue);
override_command.flags = SIM_MOTION_COMMAND_FLAG_RAPID;
assert(sim_motion_enqueue(&override_queue, &override_command, 0) == SIM_MOTION_OK);
assert(sim_motion_step(&override_queue) == SIM_MOTION_OK);
assert(sim_motion_read_state(&override_queue, &override_state) == SIM_MOTION_OK);
assert(override_state.position.tran.x > 0.099 && override_state.position.tran.x < 0.101);
}
command.segment = line(9, 10);
assert(sim_motion_enqueue(&queue, &command, 0) == SIM_MOTION_ERR_STATE);
command.segment.motion_type = 99;