Entries Tagged 'software' ↓

My Talk at eComm 2008: Imagining Roomba Asterisk and More

I spoke at eComm 2008, held this year in March 2008 at the Computer History Museum in Sunnyvale California.  I’ve been involved in the VoIP and open source telephony world for the last several years as a contributor to Asterisk, hacker on OpenSER and several other projects small and large involving tearing down the 100 year old telephony infrastructure and replacing it with something better different.

If you’re a part of the Asterisk community, you know that I have a certain amount of notoriety as The Roomba Guy.  In a visionary fit of silliness during the Christmas holiday week in 2005, I decided it would be interesting to play with the Roomba API and see if I could hook it up to a Linksys WRT54G wireless router.

  • The Roomba uses an RS-232 CMOS 3.3V interface
  • The WRT54G has an RS-232 CMOS 3.3V interface
  • The Roomba supplies a 14V DC unregulated power output
  • The WRT54G can run off about 12V DC and has voltage regulators

You can see that based on this, the rest is inevitable.  The Roomba has a 7-pin mini-din connector that provides the power and the RS-232 connection, so I made up a cable that goes from that connector to the 10-pin serial header interface on the WRT54G.

I got the serial port working pretty quickly and could send basic hex commands like start and stop to the Roomba.  My friend made up some mounting “rails” to hold the WRT onto the top of the Roomba, and now the thing was autonomous and could be controlled via an SSH session established via WiFi.  The WRT runs the White Russian OpenWRT Linux distribution.

The prospect of controlling the Roomba using SSH or a web interface wasn’t too compelling.  I happened to be aware that some folks had success getting Asterisk (the open source telephony PBX) working on the WRT.  So, I thought, what if we could put Asterisk onto the WRT and control the Roomba with that?

So, I did.  Asterisk was easy to install on the WRT and in pretty short order I had cooked up an Asterisk dialplan that tied the telephone keypad to actions on the Roomba.  2 is forward, 5 is back, 6 turns right, 4 turns left, 5 stops, etc.

I was demonstrating this at Astricon 2006, a few months later, and my friend John Todd suggested that we contact Allison Smith, a voice artist of some renown and the “voice of Asterisk” — she supplied all the default english prompts for Asterisk.

She was incredibly accomodating and obliged graciously.  She recorded about 20 prompts, including “forward”, “backwards”, “right”, “left”.  We also allowed for control of the vacuum and brushes in the robot.  So, you can press 1 to “start sucking” and press 3 to “stop sucking”.  Did I mention that Allison is an incredibly good sport?

So, the final form took shape.  A talking, SIP-enabled, WIFI, autonomous, cleaning, sucking, four-port ethernet switch able to run a small business phone system and clean it at the same time.  It’s really quite baroque in its overall frilly uselessness, yet still compelling in a circus side-show sort of way.

We’ve experimented with adding a camera to it, but have found that it tends to create too much power draw.  I’ve looked at using other routers that can run embedded Linux, but there always seems to be some reason why it doesn’t work.  I really don’t have the time to spend on this, and that’s probably a good thing.

But, the overall lesson is an important one:  Imagination is more important than knowledge.  Einstein said it , but it should be repeated.  As techies, we spend too much time thinking about how to solve a problem, rather than playfully considering new ways of framing problems.  Imagination is truly the plutonium of technology, and we tend to lock it up and not use it that often.  Knowledge is certainly important, but knowledge without imagination is everything that’s wrong with tech today.  Certainly the telecomm industry needs more imagination.

So, Lee Dryburgh, who did an incredible job of organizing eComm 2008 (it’s the successor to the O’Reilly produced eTel conference) posted my presentation from eComm online last week, and I wanted to share it with you.

If you’re interested in more of the Roomba Asterisk specifics, ping me and I’ll blog in more depth about it.

 

Being an iPhone Developer Has Its Privileges

It means you get to pay $99 (plus sales tax). Hopefully in a few minutes I’ll have a certificate to test apps on my iPhone!

See you at iPhoneDevCamp in New York this weekend?

We’ll be sure to have iPhone topics at SocialDevCamp East on May 10!

The Mashup Is Dead

Today I want to rant about a few things I hate. They include:

  • The Word “Mashup”
  • Proclamations of the form: “A Thing is Dead; Long Live that Thing”
  • People Who Insist on Continuing to Use the Word Mashup
  • The Term “Web 2.0”

