Handle keys to change position setpoint and perturb angle
This commit is contained in:
parent
9d31085e80
commit
284c12a695
16
main.c
16
main.c
@ -150,6 +150,22 @@ int main(void)
|
|||||||
while (SDL_PollEvent(&e)) {
|
while (SDL_PollEvent(&e)) {
|
||||||
if (e.type == SDL_QUIT)
|
if (e.type == SDL_QUIT)
|
||||||
goto quit;
|
goto quit;
|
||||||
|
if (e.type == SDL_KEYDOWN) {
|
||||||
|
switch (e.key.keysym.sym) {
|
||||||
|
case SDLK_LEFT:
|
||||||
|
pos -= 0.1;
|
||||||
|
break;
|
||||||
|
case SDLK_RIGHT:
|
||||||
|
pos += 0.1;
|
||||||
|
break;
|
||||||
|
case SDLK_j:
|
||||||
|
state.a -= 0.1;
|
||||||
|
break;
|
||||||
|
case SDLK_k:
|
||||||
|
state.a += 0.1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double k = control(&state, pos, dt);
|
const double k = control(&state, pos, dt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user