|
|
![]() |
|
Programming on Earth and on H99Coding for Multiple EnvironmentsDifferences of many kinds manifest themselves when coding for the real and virtual worlds. For example, there is no game controller on planet H99 Tech Demo, so code to read the game controller fails to compile. Along similar lines, Roomba requires a string of characters to be sent to it over a serial link to tell it what to do, whereas the H99 robot has motor power for each track under direct program control. A general approach to dealing with these issues is conditional compilation. One set of code or variable values is compiled into the program when building for planet H99, and a different set when building for RoombaVex. A #define statement sets the build environment: VEX or Simulator. Then environment-specific code is wrapped in #if defined(VEX) …code… #endif The code “disappears” when compilation for the other environment happens. An alternate technique, sometimes preferred, is runtime adaptation. The runtime code senses its environment and behaves differently. There is no support for that in these two environments. The differences between real and virtual worlds that affected the design are listed below.
Software Design NotesI modified the original “Hacking Roomba” software to produce roombavex.c containing a loop function which reads the game controller joystick and buttons and called the roombalib.c functions to put Roomba into remote control mode. Some of the interesting adaptations needed were:
|
|
|
|
Using the RoombaVEX/H99 Software |
|
|
|
Installing and Running the Chumby Image Streaming Software
InstallationHere are the instructions for installing the mjpg_streamer program. Commands you should type are in bold. 1. Connect Chumby to your home wifi network and get it configured for normal use as described in the Chumby installation instructions provided with the unit.
2. Find Chumbys IP address by pressing the top button to go to the control panel. Touch the settings button on the touch screen, then the Chumby Info button. Note the IP address displayed.
3. Log into chumby at the IP address from the previous step using an ssh client such as PuTTY. Username root, no password.
4. Plug a webcam into Chumby’s USB port and check that it’s recognized: chumby: |