This project was originally posted on a blog I hosted for a time on WordPress, hence the magazine copy written format. The post was published August 11th, 2012.
In the previous post of this two-part series, I revealed the process by which the binary control signal for the ‘Appcopter’ toy could be deciphered. This was the first step towards the ultimate goal of commanding the helicopter to perform a sequence of predefined manoeuvres, like the well known educational toy robot ‘Turtle‘.
The remaining task is to write a program capable of generating an audio signal that looks like the image below. Chattering the signal out of a computer’s line out port and into the transmitter will send the toy off doing whatever I tell it to, so long as the parameters are within bounds – “fly, my pretty, fly!”.
I immediately set out to use Processing (a Java based programming tool) as my programming tool of choice; it’s a free, cross-platform tool that’s pretty easy to get into. Audio support ‘straight out of the box’ isn’t quite adequate for the purposes of easy audio manipulation, so I opted to plug in a third party library called Minim in order to manage my requirement for dynamic audio generation.
Brace yourselves for some code – there’s no way to make this section any easier than simply posting the full code with explanatory comments. Feel free to use this source as you wish (evil robot swarms excluded).
I’ve tried this code on both Mac and Windows machines – for some reason that I don’t understand, I needed to invert the sign of the signal data on MacOS (see comment in code, within setup function) for the thing to work.
I note that the Appcopter app sets the output volume to max when the transmitter is plugged into the iPhone/iPad. Similarly, you need to set an alarmingly high volume for the transmitter to push out any infrared! Needs an amplifier in there methinks.
In the last post I indicated that the last two bits were some unknown signal element. After further study, this appears to be a control for the ‘headlight’ LED on the nose of the Appcopter. I suspect there may be more to it however – perhaps a ‘reset’ signal? I base this on the discovery that if the signal doesn’t go from 0 to 2 to 1 during a flight, the helicopter can be landed in an inconsistent state within which it’ll not respond to the control signal at all.
Ultimately, my ambition of commanding the helicopter to fly a square kind of worked… Check out the really poor video. I need a proper video camera.
Immediately you’ll note: It’s not a very 'square' square. Uhh no.
I quickly realised the naivety of my ambitions after the first couple of automated flights. The control signal was adequately deciphered, and the program fully sufficient to tell the helicopter what to do in a robotic way. My ‘flying turtle’ kind of worked, being able to draw a (very rough) square! But I expected perhaps a little more… accuracy?
Unlike the Turtle robot I once enjoyed at school, no two of my helicopter’s flights were the same. ‘Tiny’ variables, like rotor positioning at the start of a run, became massive deviations in direction as the flight progressed – reality brings the full weight of the chaos effect to bear on my toy robot! In my control signal I’ve tried to avoid a predictable episode of turbulent disruption caused by ground effect (the helicopter buffeted by its own rotor down wash) by launching up to a respectable altitude and stabilising before setting off. My flying robot with it’s four degrees of freedom (up/down, forwards/backwards, yaw, pitch) is a lot more complicated than a terrestrial buggy already at peace with gravity (and a mere two degrees of freedom)!
So what next? A sensible answer would be to attach sensors, and allow the helicopter to take care of it’s own stability to some extent. But my little toy can’t possibly be expected to carry a load (gyroscopic sensors, distance sensors, altimeter, the list of possible enhancements goes on), and with each new system comes a greater requirement for power, which obliges a bigger battery, which requires more lift, so bigger rotors or more powerful motors… Basically, my explorations with the Appcopter have led me to consider the possibilities of constructing a multirotor helicopter in order to explore ‘real’ onboard flight AI.
LabuntinaIn-app HTML5 Game
Global Game Jam 2020: REPAIRHTML5 Game
Tee and Mo: Little WorldHTML5 Game
Blue Bird3D Art
Gumball Guy3D Art
Helmet Guy3D Art
Wired Eyed3D Art
Cauldron Guy3D Art
Jelly Crab3D Art
The Next StepGame Character
Operation Ouch: Clone WardsHTML5 Game
Word TrainHTML5 Game
Flip and MatchHTML5 Game
Pop and SpellHTML5 Game
Operation Ouch: Snot ApocalypseHTML5 Game
Art Station ChallengeGame Character
Construction Site Lamp3D Render
Iron Man Poster3D Render
Tee and Mo WebsiteWordpress Website
Elmo's Art MakerHTML5 Game
Elmo Loves 123sAIR App: iOS and Android
All Star RacingHTML5 Game
Paw Patrol Air PatrollerHTML5 / HAXE Game
Crabtree PlusWordpress Website, HTML5 games
Tee and Mo Face PaintingHTML5 Game
The OctonautsHTML5 Website, Flash games
Tee and Mo Playtime (iOS, Android)AIR App: iOS and Android
Tate AirbrushFlash Game
BAFTA KidsVideo Appearance
Let's PlayUnity3D/Flash Game
Tree Fu TomFlash Games
Richard Hammond's Blast LabFlash Game
Zingzillas: The Great Coconut AdventureFlash Game
Stareoke StagefrightFlash Game
Blue Peter: Turkish BizarreFlash Game
Big and SmallFlash Game
The Right MixFlash Game