Go to Post Andy Grady does a great job of running the WayBack machine for us new to FIRST. - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-11-2009, 05:30
alivemyst alivemyst is offline
Registered User
no team
 
Join Date: Sep 2009
Location: California
Posts: 10
alivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of light
Ported: Javascript for 2010

After a solid night of hacking, I've managed to port Mozilla's Rhino Javascript Engine(http://www.mozilla.org/rhino/) over from a half baked J2ME implementation(http://sourceforge.net/projects/rhinoj2mecldc/) to the 2010 FRC Java system--squawk VM etc.
I'll post the code shortly, but some notable features

Running the rhino js engine allows you direct access to Java libraries and classes as well as Javascript code.
Javascript is fully interpreted in rhino(if someone wants to work on a JIT compiled V8 implementation, let me know ), but any Java calls will have equal performance to a normal java setup because they go straight to the JVM.
My implementation of rhino utilizes a socket on the cRIO, allowing users an interactive console with the cRIO as code is executed.

What does this mean for FRC? Well to put this in perspective--
Using this system, you can write as much of your code as you please in javascript(the benefits and conveniences of which are many) and still utilize the robot control libraries that are part of the new WPILibJ.
Using this system you can have an interactive console to your robot, and have code interpreted on the fly--that's right, no deploy, no compile.
[If you are nuts, you can replace your driverstation joysticks with a keyboard and a pair of competent coders, and drive your robot with code ]
You can easily toy with code as it runs on the robot.
You can teach and learn javascript with your team members, which is in many ways friendlier than Java while maintaining an un-weird syntax.
And much more...
Reply With Quote
  #2   Spotlight this post!  
Unread 16-11-2009, 09:02
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Ported: Javascript for 2010

You, good sir, are what we describe as "good insane".

Sounds pretty cool!
Reply With Quote
  #3   Spotlight this post!  
Unread 17-11-2009, 14:58
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Ported: Javascript for 2010

Quote:
Originally Posted by alivemyst View Post
If you are nuts, you can replace your driverstation joysticks with a keyboard and a pair of competent coders, and drive your robot with code
Oh cool. We can save money on joysticks this year to pay for registration. After all, who uses joysticks these days. We play games with a keyboard and mouse. Maybe we'll do that this year.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
Reply With Quote
  #4   Spotlight this post!  
Unread 17-11-2009, 22:55
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Ported: Javascript for 2010

Quote:
Oh cool. We can save money on joysticks this year to pay for registration. After all, who uses joysticks these days. We play games with a keyboard and mouse. Maybe we'll do that this year.
Just keep in mind, the driverstation only passes joystick data.
Just try to plug a mouse or keyboard into the bluebox DS and it gives weird results.
Your mileage may vary.
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #5   Spotlight this post!  
Unread 20-11-2009, 21:47
bronxbomber92 bronxbomber92 is offline
Registered User
FRC #1551 (Grapes of Wrath)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Naples
Posts: 75
bronxbomber92 is an unknown quantity at this point
Re: Ported: Javascript for 2010

How fast does the JIT run on the cRIO (say compared to Java)?
Reply With Quote
  #6   Spotlight this post!  
Unread 21-11-2009, 00:54
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,006
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Ported: Javascript for 2010

Quote:
Originally Posted by biojae View Post
Just keep in mind, the driverstation only passes joystick data.
Just try to plug a mouse or keyboard into the bluebox DS and it gives weird results.
Your mileage may vary.
Aside from the sarcasm in Bharat's post, the 2010 Driver Station has its own keyboard.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #7   Spotlight this post!  
Unread 21-11-2009, 01:48
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Ported: Javascript for 2010

Quote:
Originally Posted by Don Rotolo View Post
Aside from the sarcasm in Bharat's post, the 2010 Driver Station has its own keyboard.
Yes, it may have its keyboard, but only joysticks are passed.
Quote:
Originally Posted by Joe Ross, DS Presentation
Joysticks
● Supports 3 joysticks + Stop button or 4
joysticks without stop button
But, if you could make a keyboard look like a joystick to the DirectInput API it would be passed
http://forums.usfirst.org/showthread.php?t=13368
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #8   Spotlight this post!  
Unread 21-11-2009, 11:46
alivemyst alivemyst is offline
Registered User
no team
 
Join Date: Sep 2009
Location: California
Posts: 10
alivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of light
Re: Ported: Javascript for 2010

Actually, I've written a shell/pair of shells that bypass the driverstation issue--
one exploits the ability of the cRIO to open ServerSockets via javaME's Generic Connection Foundation, so i can pull up a socket on whatever port i like, and either telnet to it or write a proper client app.
The other shell is incomplete, but handles Stdin via an open and undocumented UDP port on the cRIO, passing keystrokes directly to the device. Personally I like the serversocket approach a lot more.

@bronxbomber92: I haven't played with Rhino's AOT compilation system yet, and I know it doesnt have a JIT compiler... so no idea.

On a side note, I'm running into some really nasty hitches in the Java-Javascript wrapper/classloader system, that I believe are the product of the crappy j2me rhino implementation i'm using.
If I cant hack the wrapper system together, I may be forced to switch to a full Java 5 SE version of rhino and will probably retroweave it to work with J2ME. Still that will take a little more work... If anybody knows stuff about this and would like to help out it'd be great. Its eating my hours right now, and I have work.
This is the last hurdle before WPILibJ works fully. If this can be thrown together in a week then it could be released to coincide with the FRC Java release, which would be amazing. 4 Languages for FRC

pm me if you are interested or post here. I can put up a repo &c, although if you are not a beta tester/[hacker] you will have to test your stuff in the SunSPOT environment. Nbd, just no WPILibJ for u!
Reply With Quote
  #9   Spotlight this post!  
Unread 21-11-2009, 12:18
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Ported: Javascript for 2010

Quote:
Originally Posted by alivemyst View Post
Actually, I've written a shell/pair of shells that bypass the driverstation issue--
one exploits the ability of the cRIO to open ServerSockets via javaME's Generic Connection Foundation, so i can pull up a socket on whatever port i like, and either telnet to it or write a proper client app.
The other shell is incomplete, but handles Stdin via an open and undocumented UDP port on the cRIO, passing keystrokes directly to the device. Personally I like the serversocket approach a lot more.
Please bear in mind that using "undocumented ports" or "bypassing XYZ" run a good chance of only working at home. The at home network is intended to be as open as possible, to allow you the best possible prototyping environment. The at competition network is intended to guarantee good communication to all 6 robots, and may therefore deny some things.

If your communication does not adhere to the specified protocol, you will not have a leg to stand on should it suddenly be blocked.
Reply With Quote
  #10   Spotlight this post!  
Unread 26-11-2009, 02:26
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: Ported: Javascript for 2010

As I recall, last year, anything except the standard DS UDP transmissions were firewalled. Some teams built tunneling protocols to sneak video data through, but this would be much more complicated for what you're proposing.

On the other hand, Java...script? I think my brain just exploded.
__________________
Get yer robot source code here!
Reply With Quote
  #11   Spotlight this post!  
Unread 01-12-2009, 23:13
alivemyst alivemyst is offline
Registered User
no team
 
Join Date: Sep 2009
Location: California
Posts: 10
alivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of lightalivemyst is a glorious beacon of light
Re: Ported: Javascript for 2010

Stdin is now being integrated into FRC Java images, so no more undocumentedness.

Also, I'm working on getting the Java5 version of rhino ported, because it is possible to run Java 5 stuff in J2ME -- see sun's playsim project presentation for a hint.
Reply With Quote
  #12   Spotlight this post!  
Unread 10-02-2010, 19:55
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Ported: Javascript for 2010

Did this project die?
Reply With Quote
  #13   Spotlight this post!  
Unread 10-02-2010, 20:05
ygd ygd is offline
Registered User
FRC #3341 (Manhattan Project)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: San Diego
Posts: 26
ygd is an unknown quantity at this point
Talking Re: Ported: Javascript for 2010

If you can get this working, we're almost definately using JavaScript next year.

Even better: Haskell.
Reply With Quote
  #14   Spotlight this post!  
Unread 11-02-2010, 21:15
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Ported: Javascript for 2010

WHy not jython?
Reply With Quote
  #15   Spotlight this post!  
Unread 08-04-2010, 02:54
spartango spartango is offline
Registered User
FRC #0192 (GRT)
Team Role: Alumni
 
Join Date: Nov 2009
Rookie Year: 2008
Location: Palo Alto, CA
Posts: 43
spartango is an unknown quantity at this point
Re: Ported: Javascript for 2010

The major limitation with all of these dynamic languages is that java me doesnt allow for dynamic class loading.
Honestly if we want either of these to proceed, we should go back to stuff like v8 and the original python interpreter, written in C, and compile them for PPC.
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[BB]Award Changes for 2010 yodameister General Forum 15 06-01-2010 00:22
New technology for 2010? Flyin' Axe Technical Discussion 8 05-04-2009 15:39
JavaScript Code for automatic Resize??/ Compnerd Website Design/Showcase 6 01-03-2007 12:41
Help: Looking for javascript countdown script Compnerd Website Design/Showcase 3 24-02-2007 23:44


All times are GMT -5. The time now is 11:18.

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