iPhones on Mars
Join the DZone community and get the full member experience.Join For Free
eclipsecon 2010 is over and as always has been a great chance to meet up with fellow committers and users of the software we build. xtext has received a tremendous amount of attention: not only did we deliver several talks and tutorials on xtext, but also did xtext get mentioned in a number of talks we were not involved in. xtext even received the eclipse community award in the category "most innovative new feature of eclipse project".
i presented on xpand, the template engine we use in xtext. of course - as i've demonstrated in my 12 minutes lightning talk - it can be used to generate anything that can be expressed with text, so you can use it in your project, too! i uploaded my slides to slideshare, feel free to browse them .
right after my talk, heiko showed how xtext and xpand can be used to generate native iphone applications - something that he and i are currently working on as a part of our day-to-day job at itemis . heiko's slides also are available on slideshare .
something which - originally - wasn't related to code generation or iphones at all was the e4 mars rover challenge . in this challenge, the goal was to control a mars rover (built with lego mindstorms ) in a mars-like environment by using an eclipse e4 based client and a set of server components hosted on amazon ec2 . in order to win, you either needed to score the highest score or improve the eclipse e4 client. it was left to the developer's fantasy how to improve the client. in order to score the most points, you needed to drive the rover to certain places in the mars arena and present one of two "tools" highlighted on the rover - see the rules of the challenge .
on the first day, i played some rounds with the basic e4 client (you needed to install it on your local machine) and scored quite ok. in the evening, after i dropped off my laptop in my room, it occurred to me that without my computer, i wouldn't be able to take the challenge that evening. "wouldn't it be awesome to use my iphone to control the mars rover", i thought? compared to a laptop, an iphone is a very small device so you can take it with you where ever you go. also, as the mars rover challenge was setup to be a completely distributed system, with the command server being hosted "in the cloud", delivering an image of the mars arena to the clients, i should be able to connect to the rover from anywhere on the world (as long as i have access to the internet).
when i mentioned my thinking to heiko , he was equally thrilled as i was and we immediately set out to take the new challenge of writing an iphone client for the mars rover.
we discussed quite a few interaction patterns we wanted to try out:
- using buttons (much like the cursor pad on a keyboard) to "joystick" the rover
- using a touch interface to control the rover: use pinching to rotate the rover and pointing to make it move in a certain direction
- using the accelerometer to be able to control the rover by tilting the iphone
heiko took on the job of evaluating the human interaction interface, whereas i was busy implementing the interface between the iphone app and the command server backend. the command server of the mars rover is implemented as a restful webservice, so i could use plain http calls to send commands to the server and to retrieve telemetry and imagery data. at first, i used blocking calls and later replaced them with asynchronous calls - sometingh which i'll liekly blog about the next days, so stay tuned. in order to test my code, i implemented a very simple button-based ui. with this ui, i was able to score 2702 points - not too bad!
after just two nights of development time (we wanted to attend the sessions and also had to man the itemis booth), we finally had a slick iphone app that was able to control the mars rover by using the accelerometer. in the nght just before we had to hand in our submission, we shot a video of us driving the rover. you can watch this video on the iphone mars rover website .
here is a little diagram outlining the controls of the application:
we knew right from the start that we wouldn't be able to match the competition criteria (the contest rules clearly state that the client has to be eclipse e4-based in order to qualify). however, we still were eager to work on this project, as it fit very well with our current obsession with all things iphones.
while it certainly is a fun idea to use an iphone app to control a lego mindstorms robot, we would not recommend using this approach for controlling real robots - especially if they're some 55 million km away on mars! signal latency from mars to earth is said to be around 15 to 20 minutes, which suggests to use a move-oriented approach to drive the rover.
nevertheless it has been an exciting and fun project for heiko and me. by the way, we're not only developing iphone apps for fun, but also for profit: we're spearheading the brand-new mobile development division of itemis , so i'm pretty sure we will blog about mobile technology soon.
Opinions expressed by DZone contributors are their own.