Log in

View Full Version : Test Harness Tips


Ben_Farmer
12-02-2012, 19:49
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?

virtuald
13-02-2012, 10:44
Use pygame for joystick input.

If your test harness is general enough, you should consider releasing it for others to use. :) 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 (http://www.chiefdelphi.com/forums/showthread.php?t=94419).

Ben_Farmer
15-02-2012, 19:29
Use pygame for joystick input.

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.

virtuald
15-02-2012, 19:39
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

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

kevinvincent
20-02-2013, 23:53
This might be of assistance with pyGame. http://iamtherockstar.com/archive/making-hid-devices-easier-using-pygame-joysticks/