Go to Post Every thing is a hammer except for the screw driver which is a chisel. - BradL [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-04-2015, 20:52
weaversam8 weaversam8 is online now
Team Captain
AKA: Sam Weaver
FRC #4534 (Wired Wizards)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Wilmington, North Carolina
Posts: 136
weaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to behold
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...
__________________
ORB Haow!

  #2   Spotlight this post!  
Unread 07-04-2015, 20:57
g_sawchuk's Avatar
g_sawchuk g_sawchuk is offline
Taking a break.
AKA: Griffin Sawchuk
FRC #4476
 
Join Date: Jul 2014
Rookie Year: 2013
Location: Canada
Posts: 319
g_sawchuk is just really niceg_sawchuk is just really niceg_sawchuk is just really niceg_sawchuk is just really nice
Re: Javascript Robots!

And I thought this was going to be #teamjavascript
Oh thank you Kamen.
__________________
FRC 2013-2015 (K-Botics #2809)
VEX 2015 - 2016 (W.A.F.F.L.E.S. #4476)
FLL 2015 - ??? (MechMasters #16931)
FRC 2016 (W.A.F.F.L.E.S. #4476)
2016 Dean's List Finalist
  #3   Spotlight this post!  
Unread 07-04-2015, 21:25
nickbrickmaster's Avatar
nickbrickmaster nickbrickmaster is online now
Captain
AKA: Nick Schatz
FRC #3184 (Blaze Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Eagan MN
Posts: 143
nickbrickmaster is an unknown quantity at this point
Re: Javascript Robots!

It wouldn't be that hard if you built it on top of Java's Nashorn interpreter. Summer project?
__________________
I have approximate knowledge of many things.

FRC 3184: 2014-, FTC 10648: 2015-
  #4   Spotlight this post!  
Unread 08-04-2015, 00:15
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Javascript Robots!

Quote:
Originally Posted by weaversam8 View Post
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...
I've definitely considered doing it, and would love to see someone do it.

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.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #5   Spotlight this post!  
Unread 08-04-2015, 07:37
Jacob4564 Jacob4564 is offline
It's always the programmers fault!
FRC #4564 (Orange Chaos)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Brewer, ME
Posts: 5
Jacob4564 is an unknown quantity at this point
Re: Javascript Robots!

It's not entirely implausible, we built our own version of java script to use in autonomous coding.
  #6   Spotlight this post!  
Unread 08-04-2015, 07:53
weaversam8 weaversam8 is online now
Team Captain
AKA: Sam Weaver
FRC #4534 (Wired Wizards)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Wilmington, North Carolina
Posts: 136
weaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to behold
Interesting. Ill definitely look into the HAL interfacing, since Node is extremely capable.
__________________
ORB Haow!

  #7   Spotlight this post!  
Unread 08-04-2015, 13:54
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 597
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: Javascript Robots!

By all means, go for it, but I wouldn't use it.

From: http://nodeguide.com/convincing_the_boss.html

Quote:
But please be careful here, since JavaScript is a dynamic / garbage collected language, your response times may sometimes vary depending on how often and long the garbage collection kicks in (at which point your program is stopped). So don't try to build hard realtime systems in node, that require consistent response times. Erlang is probably a better choice for these kinds of applications.
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #8   Spotlight this post!  
Unread 08-04-2015, 14:23
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Javascript Robots!

Quote:
Originally Posted by connor.worley View Post
By all means, go for it, but I wouldn't use it.

From: http://nodeguide.com/convincing_the_boss.html
Python has similar issues, and it works just fine for what most FRC teams create. Java has potentially similar GC issues.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #9   Spotlight this post!  
Unread 08-04-2015, 14:57
AlexanderTheOK AlexanderTheOK is offline
Guy
no team
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Los Angeles
Posts: 146
AlexanderTheOK is just really niceAlexanderTheOK is just really niceAlexanderTheOK is just really niceAlexanderTheOK is just really nice
Re: Javascript Robots!

Quote:
Originally Posted by virtuald View Post
Python has similar issues, and it works just fine for what most FRC teams create. Java has potentially similar GC issues.
That explains the 250ms lag spikes I've been seeing every once in a while. Any standard way to mitigate this?
  #10   Spotlight this post!  
Unread 08-04-2015, 17:04
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 544
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: Javascript Robots!

Quote:
Originally Posted by AlexanderTheOK View Post
That explains the 250ms lag spikes I've been seeing every once in a while. Any standard way to mitigate this?
Memory management is complicated, so there isn't really a silver bullet you can apply to make it better. To minimize garbage collection, you need to understand why things get garbage collected and why things don't get garbage collected.

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.
__________________
Team 2052- Knightkrawler
Mentor and volunteer

Last edited by Bryan Herbst : 09-04-2015 at 09:44.
  #11   Spotlight this post!  
Unread 09-04-2015, 02:12
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 485
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Javascript Robots!

Quote:
Originally Posted by AlexanderTheOK View Post
That explains the 250ms lag spikes I've been seeing every once in a while. Any standard way to mitigate this?
1) Use a language implementation whose runtime doesn't do garbage collection (this may or may not exist for your language of choice)
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   Spotlight this post!  
Unread 13-04-2015, 11:21
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
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...).
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
  #13   Spotlight this post!  
Unread 15-04-2015, 07:30
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
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   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
  #15   Spotlight this post!  
Unread 15-04-2015, 16:35
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Javascript Robots!

Quote:
Any function (releasing a cylinder, driving a motor) took upwards of 5 seconds to execute
O.O

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?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi