Critical Development

Language design, framework development, UI design, robotics and more.

Archive for the ‘Robotics’ Category

Fun with the .NET Micro Framework & the FEZ Mini Robot

Posted by Dan Vanderboom on September 24, 2010

Microcontrollers can drive anything from watches and tiny MP3 players to industrial control systems and sophisticated robotics, so the opportunity to write C# .NET code on a small and cheap microcontroller is very exciting.  In April 2008 I wrote an article comparing the .NET Micro Framework to Robotics Development Studio (RDS), since they are both used for driving robotics applications.  RDS requires at least the Compact Framework, which in turn requires Windows CE hardware, which is a good deal more power-hungry and more expensive than tiny microcontrollers that can cost as little as a few dollars each (in bulk, developer kits go for $35 and up).

You may have heard of the popular Linux-based Arduino microcontroller prototyping boards.  These boards have standard ports for plugging in other boards (called shields) for adding functionality such as motor and servo controllers, sensor input expansions, radio communications, and much more.  These are really cool boards, but being a spoiled .NET developer myself, I haven’t been strongly motivated to program without my beloved Visual Studio tools, and hitting the steep learning curve of Linux development just never happens during the little free time that I have.

Fortunately, there are now some .NET Micro Framework boards that are Arduino board compatible, providing you the comfort of .NET development with the ability to use any of the Arduino-compatible boards that are out there.  Netduino is a popular, low-cost ($34.95), open source option that makes it easy for any .NET developer to get started.  Another great Arduino-compatible option is the FEZ Domino board from TinyCLR.com.  It’s more expensive than the Netduino ($74.95), but also more powerful.

I’m also a big fan of Phidgets boards, which are USB and therefore very easily extensible for those unfamiliar with the various microcontroller communication standards.  I wrote an article on Phidgets Robotics Programming where I built a pan-tilt camera system controlled by a Wii remote.

Since I enjoy working with robotics applications so much, I decided to try out the FEZ Mini Robot Kit for $149.95.  This is a great kit for beginners as it includes all the tools necessary and can be assembled within 15-20 minutes.  It uses the FEZ Mini board (included with the kit) which is an astonishing 1.1” x 1.9” tiny.  When not being used in the robot, it would be ideal for my own custom MP3 player as well.

Fez Mini

The robot kit instructions are a bit rough: lots of pretty bad spelling and grammar errors, but the assembly instructions are easy enough to follow.  The worst part is the code.  Getting the various sensors, motors, and other things to work properly requires that you download individual C# files from all over their website: the reflective sensor code is found on their reflective sensor product page, and so on.  Stitching this all together and correcting mistakes took me a while.  It’s also evident that the folks writing this code are not fluent C# developers.  By the look and feel of things, they’re probably used to low-level assembly and unmanaged C development.

To save you some pain and discomfort, I’ve gone ahead and rewritten all of the drivers for all the components involved, and have reorganized it from the perspective of someone who’s been writing business applications in C# since .NET 1.0.  I’ve reshaped the API to look and feel a lot more natural to those unfamiliar with the gory details of pulse width modulation (PWM) and similar protocols.  And instead of delivering individual code files scattered across a website, I’ve packaged them all in one place as a Visual Studio 2010 solution, which you can download here:

FEZ Mini Robot – Visual Studio Solution

Have fun developing!

Here’s the robot in action:

Advertisements

Posted in Micro Framework, Mobile Devices, Robotics | Tagged: , , | 1 Comment »

TechEd 2008

Posted by Dan Vanderboom on June 9, 2008

If you weren’t able to make it to TechEd this year, you really missed out on a fantastic conference and countless opportunities to explore, learn, meet, and connect.

image

I didn’t bring a digital camera, so I take ultimate responsibility for the results, but I was duped into Kodak’s very misleading marketing when I bought a couple of their disposal “digital” cameras.  I found out while developing them at Walgreen’s that it’s actually a film camera.  Apparently they get away with calling it digital because the price of the camera includes having the pictures burned to a CD, which is a digital object.  I still don’t get how the camera can be called digital.  This is dishonest as far as I’m concerned.  Shame on you, Kodak.

So aside from 50 grainy pictures (of memories that are fuzzy to begin with, due to closing the bar every night of the week), it was a great time.  From sessions on robotics and game development, to Carl Franklin jamming on acoustic guitar at the conference center, to meeting and talking with Microsoft employees and others about emerging technologies, and VIP and MVP parties at Charley’s Steakhouse (phenomenal food and service) and House of Blues (thanks Beth!  hi Theresa!), there was something there for every-nerd.

Here’s another bad picture of something I found pretty funny: it’s Windows rebooting on a kiosk at Universal Studios and informing us that we may want to start in safe mode.

image

Here’s one more bad picture, this time of me, at Universal Studios, hanging out with Jaws.

image

I paid particular attention, and even took notes, on the presenters’ speaking styles and skill levels, technical competence, confidence, enthusiasm, audience engagement and participation, humor, as well as the tools they used for zooming, screen annotation, altering UI and font sizes for the audience, etc.  I’ve given some serious thought to submitting proposals for future conferences, and during some of the sessions I couldn’t help but think, “That should be me up there!”

Overall, TechEd has gotten me excited, and sessions often left me wanting to write tons of code and build lots of new programs, from small but useful Pocket PC apps to radical new ideas for libraries, UI frameworks, and robotics control systems.  As The Damonator accurately explained, conferences like TechEd are great for getting you re-energized about development.  It’s been a few years since I was at DevConnections, and I hope I’ll be able to attend these events (PDC later this year, for example) more frequently in the future.

Bill Gates’ Keynote

Bill Gates gave his last public speech Tuesday morning as a full time Microsoft member.  I’ve seen some videos of him online, and I wasn’t blown away by his presenting style.  It’s not very smooth, and he doesn’t seem very comfortable going through a rehearsed script.

However, when it came time to answer audience questions, his intelligence shone through in spades.  His answers were insightful, articulate, and substantive, even when the questions were confusing, long-winded, or occasionally really lame.

Robots

Toward the end of Bill Gates’ keynote, a robot rolled out balancing on two wheels, featuring an LCD screen with a still picture of Steve Ballmer’s head and very articulate arms: the Ballmer-bot is $60,000 of hardware, and I can’t even guess the amount for design and software development.  It balanced on its wheels while the arms extended (changing its center of gravity, which requires compensation), and it announced loudly, “Developers! Developers! Developers!”  Over and over again.  Very funny and well done.  The Ballmer-bot handed Gates his “lifetime XBox Live membership”.  The only disappointing part was the wire that connected this humanoid robot to some kind of game controller.  Why wasn’t it wireless?  As someone pointed out to me, the last thing they wanted for Gates’ last speech was for this robot to get away from them and launch itself into the crowd, injuring someone.  So it must still be in beta.  🙂

I had a chance to meet and talk with Nicolas Delmasso from SimplySim (located in France).  They are experts in 3D simulation.  SimplySim was involved in creating the simulation environment for Microsoft Robotics Developer Studio, which is based on the XNA Game Developer Studio.  SimplySim will likely be working on support for physics to support flight soon (helicopters, airplanes, etc.), as that has been so frequently requested.  How cool would it be to program autonomous aircraft for search and rescue or fire fighting scenarios?  RoboChamps could create same amazing new competitions based on this.

I also attended a session called Software + Services + Robots, which I think is a clever name.  This was about building the RoboChamps competition itself and all of the technology involved, including social/community aspects, Silverlight media content, writing referee services, cameras that can be watched from their website by spectators, and much more.

Session Highlights

There were so many good sessions to attend.  During a few time slots, I found myself annoyed that there wasn’t much to be excited by, but most of the time slots had so many good sessions scheduled simultaneously, it was difficult to pick just one.  In some cases, I didn’t: I went to one for ten or fifteen minutes, and then changed my mind and went to another.

Unity & Prism – Lightweight IoC & WPF Composite Clients

It was during one of these switch-ups that I wound up catching the tail end of one of Glen Block’s talk on the Unity and Prism libraries.  Unity is a lightweight, IoC dependency injection container that is almost identical to one I created about two years ago while working for Panatrack, and which I have redesigned working for CarSpot.  Unity does support some things that I didn’t have any need for, and I really like Unity’s approach: for example, allowing you to plug in your own module loader and module initializer, separately.  Prism is the new composite client framework (they’re cautiously calling it a library now, I think) for WPF, though its concepts can be used in other technologies (like Windows Forms) with some additional work.  This is essentially a redesign and simplification of the same concepts that appeared in the Smart Client Software Factory, and I’m really excited to see support for patterns like MVC and MVP, which I use extensively.  Prism will work with Silverlight (great news!), but neither Unity nor Prism support Compact Framework currently.  If I end up using one or both of them, I will likely port them to Compact Framework, and will contribute to the project on CodePlex so that everyone will benefit.

XNA Game Development on Zune

This was a great lunch session.  Andrew Dunn explained that Game Studio, DirectX, and a few others are all owned by the XNA brand, and he demonstrated not only how to create a game from templates installed from Game Studio, but also how to publish the game on XBox live so it can be rated and reviewed by other game developers.  I’m definitely going to join the Content Creator’s Club so I can play around with this.

Unfortunately, XNA is not supported for Windows Mobile devices.  Zune was chosen primarily because it’s a fixed target, but as Zune runs some version or subset of the Compact Framework, hopefully a Windows Mobile version will emerge sometime in the not-so-distant future.  With 3D accelerator cards and VGA or better screens appearing in awesome new phones like the HTC Diamond, this could be a hot new gaming platform.  Zune is very limited, of course, but it still sounds like a lot of fun, especially knowing that up to 16 Zunes can play via the built-in Wifi.

Data Visualization Applications with Windows Presentation Foundation

Tim Huckaby did a great job and attempted to break the record for the most demos done in a single presentation.  I don’t know if he accomplished his goal, but he did do a dazzling number of nice demos.  He showed off the cancer research 3D molecule application (which strangely plugs into SharePoint), and had guest presenters walk through an application that allows administration, monitoring, and flexible visualizations of all of the slot machines in various casinos around the world.

My favorite demo, though, was a system that manages tours of the San Diego Zoo, the largest zoo in the world, and apparently impossible to see in its entirety in a single day.  Visitors can specify what animals and attractions they’re interested, and the system will map out a path and plan for them, making sure they see animals at the best times (while pandas are eating, at 2pm, for example).

Hardcore Reflection

I eat, sleep, and breathe reflection, so it was a special treat to see Dustin Campbell’s 400-level session on this topic.  I still wasn’t sure I would learn much, but I’m glad I went.  From dispelling myths about reflection’s performance and memory consumption problems (which were real prior to .NET 2.0), to seeing some (albeit simple) examples of creating dynamic methods and emitting IL, I got a few nuggets of goodness out of this.

Mock Objects & Advanced Unit Testing

I saw a presentation at a local .NET User Group about mock objects, specifically with Rhinomock.  Typemock was mentioned, and something peculiar, interesting, and… amazing was happening, and I knew C# was incapable of making use of the code I saw up on the screen, and then someone asked.  It turns out that Typemock uses the Debugger Profiler API to rewrite the code as it executed on the desktop.  A similar approach is used for code coverage in NCover.  Because of the dependency on this API, these tools won’t work for Compact Framework software, and so they’re useless to me.

I do have a plan to bring code coverage to Compact Framework, perhaps even plugging into NCover.  I’ll be writing some articles about that this summer, I’m guessing.

Conclusion

Overall, TechEd was a great experience.  I met a lot of interesting people, was inspired with new ideas, and had seriously geeky conversations with some very smart people.  As I took notes for each session, I found myself jotting down specifications for new applications and tools that I’m eager to start working on, and enhancements and new avenues to explore for ongoing projects that I’ve already blogged about.

Posted in Conferences, Personal, Reflection, Robotics | 2 Comments »