WPILib Test Harness Released!

So after *far* too much time spent on this, I am happy to announce the release of my WPILib Test Harness! For those who aren’t aware, WPILib is the name of the C++ library that FIRST gives to FIRST Robotics Teams to control the robots. The control system is a PowerPC running on a cRio platform designed and produced by National Instruments.

It had occurred to me towards the end of the build season this year that it was really annoying that I could only easily test code while our team was meeting, and of course I stay up late (as evidenced by this post time). So I wrote some stubs, but at some point I realized it would just be easier to make a giant stub for WPILib, since its just a set of classes with some hardware interfaces. It was extremely useful, and as I evolved it I was even able to find bugs in WPILib and the program for our bot.

At some point I decided to bring it in the direction that it is now, and I’ve spent the last week adding things and making the GUI a bit shinier. I’m pretty happy with the results so far, but theres a long way to go before every bot program will run under it. There’s a lot of things that do work, but there’s also a lot of things that don’t work.

All you need to do is get a copy of Visual Studio 2008 Express Edition, and install the wxWidgets GUI toolkit. Since I’m using wxWidgets for the GUI, I anticipate that it will get ported over to other platforms in the future as time (and need for it) allows.

Features/things supported:

  • Run your unmodified robot code in ‘realtime’ (mostly) mode or step in 10ms intervals … unless the portions of WPILib you’re using aren’t supported, in which case something will need to be modified. 🙂
  • Clickable and (hopefully) intuitive GUI interface
  • Supports a joystick attached to your PC
  • All driver station inputs (analog and digital), plus the LCD screen
  • All PWM & Solenoid outputs
  • All analog inputs (interrupts/advanced features not supported.. not well tested)
  • Primary digital GPIO supported (interrupts not supported yet)
  • Skinnable via XRC support
  • Open source (GPL v3)

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. The source code can be found at my FRC software resources page, and is released under the terms of GPLv3.

Download WPILib Test Harness Source Code

Here’s some screenshots:

WPILib Test Harness Screenshot #1

WPILib Test Harness Screenshot #1

WPILib Test Harness Screenshot #2

WPILib Test Harness Screenshot #2

Note: I am not directly associated with or sponsored by WPI, National Instruments, or FIRST (the national organization).

3 Responses to “WPILib Test Harness Released!”

  1. Mark says:

    This is great! Thanks! Quick newbie question… Are the joystick X/Y inputs reversed? I’m practicing with an ArcadeDrive and moving the X axis slider shows two PWMs in the same direction and moving the Y axis slider shows opposing PWMs. My intuition would think this should be opposite based on the specs. But, my intuition/code might be incorrect as well. Thanks!

  2. Cooper says:

    In Simulator.cpp line 84 I had to change the call to AddPendingEvent() to get the project to compile on Visual Studio 2010 with wxMSW-3.0.0 ( wxWidgets)

    // send event
    wxCommandEvent evt(EVT_ON_STEP, 42);
    // Cooper: error C2248: ‘wxWindowBase::AddPendingEvent’ : cannot access protected member declared in class ‘wxWindowBase’
    ///m_controlInterface->evtHandler->AddPendingEvent(evt);
    // SOLUTION: http://wiki.wxwidgets.org/Custom_Events
    wxPostEvent(m_controlInterface->evtHandler, evt);

  3. Cooper says:

    Hello Dustin,

    There was a mismatch between SimulationData.h

    #define DIGITAL_PWM_CHANNELS 10

    and

    Slot 4 and Slot 6 definitions in WPILibtestHarness.xrc

    causing runtime errors and data (widget) loss.

    I also fixed Slider.cpp and MotorDisplay.cpp updateDisplay() drawing problems.

    Please let me know if you want my edits and the process to get them to you.

    …Cooper

Leave a Reply