View Single Post
  #14   Spotlight this post!  
Unread 15-04-2015, 10:00
michaelwm's Avatar
michaelwm michaelwm is offline
Integrated Systems Lead
AKA: Michael Midura
FRC #4976 (Rebel Robotics)
Team Role: Programmer
 
Join Date: Dec 2013
Rookie Year: 2010
Location: Georgetown
Posts: 23
michaelwm is a jewel in the roughmichaelwm is a jewel in the roughmichaelwm is a jewel in the roughmichaelwm is a jewel in the rough
Re: Javascript Robots!

This was a small side project for me this year, and i'm finishing it during this offseason. Some useful things we learned that anyone interested in using javascript for their robot:

Don't use Java 8 / Nashorn (their built in JS interpreter):
  • The initial build of Java 8 installed on the roboRIO does not include Nashorn (or any JS interpreter for that matter). See here.
  • It grows exponentially slow. Just printing "hello world!" executes fine. The more code we added, the slower it's execution time got. Any function (releasing a cylinder, driving a motor) took upwards of 5 seconds to execute.

Have an intuitive software design
  • We based our JS design off of the DOM webdesign convention. Driving a motor in JS is as simple as
    Code:
    robot.talon.port3.set(1);
    (Subject to change as we refine our programming model)
  • Aside from being interpreted in real time, JS is the most common language taught in high school programming courses. If you ever want new programmers, an intuitive design based on what students already know (DOM) will attract new programmers like crazy.

Our team is using the Google v8 JS engine (the same engine powering node), and we have had major success. We will be releasing the source soon, but I personally would love some competition!
__________________
Integrated Systems