Adding Scripting support to Java

Hello,

I know this should be in the Java section, but I thought i would get any input i could possibly get, JIC.

I am currently working on a method to script the autonomous mode for my team’s robot, and possibly teleop as well. I have no idea where to start, but i do know that I want to start with something like Rhino.

Help please.

Robototes,

Please be more specific.

When/where will these scripts be created, tested and edited? What computing/editing devices will be used to do that work?

What sort of commands do you want to use in the scripts? What sort of (what level of sophistication) execution control logic (looping branching, subroutines, etc.) do you want to be in scripts.

Do you want to use a off the shelf scripting language that has a pre-made interpreter you use; or ar you wanting to string together a bunch of “macros” that you create?

Do you want to be able to have the script use sensors’ measurements or other similar inputs from the robot/environment?

What is more inportant to you: Checking for typo-style mistakes before executing the script, or editing it in/on the robot right up to the moment you commit to using it?

A better description of what you think of when you say “scripting” will get you better answers :).

Blake

What i mean by scripting is the following to find and kick a ball:


BEGIN autonomous
var balls = 2
go forward 0.25 impulse
loop termcon=enabled:
  if kickersense == true:
    stop
    kick hard
    if balls == 0:
      gtfo this loop
    resume course and speed
END autonomous

I want to use some macros that call java functions, much like one would create python bindings for C programs.

I would also have it use sensors, but only the sensors i allow, for instance the boolean sensor that we put by the kicker that detects the existence of a ball before you kick.

if that’s the kind of thing you want, I’d go look for an extendable scripting language for Java (if this was C I would jump to LUA) and add whatever interfaces you need

Perhaps this is what you are looking for? http://www.jython.org/

There was this thread a few months ago on scripting http://www.chiefdelphi.com/forums/showthread.php?t=86025

There are a tens of script languages built on top of Java that can be used. Do you want to pick something that is very complex (Python) or something simple that would support the example above? This goes back to gblake’s post about design details.

You might want to check in with the people from the older thread and see where they are in their development and see if you want to join their efforts. (That many hands make light work thing). Its only a few weeks to the start of fall seasons in the US where most of us do training in new tools. We try not to learn new things during build season, so if you wanted wider use of your idea the time to roll it out is soon.

I won’t hijack your thread to open up the discussion about do you need an Object Oriented scripting language to create winning robot code. There have been some interesting discussions on computer language forums on how “less” is often “more”.