Skip to content

multiplemonomials/WPILibTestHarness

Repository files navigation

    WPILib Test Harness
    Copyright (C) 2009 Dustin Spicuzza <dustin@virtualroadside.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License v3 as published by
    the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
---------------------------------------------------------------------------

Notice: I am not associated with WPI, WPILib, FIRST, or National 
Instruments! Do not ask them for support!

------------------------
WPILib Test Harness v0.1
------------------------

This is a GUI "test harness" for WPILib/C++ that I developed for the 
team (#2433, the KwarQs: http://www.whsrobot.com ) that I am currently 
a mentor for. This program allows you to run the code that you are 
developing for the FRC cRio control system on a normal computer with minimal
to no modifications (very useful for late night code sessions when you don't
have access to a cRio :) ). 

At the moment there are a lot of things it can do, and a lot of things 
that it can't do. Ideally, uses as much 'raw' WPILib code when possible,
but that doesn't always work out for all features. However, I was able to 
use the early incarnations of this program to find bugs in WPILib itself
and submit bug reports. :) 

Note that the files taken from WPILib (in the WPILib directory and the 
default code sample) are licensed under a BSD license (see the license 
file in those directories), whereas the rest of the code is licensed 
under the GPL v3. Though I am not a lawyer, my reading of the GPL is 
that if you run your team's code in this test harness, then your team's 
code is bound by the GPL if you distribute it with this program. Otherwise,
you don't have anything to worry about.  

Build Requirements:

	- wxWidgets 2.8.x development files installed in c:\wxWidgets
	- A compiler (currently, only Visual Studio Express 2008 is supported,
	but since wxWidgets is cross platform I anticipate multiple compilers
	to be supported in the future. 

	
Steps to build wxWidgets (assumes visual studio is installed):

	- Download the wxMSW zip file from wxwidgets.org (for version 2.8.9, get
	http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.9.zip )
	
	- Extract the zip file to c:\wxWidgets
	
	- Go to c:\wxWidgets\build\msw and open wx.dsw . Click 'yes to all' when
	prompted to convert the project workspaces.
	
	- On the combobox next to the green 'play' button (ie.. debug), select 
	'Unicode Debug' and then click 'Build' -> 'Build Solution'. This will
	take awhile to compile on many machines, so sit back and relax. If you
	want to run the project in release mode, then build the 'Unicode Release'
	configuration also. 
	
	
See http://wiki.wxwidgets.org/Microsoft_Visual_CPP_Guide for more information 
on how to build the wxWidgets GUI toolkit. If you install wxWidgets correctly, 
the included sample code projects should build and run correctly without any 
issues or compiler errors. 


Running the test harness:

This assumes you have wxWidgets built, and installed into c:\wxWidgets. See
above if you haven't done this yet

First you need to build the code. Open WPILibTestHarness.sln with Visual
Studio 2008, and build it. If you have wxWidgets installed correctly, then
things should compile and it should run. 

Just execute the file that gets built from the code. You MUST ensure that
the file "WPILibTestHarness.xrc" is in the current directory, or in the 
directory ../WPILibTestHarness (relative to the current directory), 
otherwise the program will not load. 

In general, I just run the program from the debugger in debug mode, since
this allows you to catch any asserts that may be triggered in the program
(which is good, because it allows you to find incorrect conditions in your
program). 

The default directory structure is setup to work by default, so if you 
need to change anything to run the default code incldued then you're 
probably doing something wrong.


Placing your code in the harness:

The stuff you need to modify is located in "DefaultCode", which contains
the default code provided with the cRio control system. There is also a
program called "DriverStationTest" which shows you the LCD output 
capabilities of the test harness (an extremely useful thing to use on the
real bot!!).

Replace the default sample code in the sample project with your team's code, 
and try to compile. If it compiles, run it. If it doesn't compile, fix the 
error -- if it doesn't compile because a WPILib component is available, then
you will need to add it to the project and either add a stub or the necessary
functionality to make it work (and then ideally, submit a patch!). Hopefully
in time all of the interfaces will be implemented. :) 


Modifying the harness:

TODO: write this. Most of the code is pretty straightforward however. :p

There are hooks in there for a lot of things, but just haven't gotten around
to actually making them do anything yet. I'd also like to do things like
attach encoders to motors in a configurable way, so you can test out more 
complex systems. I don't know if I'll have the time to do that however... 


Skinning the harness:

This program uses wxWidget's XRC resource files to configure how the GUI is
displayed to the user, and there is a wxFormBuilder project included that
you can use to create your own XRC file ( http://wxformbuilder.org/ ) and
customize the display. You can change it to however you want it to look, 
provided that you do not change the names of any of the elements. 


Conclusion:

I found this program to be extremely useful, I hope you find it useful too!
If you find any bugs (what bugs? there are no bugs ;) ) or you have an 
improvement, please feel free to submit patches! If there is enough
community interest in this program, then I intend to create a publicly
accessible SourceForge or Google Code project for it.

Dustin Spicuzza
dustin@virtualroadside.com

About

WPILib Test Harness - A Great VxWorks-around

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published