|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Re: Javascript Robots!
I'm down as well (I was actually planning to do JavaScript this season but the teams member count was really low so I had no time).
Stuff that would need to be done 1) WPILib for JavaScript 2) JavaScript interpreter for the roborio (Java has on built in, there are some good cpp ones available) 3) sample projects 4) code development tool, preferably cross platform (recommended javafx or Qt) 5) rio tools (flasher If necessary, code dashboard, JavaScript rio interface) 6) code deployment tool 7) debugging tools 8) (optional) Js native interface tools (for running hard vision processing loops, sensor feedback loops, etc) I'd be interested in learning Qt if there were enough other people to support the rest of the project (else I'd do something simple like a ftp server attached to sublime) Last edited by Arhowk : 15-04-2015 at 07:32. |
|
#17
|
||||
|
||||
|
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):
Have an intuitive software design
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! |
|
#18
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
How exactly are you doing this...? Assuming you're just throwing the talons inside of a SimpleBinding, 5 seconds is absolutely monstrous. Are you doing something wierd like interfacing with the HAL layer directly from JavaScript? |
|
#19
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
. The problem is with the amount of scripts / the length of scripts. If your program had just a single script that said Code:
talon.set(1) We're switching to v8 because it utilizes JIT compilation. We are using the roboRIO's file system to store scripts, and the program compiles them at startup (during queue, for example), and never touches them again, unless our development mode is active. In this case, an external file watcher on the development machine watches for changes to javascript files, and when it detects one, sends the changes to the roboRIO, which stores the new file on the File System, and recompiles it. This minimizes execution time to instantaneous during competition (as no compilation is done during a match because no development is active), and much shorter times than the current java/c++ compilation times for WPI/eclipse. |
|
#20
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
|
|
#21
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
Code:
robot.elevatorMotor = robot.pwm.port3 Code:
robot.elevatorMotor = HAL.getMotor(3) |
|
#22
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
The robot.pwm.* or robot.port* notation is interesting, but it's probably mostly useful for retrieving objects, instead of actively using them that way. Consider 'robot.arm_motor.set()' vs 'robot.pwm.port2.set()' -- if you ever change what port your arm motor is attached to, then you'll have to change it everywhere in code if you use the second notation everywhere. However, it could be a more useful way to create these objects. Maybe something like robot.pwm.port2.createTalon('arm_motor') automatically creates a robot.arm_motor attribute. |
|
#23
|
|||
|
|||
|
Re: Javascript Robots!
Hi all, I just saw this thread and got super excited.
I've been wanting a JS alternative since I started doing FRC 3 years ago. I was thinking it'd be fairly straightforward to implement RobotJS as a node add-on, but going with the v8 engine directly may be better. I was thinking it would be nice to use the built nide modules like fs if necessary so that was my attraction to the add-on route. As far as syntax, couldn't you do something like: var wpilib = require('wpilib'); var robot = new wpilib.IterativeRobot(); ... robot.liftMotor=new wpilib.Talon(1); which is a very nodejs idiom. Thoughts? |
|
#24
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
The great thing about using v8 directly instead of Node is that you get to choose your syntax and the way your programming team scripts it's robot. Go nuts! |
|
#25
|
||||
|
||||
|
Re: Javascript Robots!
Resurrecting an old thread.
Did anything come of this project? I'd be interested in helping or taking a look at how it turned out. |
|
#26
|
||||
|
||||
|
Re: Javascript Robots!
Toast has support for the Oracle Nashorn JS engine, which integrates directly with the JVM. https://github.com/Open-RIO/ToastAPI
You can write your robot program in .js files and we provide some common hooks to things like motors, logging and other stuff |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|