Go to Post Good engineering involves working with constraints, not complaining about them. - Norman J [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-11-2012, 11:35
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
Use Mirah rather than Java for controller code: check out my new library!

Hello!
I'm hoping to get involved with FIRST again this year as a mentor after taking a few years off, but I figured in the mean time, I'd hack something out to help out everyone.

I just released Fresno, a framework that does two things:
  • Generates project folders for Mirah-driven FRC projects and...
  • (eventually) offer a number of convenience classes for making writing FRC code easier

The framework is meant to make it possible to use Mirah (a language that compiles down to Java or JVM bytecode with no runtime overhead at all) to write your controller code rather than Java or C++. Why would you want to do that you might ask? Well, here's a trivial example:

Code:
// Java
public class Excellent {
  public void robotics() {
    java.lang.System.out.println("ROBOTS.");
  }
}

# Mirah
class Excellent
  def robotics
    puts "ROBOTS."
  end
end
As you can see, it's a little cleaner and friendlier (partially thanks to the not-really-demoed-here type inferencing that makes is so you don't have to put type declarations all over the place where a good compiler should be able to figure it out), and adds a few new features like closures:

Code:
arr = [1,2,3,4]

arr.each do |elem|
  puts elem
end
...and more (including some really nice metaprogramming features that make it easy to abstract a lot of complex logic away and some dynamic type handling).

So, if you're interested, head over to my GitHub repo page for the project and fork it/clone it/install it. It's still very early in its development, so the install process could be a little arduous and there are very likely looming bugs. I plan to make the install a little smoother soon, but if you're a brave early adopter, then please head over and check it out. I'm also working on a Mirah tutorial since the documentation for it is severely lacking. If you're wanting to try it out now, poke around on GitHub at the various Mirah projects for some examples.

One thing that would be a huge help: I actually don't have a cRIO board in my possession (yet? Anyone want to lend/sell me one for testing this stuff? ), so while the code appears to build and such, I don't know if it *actually* works on the board. So if any of you get a chance to check it out and try it on a real board, let me know if it works like I think it should. If it breaks (or anything else), file an Issue on the GitHub repo so I can get to work on fixing it.
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #2   Spotlight this post!  
Unread 11-11-2012, 09:43
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Use Mirah rather than Java for controller code: check out my new library!

What capabilities will your framework offer beyond those of WPIlibJ?

Quote:
Originally Posted by Jeremy_Mc View Post
The framework is meant to make it possible to use Mirah (a language that compiles down to Java or JVM bytecode with no runtime overhead at all) to write your controller code rather than Java or C++.
The resources I could find say that Mirah is still in development. Is it a stable enough language to use for FIRST? I'd rather not have to wait 2 weeks for a bug fix during the 6 week build season.

Have you checked that Mirah can be compiled to Java ME CLDC? I know a lot of other JVM-targed languages use reflection APIs behind the scenes that aren't included with the lightweight JVM that runs on the cRIO.
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
  #3   Spotlight this post!  
Unread 11-11-2012, 10:23
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
Quote:
Originally Posted by RyanCahoon View Post
What capabilities will your framework offer beyond those of WPIlibJ?
It actually uses WPIlibj but through Mirah rather than Java proper. The extensions I'm adding will mostly be for adding nice Mirah syntax over the Java methods rather than replacing WPIlib methods totally.

Quote:
Originally Posted by RyanCahoon View Post
The resources I could find say that Mirah is still in development. Is it a stable enough language to use for FIRST? I'd rather not have to wait 2 weeks for a bug fix during the 6 week build season.
It's been in development for some time. It's not perfect but they are rather responsive to fixing bugs! I think it's definitely in a usable state. The good thing is that if you decide that it isn't working for you, you can compile it down to Java source files and switch to Java.

Quote:
Originally Posted by RyanCahoon View Post
Have you checked that Mirah can be compiled to Java ME CLDC? I know a lot of other JVM-targed languages use reflection APIs behind the scenes that aren't included with the lightweight JVM that runs on the cRIO.
That was a concern of mine, too, so I double checked with the creator of Mirah. He said it should work great on J2ME since it compiles down to simple vanilla Java rather implementing a runtime on top of it with weird reflection and generics.
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
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 02:29.

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