Test Harness Tips

So on my FRC team we are using C++ as our main language with python as a secondary backup language. We only have the means to test one code language at a time and the C++ half of our programming team always get dibs. This caused me to make a test harness to simulate the CRIO. My question is how do I emulate joystick input with (or without) wpilib?

Use pygame for joystick input.

If your test harness is general enough, you should consider releasing it for others to use. :slight_smile: I’ve been considering making one and adding it to the RobotPy release, but for what we’ve needed simple unit testing (with a fake wpilib) has been sufficient. Check out this thread.

How exactly would I do that? I have read recently that many people use pygame for this but I can’t find anything on how you do it. I don’t really ever use pygame (sadly) so I kinda need some help.

No idea. I’ve not used pygame myself, but I’ve read that it is the thing to use for interfacing with Joysticks. You might also try PyQT as well, I think QT has Joystick support.

For PyGame: http://www.pygame.org/wiki/tutorials

Btw, we have our own test harness library that is associated with RobotPy. See http://www.chiefdelphi.com/forums/showthread.php?t=109678

This might be of assistance with pyGame. http://iamtherockstar.com/archive/making-hid-devices-easier-using-pygame-joysticks/