Thursday, August 11, 2011

RC Joystick Control Works

Last night's pygame spew problem was solved by simply not using pygame.joystick.get_axis(). Instead, we just parse the values of joystick events as they come in, rather than attempting to poll the joystick.

After figuring that out, I had moving servos, but they were really twitchy and moving in mysterious ways. Riding home from work on my bike this evening, I realized what was going on: QuacClient.send_control_msg() wants angles, not throttle values. Got that straightened out and things are moving as I'd expect, but I can see that I'll need to add some filtering since noise from the analog sticks is large enough to make the servos twitch a bit.

Also, I figured out how to get pygame to trap ctrl-c so I the client can cleanly disconnect from the quad. We can now quit the client without having to kill the console window, and without having to restart hl_controller.py on the quad.

No comments: