|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Javascript Robots!
I develop full stack Node.JS professionally, and I've seen the power in Javascript. Would anyone be open to building a collaborative framework for the RoboRIO to code in Javascript?
Seems rather promising to me... |
|
#2
|
||||
|
||||
|
Re: Javascript Robots!
And I thought this was going to be #teamjavascript
Oh thank you Kamen. |
|
#3
|
||||
|
||||
|
Re: Javascript Robots!
It wouldn't be that hard if you built it on top of Java's Nashorn interpreter. Summer project?
|
|
#4
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
RobotPy (the python port) is pure python this year, only interfacing to the robot at the HAL layer. If you're going to do this, I would highly recommend going that route instead of trying to write bindings for WPILib. Expect to spend 2 months of effort translating WPILib into Javascript if you want to do a full port. We did C++-based bindings for a number of years, but having everything be pure python (or js) means you can run the actual robot code on your laptop, which is great for testing + simulation. There's a lot you can learn by looking at how RobotPy is implemented -- and if you implement HAL the same way we did, then you can use our HTML/JS simulator interface (not quite ready, but almost there)! If you want to write a robot dashboard in HTML/JS, we've got that covered. |
|
#5
|
|||
|
|||
|
Re: Javascript Robots!
It's not entirely implausible, we built our own version of java script to use in autonomous coding.
|
|
#6
|
|||
|
|||
|
Interesting. Ill definitely look into the HAL interfacing, since Node is extremely capable.
|
|
#7
|
|||||
|
|||||
|
Re: Javascript Robots!
By all means, go for it, but I wouldn't use it.
From: http://nodeguide.com/convincing_the_boss.html Quote:
|
|
#8
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
|
|
#9
|
|||
|
|||
|
Re: Javascript Robots!
That explains the 250ms lag spikes I've been seeing every once in a while. Any standard way to mitigate this?
|
|
#10
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
Garbage collection generally occurs when Java decides it needs more memory for new allocations. Objects that are no longer referenced are eligible to be collected. If you feel as though the garbage collector is running too often, it is likely because you are allocating too many objects too frequently. For example, if you have a loop that creates a new instance of an object in every iteration, those objects can pile up quickly. Last edited by Bryan Herbst : 09-04-2015 at 09:44. |
|
#11
|
||||
|
||||
|
Re: Javascript Robots!
Quote:
2) Use a specially-tuned "low latency" garbage collector implementation (you probably need to test that it actually works properly for your application's usage pattern though) 3) Avoid heap allocation (to the extent that you can - just running the required libraries may produce a considerable amount of garbage, you'd need to check this) You might also consider manually triggering a collection frequently so that less work is done each time it runs. For example, you could have it so that every time the robot got a packet from the driver station it would run an iteration of the control code and then do a GC. You would have to see how long the pause is to see if that would be acceptable. |
|
#12
|
||||
|
||||
|
Re: Javascript Robots!
I AM GAME! I would love to run a Node.js application on the roboRIO and use our DriverStation.js (Node-Webkit) DS with it. (once we get the 2015 protocol unearthed...).
|
|
#13
|
||||
|
||||
|
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. |
|
#14
|
||||
|
||||
|
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! |
|
#15
|
||||
|
||||
|
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? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|