WebDMA: Tuning your robot via a web interface (C++)

WebDMA was created to allow our FIRST Robotics team to tune our robot in an easy to use and intuitive way via any modern web browser.

Using C++ operator overloading, WebDMA provides proxy objects that your application can use as normal variables which can be manipulated or displayed by your application via a configurable jQuery/javascript powered Web 2.0 interface hosted by an lightweight embedded web server.

Despite that WebDMA was specifically created for use in FIRST Robotics on the NI-cRio/vxWorks platform, it uses the Boost ASIO portable networking library and Boost Thread portable threads library and is usable on any platform supported by these Boost libraries (tested on Boost 1.38, requires a patch for vxWorks).

A non-functional (but very shiny) demo of the interface is available at http://www.virtualroadside.com/botface/index.html

I’ve created a google code project for this, http://code.google.com/p/webdma/ . Theres currently nothing there yet except the contents of this post, but I just need to import the code into SVN from our team’s private SVN (I’m hoping to do this tonight).

I posted the code into SVN, but I still need to package it and stick some installation/compilation instructions in there. Enjoy. :slight_smile:

Thanks a lot, I think this will be a great way to be able to tune robots! GREAT IDEA!

Update: I’ve packaged a release and added build & installation instructions for FRC.

Download: http://code.google.com/p/webdma/downloads/list
Installation: http://code.google.com/p/webdma/wiki/FRCInstallInstructions

This is really cool, The possibilities are endless. I was planning on developing something similar over the summer, now i don’t have to!

Thanks for posting.

Heres a video of our bot being controlled by the WebDMA interface: http://www.youtube.com/watch?v=sjbSHEmchIQ

This is awesome! Really makes me want to change our team’s code in to C++ so we can use this.

Unless I’ve missed something, I believe you can do this in LabView already. Granted, you can’t use a web browser, but it was my understanding that LabView allows you to modify variables on the fly while debugging the robot.

That feature of LabView was actually the inspiration for doing this – I had been talking to someone, and they mentioned they liked the fact that they could tune their PID controllers while the bot was running. So I figured, why can’t I do that in C++? :slight_smile:

Hey guys,

Is there a chance I could compile this in WindRiver (somehow?) and then call via the JNA in WPILibJ? I realize I could just wait for the new dashboard/netbook thing, but I’d like to work on this in the interim, if at all possible.


I haven’t seen the new dashboard/netbook thing yet, so if its similar to this then I’m looking forward to that…

Honestly, I can’t think of a very easy way to make this work from a non-C++ language. Its not so much a set of function calls as it is a bunch of proxy objects that you call. So you could wrap it, yes, but it would probably be annoying. Why not just use C++ for the moment? Its not like theres that big of a difference between the languages… braces for flames

Yes you can modify values and such in LabView already. It’s just that when you get the browser involved with the internet, the possibilities are endless, rather than a LabView window with controls. I guess it’s possible to run a web server in LabView (there is example code on this) and modify values through that way… Though haha you’ve already done the grunt work for C++. Anyway, independent of this, our team has decided to go with C++. We thought we’d try something new, something that could be more sustainable than LabView. Last year, we had to throw away all our code during competition because we couldn’t download it on to the Robot. (We only used the debug method during season). Anyway, awesome work on this!

I’m not trying to talk you into using LV again. Honestly, I think it is great to get exposure to multiple languages, but I’d like to understand why you decided to throw away your code last year.

As for the web stuff, I’m not certain it is built into the FRC version, but the tools menu should contain a menu item called Web Publishing Tool… This will lead you through a quick wizard that will let you publish your work as a either viewable jpeg updates, or as a web helper plugin that lets you view or take control and manipulate the panel from within a web browser. This tool automatically splits your panel and diagram, leaves the diagram running in one place, and puts the panel on another computer, even in a web browser. The downside is that each client needs to have the plug-in installed.

As you mention, the next, more advanced version of this is to use web services to build your own custom UI that simply invokes diagrams. This is normally done to lighten the communications load or to optimize.

Greg McKaskle

This is really neat, I must say. Kudos to you!

Yes labview can do the same things, and yes a Java robot dashboard will be available similarly, but this is clearly useful for anyone even thinking about using C++.

Some thoughts–
WebDMA is pretty low-level, giving access to specific variables within the runtime environment–which is slightly dangerous—and perhaps a little crude in that you are altering the code execution, as opposed to the conceptual robot behavior.
To be a little more clear, it would probably be better to implement an API for your robot that provided an interface to the robot’s abstracted components, as opposed to providing a pseudoDMA…this is better practice, safer, and logically more sound.
Yes this does have the downside that an API would have to be written specifically to your robot, but on the other hand, you would be describing an arm abstraction(for example) as opposed to a variable deep within the code.

I disagree that it would be a better approach to force a user to create a custom API – however, I believe if one wanted to do that, it would be reasonably easy to either wrap the existing variable classes in something more generic or implement custom classes that do the interaction stuff.

You’re right though that this is very low-level. However, this is an intentional design decision. As a low-level tool, its easy to shoot yourself in the foot. In particular, the fact that a variable can change its value right out from under you can lead to synchronization problems. I believe my documentation discusses some ways to avoid this problem however.

As a display mechanism for debugging, I think this tool excels (and if I got around to adding the ability to chart the incoming data using javascript, it would be even more amazing). I find the ability to take practically any variable declaration and replace it with a transparent proxy object is wonderful for debugging weird problems. I believe there is a readonly option for objects designed for this particular use case so you don’t shoot yourself in the foot too much.

It is my hope that using WebDMA should be really really simple to use and include in your program, and I think that its mostly met that goal. But of course, if you have better ideas, feel free to send me a patch. :slight_smile: Once the build season starts going, I’ll probably be adding more stuff to it as needs are recognized.

I see, and that’s a good point…I suppose you can do a similar thing with java debuggers, but gdb never was that friendly or continuous…
I wonder if the two ideas(API and DNA) could be combined to provide both high level and low level views of the robot…that might be neat.

FYI: I have released an installer that installs the binary version of WebDMA on your robot, and copies the header files to the needed locations for Wind River. There is also a sample program installed for Wind River as well. Very easy for beginners to install and use.

New thread I started for this: http://www.chiefdelphi.com/forums/showthread.php?t=80650