I know it’s heresy. Mashups and Web 2.0 are what’s hot, right? I myself am considered to be a “mashup creator” working with Web 2.0 concepts.

But that era is behind us. The term “Mashup” made sense when coders were actually lifting data from places it was hard to lift from and putting it into contexts that were hard to access. This, my friends, is no longer the state of affairs on the Internet.

Today, we are working with a world of data that wants to be free and is published via countless, well documented API’s. In the cases where API’s are still not available (or whorishly published in hopes of becoming universally adopted), advanced tools and protocols are available to automate what used to be hard.

We must remember that the word “mashup” hails back to music, originally; a talented music editor might string together pieces of previously recorded music to create something new. This was an artform in itself, and implied a kind of subversion. A repurposing of content, often done without the permission or knowledge of the original creator.

Well, the days of this kind of thing on the Internet are, thanks to everybody’s efforts to open things up, largely over. In a world where open source software is widely accepted, where it makes sense for companies like Facebook, Google, Yahoo, Twitter, Amazon (and gee, every other damn company out there) to publish API’s that encourage their data to be woven into the fabric of the net, there is no need for the coy sense of subversion that comes from the word “Mashup.”

What we’ve got now, folks, is DATA! Great flowing rivers of it! Software that helps us use it! Ruby on Rails, Asterisk, MySQL, PGSQL, Apache, Freeswitch, Flex! Where it’s not open source, it’s at least free! Everything has an API and the things that don’t are falling away.

The next person that says to me with a straight face that they “make mashups” is going to get sucker-punched. The word has lost its meaning, so let’s move on.

That said, explaining to a layperson what it is we “creative coders” do, sometimes you, well, have to resort to saying, “I make mashups.” But do us all a favor, try to explain what that really means today. Let’s move to a world where we can think about data, about tools (which is really just code-as-data), and imagining what we can do with it all.

Mashup was a good word for perhaps 2003-2007, but it implies limitations and barriers that simply no longer exist. We can do better.

What would YOU call the innovations that are possible with all the data and tools we have today?

ActsAsRenderer Brings Output to Models

Judging by the fact that there are several posts about this topic out in the wild, and that I have come across a need for it more than once, I thought it would be helpful to wrap up this functionality into a plugin and put it out into the world. Give a warm welcome to ActsAsRenderer!

Before you go off on a tirade about the evils of violating MVC, let me first say I know the arguments and I agree with you. However, in a world of complex systems where not everything is done via full-stack HTTP, there are legitimate reasons to output data directly from models, and ActsAsRenderer helps you do it.

With ActsAsRenderer, you get four cool new functions.

For your model class, you get render_file and render_string. For your instances, you get render_to_file and render_to_string.

Probably the most common (and legitimate) use of this kind of functionality is for rendering data out of a Rails script (say with script/runner). Since that environment is not a full-stack HTTP view of the world, it’s a real pain to render any kind of structured output. Not anymore! With acts_as_renderer in your model, you can render your views and give your model the voice it’s been lacking!

I’ve had this need come up several times. Most recently, I built a server configuration management system using Rails. While it is nice to preview the rendered configuration files using Rails-over-HTTP, it is also essential to be able to write those same configuration files out to the filesystem. In another case, I had a background DRb process that needed to be able to render templated output to the filesystem. I had to go build a mock-controller and do some pretty unsavory things; all of that would have been obviated with acts_as_renderer.

Now, I can simply say:

class Server < ActiveRecord::Base  acts_as_renderer

  def build_configuration    CLIENT_CONFIG_FILES.each do |f|      render_to_file("configs/#{f}", "#{config_dir}/#{f}.conf")    end  endend

The render_to_file function renders the templates located in configs (under app/views by default) and writes them to the files specified in the config_dir; it’s also smart enough to know that render_to_file is being called from a ‘server’ instance and sets @server accordingly. So my templates in configs are simply:

; Configuration Snippet for Server <%=@server.description%>

<%= render :partial => 'configs/queue', :collection => @server.queues %>

Please do think before using this plugin. It can be used for some seriously evil violations of good MVC design practice, and you are responsible for your own actions. However, this can also be used to make your existing designs *much* more robust and elegant, and I encourage you to use it where that is true.

It’s ready to drop in. Everything is there, including tests. Enjoy!

NOTE: Version 1.0 only supported Rails 2.0; I just added version 1.01 which will work with either Rails 1.2.x or 2.0.x. Please feel free to ping me with any questions.

acts_as_renderer at RubyForge