Artoo: Ruby on Robots
artoo.io
artoo.io
I'll always applaud creative projects like this but I'm not optimistic about the longer term health of Ruby at this point.
It already did, with Puppet, Chef and Vagrant.
Also, mruby is gaining adoption and Rubymotion seems to be in an interesting niche.
There's a lot of new projects currently (like Lotus), so I wouldn't as negative as this.
Also, don't ignore the foothold that Ruby has in the asian markets.
Chef, in my experience, is favored almost exclusively by people who are already Rubyists. The concept of applying The Power Of Ruby (TM) to system configuration is not attractive to non-Rubyists.
I don't see Vagrant much these days. I suspect Docker is displacing it.
Also, Docker may become more popular but I doubt it is going to replace Vagrant. There are just too many times where you need a full VM instead of a container process. Not every problem can be solved with containers.
You can have static typing with InfraRuby (at http://infraruby.com/live), and it's opt-in in the sense that InfraRuby code runs on Ruby interpreters without modification, but (un)fortunately InfraRuby doesn't support reflection so it doesn't run Rails.
Me personally, I tinkered with Ruby when Rails initially came out and it was about it, as it didn't brought anything new to my toolset.
I say this because as nice as Ruby is (at least in some ways), someone already familiar with Lisp or Smalltalk will learn nothing new from it, and yet there are no shortage of blog posts by Rubyists touting its borrowed features as if they didn't exist before Ruby, suggesting, perhaps, ignorance on the part of its more vocal advocates and of those persuaded by them
But I didn't have a good excuse to really use it at work until Rails came along and completely blew the existing Java frameworks out of the water for productivity.
And that is incidentally why I have no interest in Lisp or Smalltalk. I have a very visual interpretation of code. I can remember the visual layout of programs I worked on 20 years ago. Those visuals matters greatly to me to be productive with code, and means I am extremely picky about formatting that works for me, and I have nothing but hate for the layout of Lisp and Smalltalk code.
I'm greatful for all the great stuff to have come out of Lisp and Smalltalk. I just pefer to use those features in the nice embrace of Ruby syntax.
It's really unfortunate that the MRI devs won't support Rubinius or event adopt RSpec to ensure interoperability with it:
http://rubini.us/2014/12/31/matz-s-ruby-developers-don-t-use...
While there are lots of productive, opinionated Ruby developers, the vast majority of us don't know much about the internals of the language.
Heck, for my part I'm working on a Ruby compiler (and have been writing about it for 7 years now... Unfortunately I have far too little time to devote to it), and part of the challenge is that there's no proper language spec and even most people working on MRI does not know the full semantics of the language.
My favourite example of this, is that for a long time during the 1.8.x, the inheritance of one of the core classes was different than what was documented - I wrote an article about the Ruby object model and was "corrected"; except my diagram had been created based on instrumenting the interpreter to verify what actually happened. It was like that for years without anyone noticing (and to be fair, it was a dark corner of the language - very little code depends on the specifics of the inheritance of the eigenclasses of the core classes).
Of those of us who love Ruby and are interested in compiler technology and have the motivation to slog it out to try to get working compilers - whether JIT or AOT - there are extremely few.
And most of that effort is going into JRuby, which is definitively seeing some impressive improvements (e.g. with Truffle) but which a lot of us avoid because of the JVM.
Ruby will get faster. And will get better implementations, but it may still take some time to have much impact.
The issue is more complex than Brian puts it.
https://lobste.rs/s/oozjtg/matz_s_ruby_developers_don_t_use_...
Also, MRI makes great improvements every version _while keeping breaking changes rather low_. Changing a running system is hard.
If jitting is what you want, JRuby is a very good option.
Besides that I don't really get the fuzz about the particular tweet mentioned. This was in regard to various small changes being made that while nice were not very significant in the grand scheme of things.
Sure, it's a political debate, but just saying they don't run it also isn't honest.
I'm also very optimistic on the future of JRuby, as with the new 9000 release it has the potential to bring Ruby speed in line with base Java. It's got decent corporate backing now as well with Red Hat and Oracle funding people to work on it.
From https://github.com/rubygsoc/rubygsoc/wiki/Ideas-List#mri-mat...
"List of ideas for improving Ruby during Google Summer of Code 2015", little summary:
- Fine-grained locking (a.k.a. removing the MRI global lock)
- JIT Compiler
- Type System
- New C Extension API
- Cross-thread Fiber support
Firstly I love what the folks are doing with 'thehypridgroup'are doing with Artoo however:
I teach Raspberry Pi Workshops in Australia (raspberry.piaustralia.com.au/workshop). I initially used to teach the workshops using Artoo, however I found it buggy.
I've since migrated the workshop to Python. I'd prefer to do the workshops in Ruby, but the gems have not kept up to date with the new hardware.
I also don't believe this will work with the Raspberry Pi 2 Model B (the current generation Raspberry Pi).
I haven't tried on other platforms recently.
They gave a pretty cool demo @ last year's GopherCon [2]
[1] http://gobot.io [2] http://youtube.com/watch?v=Va-NE55AqBs
I forgive them though because they probably just call it "Ruby on Robots" for the parallel pun to "Ruby on Rails" rather than to make people think it actually runs on the robots.
Running on such a device, it can in fact control other supported platforms connected to it, such as the Leap Motion or Sphero (with addon hardware as applicable).
For simpler stuff like the Arduino (or other micro-controllers), however, Artoo needs to run on a beefier host platform and connect to the device remotely.
[1]: http://beagleboard.org/black [2]: http://www.raspberrypi.org
Essentially, don't confuse the general robot with the highly specialized Arduino.
I agree, I don't know if Ruby is the greatest choice for a language so close to low-level. But, I am glad it (artoo) exists
If you stick to threads, then there is the global interpreter lock, yes, but that has much less impact than people tend to think unless you depend on lots of poorly written C extensions. Especially on small systems without lots of cores.
And you don't need to stick to threads.
And you don't need to stick to threads.
Anyway, the GIL makes no difference to the level of parallelism of most Ruby apps unless you're on a server with lots of cores, so all you're really saying is that "true parallelism" is irrelevant for most use cases.
On a server with lots of cores, it can start becoming a constraint if you can't use multiple processes for some reason, but if you become constrained with it on the type of small systems this is intended for you're doing something very wrong.
ROS has some pretty significant infrastructure laid down, and has bindings for C and python. It probably wouldn't even be too hard to create a Ruby binding if Ruby is your thing.
However, I'm not aware of any significant ecosystem software written in it, so it's definitely of the experimental flavour.
That said, the ROS 2.0 plan is to build generic header interface to the standard client library so that the language support is a matter of generating bindings rather than reimplementing serialization code and so-on.
There are currently horrible bugs in the very foundation of ROS, the spec of the serialisation format and its hashing, that are in `wontfix` status because the maintainers are idiots.
The arity of a field (value, array [and its arity], list) is not part of the hash of a message definition. Thus it is possible to change a message definition breaking existing protocols without the clients noticing. This is a hard to detect bug, that I've seen several times in the wild. But it won't be fixed because it would break old precompiled packages (yes one would have to recompile things gasp). So instead everything is left broken.
But hey I heard they want to change the messaging protocol to CORBA for 2.0, what could go wrong with that...
We use ros serialization quite intensively and I would have to say it "works fine". I previously came from a more enterprise-centered environment working with a rabitMQ/Protobuff&Json stack, so I probably wouldn't have created ROS serialization the way the maintainers did, but it hasn't gotten in our way at all.
I don't think it's that great of an idea to place too much validation in a serialization framework, as your are just asking for rigidity, which is why Json went the way they did and is much better for it.
ROS serialisation format is basically a C++ struct that gets send over the wire. You specify your .msg definition, tell the (horrible) build system that you want to use it, and the build system will compile it to deserialisation code in your language. During deserialisation of C/C++ this code will just try to recast the message from a void* buffer to a valid .msg struct.
So O(1) message parsing, nice in theory, but also what causes the rigidity that makes it harder for dynamic languages that would easily be capable to deal with a self-encoding message format.
But because you end up with this unsafe recasting "parser", you _really_ want to feed it what it expects, and this is why during tcpros handshake between two clients they will exchange hashes of the msg format that they speak.
Note that this is fundamentally different from JSON where you are adding fields. JSON _will still work_, as long as the new message is a superset of the old one.
But with ros msgs a command might end up putting your nice robotic arm into the table/human because you changed the LED from a green one to a multicoloured that has a field `color[3]` instead of `color`. The field will use up more space, and the field that came after it, say `arm-height`, will now have the color value in it.
But we got the hash of messages to protect us from this right?
NO! Because the build system does a half assed normalisation step on each .msg format in which it removes comments, reformats and reorders fields and tries to find the canonical _textual_ representation of messages. Sadly somebody forgot to keep the arity (variable/tuple/list) in there. So it gets thrown out and is not part of the hash.
Source: I build a ros-msg deserializer from scratch for clojure that can import message definitions at runtime, compiling them into ad-hock deserialisers.
Especially if you have to convince a court to stop that company from doing something which seems identical to what you've already allowed three other companies to do.
These things are always so easy to see, so obvious, when you're one person; the moment you have to convince others, things so obvious as to not require elaboration become serious points of contention.
I don't think Disney would know a "playful homage" if they read it in a book of traditional fairy tales.
How can you control the speed of the robot proportional to the pressure applied on the joystick for example?. However, I was very pleased with the WPILib framework that comes with the kit. This can be accomplished by essentially a single line like (ignoring the variable initialization),
myRobot.arcade(stick);
http://wpilib.screenstepslive.com/s/4485/m/13809/l/145307-cr...The hot code-loading is really impressive; I've seen quadcopters update motor controllers in-flight to fix bugs. I think that that's probably the future. The non-blocking stuff in Node is more a function of the library style than the language itself (though the closures make life easier). I don't think there's any reason why the Ruby stuff necessarily has to be slower and blocky.
Artoo has some nifty stuff in the vein of testing: