View Single Post
  #19   Spotlight this post!  
Unread 13-06-2010, 19:22
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Using A Scripting Language To Script Robot Behaviour

Integrating a scripting language is not a bad idea, depending on usage.

If you are trying to do a lot of programming that you don't modify much, then scripting is NOT the answer. You can write an interface that acts like a scripting language in C/C++ and compile it.

However...

Autonomous is often modified, so scripting autonomous may be a good idea. I think that the best way would be to create an XML definition for waypoints which the robot will navigate between on its own. You could then use a high-level scripting language to evaluate expressions, such as speed. Example: You are playing Overdrive and must knock down the trackball (or two) of your color. However, you want to slow down until the mechanism to knock it down is ready.

Code:
<waypoint x=35 y=8>
       <curve>0</curve>
       <elev_state>knock</elev_state>
       <speed>14</speed>
</waypoint>
This assumes you want to go 14 ft/sec. With scripting, you could also do:

Code:
<waypoint x=35 y=8>
       <curve>0</curve>
       <elev_state>knock</elev_state>
       <speed script=1>= 14 - ( (35 - nav_d__remain) * elev_error * .1 )</speed>
</waypoint>
Then the robot could evaluate the script to find the desired speed, based on how far the elevator is off and how far the nav distance remains to the target. This would allow it to slow down less when it has more time to get there. The waypoint also has a flag to set the elevator state to "knock".

Using a scripting language in this case would allow the programmer to modify autonomous variables quickly and save the .xml file to the filesystem, eliminating the need for compiling, downloading, and rebooting to make small auto changes.

HOWEVER - you might not need this. A simple XML parser will probably provide everything you need. It all depends on the game.

PS. If anyone does write a Python or other scripting language interpreter interface for LabVIEW, I want a copy.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack