Saturday Dec 06, 2014

How to Create a Positronic Brain for Your Drone

For this year’s JavaOne, Jim Weaver, Sean Phillips, and I presented a session entitled Creating Our Robot Overlords: Autonomous Drone Development with Java and the Internet of Things. We invested a lot of energy and had a great time developing several components that contributed to a more intelligent drone, and the presentation was well-received. There is SO much to be done, though, and we’re just getting started!

That said, we’ve been slower than we’d like in sharing some of the materials we created along the way, and we’re trying to catch up with some of those housekeeping chores now. This post is intended to provide a starting point and frame of reference for some of our decisions so far, provide some hints to intentions moving forward, and perhaps explain what may or may not make sense at first blush. Think of it as a map legend. :)

We decided early on that there were really two levels of autonomy we could work toward accomplishing, what we referred to very loosely as General Autonomy (GA) and Advanced Autonomy (AA). With the compressed timeline we had for JavaOne, we focussed primarily upon providing a reliable level of General Autonomy. Here is how we differentiated:

General Autonomy (GA): The drone is controlled by its onboard (Raspberry Pi) brain, with instructions issued by the brain via a Java (SE Embedded) program. The brain directs the drone’s movements step by step, e.g. instructing it to move a specified distance/speed/duration in a particular direction. An entire flight sequence is compiled in this manner by the developer, but the Pi executes it entirely from and on the drone itself, with or without external connectivity.

Advanced Autonomy (AA): The drone is controlled by its onboard (Raspberry Pi) brain, but rather than a very specific set of task-based instructions, the brain controls the drone using a goal-oriented - and self-adjusting - program. This requires a much greater awareness by the drone of its environment and the ability to extrapolate an initial framework of behavior based upon instructions further from a list of steps and closer to “navigate around the perimeter of this room at an altitude of approximately 2m/6.5’".

While a great deal of code was (and is) being developed along both paths, we checked into a repository our JavaOne demo code for sharing; more will certainly follow over time.

Just recently, I created a wiki page detailing the steps we used to configure a Raspberry Pi as a "Positronic brain” for our drones (one for each, of course - what kind of mad science do you think we do, anyway?!?!). If you’d like to start working on your own intelligent drone, you can read what we did here and see what you think. This was our "version 1.0" and will change and adapt as platform(s) evolve, but our plan is to keep it up-to-date as we go along.

More updates to follow! This is an exciting area to explore, and as I said earlier, we’re just getting started. Join in the fun! How do you ever hope to stay ahead of SkyNet if you don’t help create it?  ;)


Monday Sep 01, 2014

Join Us at JavaOne 2014!

There are some absolutely SUPERB conferences dedicated to Java (the language, the platform, the ecosystem) around the world, and I’ve been privileged to speak at some of them. No two are alike, and that is a good thing! JavaOne San Francisco holds a very special place in that lineup, bringing together a phenomenal mixture of vision, direction, community leadership, and grassroots innovation that is nearly impossible to describe. You just have to be there!

This year I’m pleased and honored to be presenting in three sessions, sharing the stage with some of my favorite people from around the world: Jim Weaver, Sean Phillips, David Heffelfinger, Geertjan Wielenga, Jens Deters, José Pereda, and James Gosling. As I said, it’s a genuine honor!

Here are the sessions in which I’ll be taking part:

Creating Our Robot Overlords: Autonomous Drone Development with Java and the Internet of Things [CON1863]
Tuesday, Sep 30, 2:30 PM - 3:30 PM - Hilton - Continental Ballroom 4

Who wants a mindless drone? Teach it to “think,” and it can do so much more. But how do you take it from Toy Story to Terminator? This session’s speakers discuss their new open source library, Autonomous4j, for autonomous drone development. Combining this library and some components from their mad science toolkit, they demonstrate how to get your Internet of Things off the ground and do some real cloud computing. In the session, you’ll learn how to write an autonomous drone program with Java 8; deploy it to the drone’s “positronic brain,” an onboard Raspberry Pi; have the Pi guide an AR.Drone to accomplish a task; monitor it via a JavaFX console; and create your own robot overlord. Demos are included: you’ve been warned! 

With Jim Weaver & Sean Phillips

Debugging and Profiling Robots with James Gosling [CON6699]
Wednesday, Oct 1, 1:00 PM - 2:00 PM - Hilton - Continental Ballroom 4

James Gosling recently stated that “being able to debug and profile robots out at sea is a truly life-altering experience.” He uses a set of tools—consisting of editors, debuggers, and profilers—that are part of the NetBeans IDE. In this session, Gosling and other speakers introduce you to these tools and show you how easily and quickly you can program and interact with devices via Java tools. Come see how well integrated embedded devices are with the Java ecosystem. 

With Geertjan Wielenga, Jens Deters, José Pereda, & James Gosling

Java Platform, Enterprise Edition Lab 101: An Introduction [HOL1827]
Wednesday, Oct 1, 10:00 AM - 12:00 PM - Hilton - Franciscan A/B

For anyone familiar with the Java language but without direct Java Platform, Enterprise Edition (Java EE) experience, the capabilities and APIs in Java EE can seem daunting. Documentation is helpful, and well-written books can make it easier to come up to speed, but isn’t the best way to learn something to actually do it? This session’s speakers hope to smooth the path for anyone curious about Java EE by offering a gentle, yet useful, introduction to four key concepts:

• JavaServer Faces (JSF)
• Contexts and Dependency Injection (CDI)
• Java Persistence API (JPA)
• Enterprise JavaBeans (EJB)

Using NetBeans and the bundled GlassFish application server, the speakers present each new concept with live code and then help attendees complete hands-on exercises.

With David Heffelfinger (and gracious assistance from Sven Reimers, Josh Juneau, Bob Larsen, & Bruno Borges)

I’ve said it before: There’s no better place to see what’s happening in the world of Java than JavaOne. Hope to see you there!

All the best,

Monday Jun 30, 2014

Virtual Technology Summit

Every so often, the "Powers That Be" pull together leading voices in various fields and host a virtual technology summit, free of charge to attendees. Guess what? It's that time again!

There are four different tracks, and the "summit" is actually "summits" - there will be THREE of these events, hosted at different dates/times to make it easier for anyone to attend, regardless of where on the planet they may be located. Here are the key details:


  • Java
  • Systems
  • Database
  • Middleware


  • July 9, 2014 09:00-13:00 PST Americas
  • July 10, 2014 09:00-13:00 BST / 10:00-14:00 CET / 12:00-16:00 MSK/GST EMEA
  • July 16, 2014 IST-10:00 / SG-12:30 / AEST-14:30 APAC


For the Java track, key speakers will include Dr. Fabiane Nardon, Reza Rahman, and Angela Caicedo - all respected speakers who know their stuff and convey it brilliantly. Do NOT miss this event!

To Register

Click here to register for the event and save your (virtual) seat!

For More Information

Please visit the Java Source blog for additional details.

Hope to "see" you there!


Sunday Mar 23, 2014

Don't Create Brittle Software

Every developer is a software user/consumer at various levels, and I'm sure that every one of us has run into a dev tool, library, or component that left us cringing. Why is it so difficult to bend to our will? Why does it seem so broken? WHY DID IT STOP WORKING WITH THE LAST UPDATE???

User-facing software shouldn't break or perform in ways that are "ugly", and if your software is a library/component, neither should your API. Whoever your user is, updates shouldn't break things, and failures (of whatever kind) should be handled gracefully. For example...

If your software doesn't facilitate the user's activity, i.e. make it easier, it is at best sub-optimal and may even be unusable. If your library's API doesn't deprecate and migrate changes clearly and gradually, other developers may find it difficult or impossible to use as well.

User Experience (UX) is about so much more than a User Interface (UI). Whatever you develop should be clean, as intuitive as possible to use, and work in expected ways. Highly self-configurable (to the extent possible) is a huge plus as well. If you are developing a library or custom control, its value can be measured by two things:

  1. The ease with which it can be applied to and cover "default" applications (simplicity)
  2. The mechanisms you provide to cover edge cases or "the other 20%" (versatility/extensibility)

These two guidelines apply whether you publish your code as open source or not; after all, the goal of open source software is not to taunt other developers with what could have been and force them to do it themselves.

Keeping these things in mind can help a developer craft better software that is more useful to more people.

Just something that has been on my mind for awhile now...


Have a horror story you'd like to share? Please don't post names - no need for public floggings (!) - but if you have a particularly bad example that you use as a reminder to write better code, please share it in the comments so we can shudder with you. Misery loves company. :)

Monday Nov 18, 2013

MonologFX Update: Timed JavaFX Dialogs

When I wrote the original MonologFX dialogs for JavaFX, I was just trying to clean up a few things I'd done in my earlier project, DialogFX, that I felt could have been done better. Based upon some excellent feedback and suggestions, I rolled out the update...just as the OpenJFX team was releasing their own dialog code that is destined to be in JavaFX/OpenJFX. :-) As I mentioned in this previous post, rather than just hoard the code, I released it anyway in the hopes others might continue to find it useful - and updated the dialogs in the JFXtras Labs library as well - but didn't really expect there to be much continued interest.

I'm happy to say I was wrong. One of my goals was to make a very simple set of dialogs that worked well in most cases and that just "got out of the developer's way" you didn't have to think about extensively to use in your JavaFX application, just "drop & go". They were never meant to be all things to all people, rather a solid option for most use cases. But...

I've gotten some excellent follow-on requests, and I've explored several of them. While I may never have the time to implement them all - and some wander FAR from the original goals - some just fit. One of those ideas was for timed dialogs.

What is a Timed Dialog, and When Would I Use It?

A few developers pointed out that there are occasions when an app is running unattended and dialogs can either a) stop everything or b) pile up by the droves on the user's desktop. And JFXtras implementer Scott mentioned how nice it would be to have an informational dialog that worked similar to a mail notification, popping up and then disappearing after some pre-determined amount of time. The user should also be able to clear the dialog immediately, of course.

Enter the timed dialog. Drawing inspiration from the aforementioned mail notifications and a sample game by colleague Angela Caicedo, I expanded upon Angela's game-switching example to create a (hopefully pleasing) dialog fade in/out effect. Using the number of seconds specified by the developer (you!) via the method setDisplayTime(int displayTime), MonologFX apportions a reasonable percentage of that time to fade in, display, and fade out operations...making user input entirely optional.

What Does it Look Like?

It's much easier to demo than it is to explain, so I created a quick video of a normal dialog, then a timed one, in action. Click here to watch it on YouTube.

Limitations, Caveats, "Keep Off the Grass" Signs

A timed dialog is really best suited for informational dialogs - those where there is no user input required, like the aforementioned mail notifications. If a response is required from a user and a dialog disappears of its own volition, which option should be chosen? The "cancel" option would seem best in some cases, and the "default" in others.

Creating the fade in/out effect required a non-blocking implementation, which meant that it would always return a value immediately...and in the current design, that is "cancel". Which again points to using them as informational dialogs, but not for obtaining user feedback.

So for the foreseeable future, timed dialogs are really focused upon and should be confined to use as informational dialogs. If you need the application user to make a conscious choice prior to proceeding, keep that dialog prominently displayed until you get a response!

Where Can I Get Them?

I've already pushed the code to my Github repository for MonologFX and the JFXtras-Labs 2.2 and JFXtras-Labs 8.0 repos. And if you just want to download a .jar file and kick the tires, I've put a copy in the MonologFX repo's dist folder. Just download the .zip file, unzip it, and run java -jar MonologFX.jar for a quick demo.

Odds & Ends

I also made a few architectural changes to MonologFX this weekend during our first-ever "Thanks For Sharing Informal, International HackFest", and more will be integrated over time. Please stay tuned for more information. :-)

Happy Coding!


The Java Jungle addresses all things Java (of course!) and any other useful and interesting tools & platforms that help us GET IT DONE. "Artists ship," after all. :)

Your Java Jungle guide is Mark Heckler, a Software Architect/ Engineer and Oracle Developer Evangelist with development experience in numerous environments. Mark's current pursuits and passions all revolve around Java, the Cloud, & the IoT, and leave little time to blog or tweet - but somehow, he finds time to do both anyway.

Mark lives with his very understanding wife in the St. Louis, MO area.

Stay Connected


« October 2015