View Single Post
  #12   Spotlight this post!  
Unread 21-12-2009, 01:22
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: WebDMA: Tuning your robot via a web interface (C++)

Quote:
Originally Posted by spartango View Post
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. Once the build season starts going, I'll probably be adding more stuff to it as needs are recognized.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff