A pair of iPhone applications for tracking the flight of high-altitude latex meteorological sounding balloons and in-field prediction of flight path and landing location
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SpaceCalc
SpaceTrans
server
README.markdown

README.markdown

Spaceflight Live Tracker

Spaceflight Live Tracker - a pair of iPhone applications for tracking the flight of high-altitude latex meteorological sounding balloons and in-field prediction of flight path and landing location using Jon Sowman's CUSF Standalone Predictor.

About

This repo contains two xcode projects and supporting server side scripts. Location data is transmitted from the SpaceTrans application on one iPhone contained in the payload of the balloon as long as it is below cell tower range. This data is stored on the server and retrieved by the SpaceCalc application running on the second iPhone being used in the field. There is also a separate web interface at predictor/flightmap.php for viewing live flight data through a browser. The SpaceCalc application also calculates the burst altitude and ascent rate of the balloon and uses this data to generate the predicted flight path and landing location of the balloon based on the user's current location. Prediction data used by both the xcode and flightmap are generated by the CUSF Standalone Predictor.

Installation

Set up the CUSF Landing Predictor

Install and configure the [https://github.com/jonsowman/cusf-standalone-predictor/blob/master/README.md](CUSF standalone predictor) on your server in a directory named predictor/. You can find additional installation information on [http://www.srcf.ucam.org/cuspaceflight/wiki/doku.php?id=landing_predictor](this wiki).

Set-up Database

Create a mySQL database on your server. Update server/predictor/map_includes/dbinfo.php with the username, password, and database name.

The SpaceCalc and SpaceTrans use two tables to store and retrieve trip information.

space_message - This table contains messages to be passed from one device to the other, as well as linking the trip identifier (tripid) with the UUID of a prediction generated by the CUSF landing predictor. Create it using the following:

CREATE TABLE `space_message` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tripid` int(11) NOT NULL,
  `uuid` varchar(50) DEFAULT NULL,
  `message` varchar(50) NOT NULL DEFAULT 'Success',
  `timestamp` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `SECONDARY` (`tripid`)
) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;

space_coords - This table contains all location, state, and battery information sent by SpaceTrans, and then retrieved by SpaceCalc. Create it using the following:

CREATE TABLE `space_coords` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `longitude` float NOT NULL,
  `latitude` float NOT NULL,
  `altitude` float NOT NULL,
  `accuracy` float NOT NULL,
  `altitudeAccuracy` float NOT NULL,
  `heading` float NOT NULL,
  `speed` float NOT NULL,
  `tripid` int(11) NOT NULL,
  `appstate` int(11) NOT NULL,
  `batlevel` float NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=61501 DEFAULT CHARSET=utf8;

Install Shell Scripts

Upload checkPred.php, submitLoc.php, and getLoc.php directory containing the predictor/ directory in which you installed the CUSF landing predictor.

All files and folders in server/predictor/ should be uploaded to the predictor/ directory on the server.

The predictor/predstore/ directory must have RWX access. This folder can be used to store prediction data that you do not waant deleted by the CUSF Landing Predictor's CRON cleanup jobs. For now, you will have to find the folder in predictor/press/[uuid]/ and copy it to the predators dir, but future updates will provide the ability to do this automatically.

Install iPhone Applications

You will need xcode to run these applications, and you will need a developer account in order to run them on your devices. Visit the [https://developer.apple.com/devcenter/ios/index.action](iOS Developer Center) for more information. Additionally, these applications are currently in the process of being submitted for approved for distribution in the Apple Store. Links will be provided when the apps are approved.

Both applications have two build configurations, Debug and Release. When running either application build using the "Debug" configuration, debugging information will be printed in the device logs and displayed by the application itself. This is useful for checking for problems and testing the various components of your project, but be sure to use Release when launching your balloon to avoid unnecessary memory usage on your device. You can change the build configuration by selecting the Scheme dropdown -> Edit Scheme -> Build Configuration.

You can build and run the applications on your devices either directory through xcode or by building an .ipa and installing it through iTunes. To build either through xcode, connect your device to your computer, click the Scheme dropdown -> SpaceCalc [your device name], then click the Run button.

Usage

In order to communicate with each other, both applications will require the URL of your server. This URL should point to the directory containing checkPred.php, submitLoc.php, getLoc.php, and the directory containing the predictor/ directory. So if your CUSF landing predictor is at http://mysite.com/predictor/ you would enter "http://mysite.com" (without the trailing slash).

SpaceTrans and SpaceCalc and the server-side scripts use the integer property tripid to identify a specific launch (or "trip"). When launching, the tripid must be the same value on both devices. The CUSF Landing predictor uses a hashed uuid property to identify predictions. It is possible to create a new prediction before or after launch time to replace a previous prediction already associated with a tripid.

Space Trans

The primary purpose of SpaceTrans is to transmit it's location to the server. It contains a very simple interface with fields for the server URL and tripid, a Transmit/pause button, and an "I've been found!" button.

The Transmit/pause button enables and disables location services, which in turn enables/disables transmissions to the server. While transmitting is enabled, the device will listen for changes in it's location and update the server every time it receives a new location object. When uodatig the sever, it will also check for messages left for it by SpaceCalc and adjust the accuracy setting of it's location service accordingly.

The "I've been found!" button alerts the server that the device has been found so that it may update it's interface.

Because of the drain on the battery caused by locstion services combined with the loss of charged caused by the extreme temperatures of near-space, SpaceTrans has several measures of preserving battery life while the device if above the range of cellular towers. When a new trip is started, the application Stste is "heading up" and application listens for changes in it's network connectionand. If it finds thet it has lost connection it will disable location tracking and set it's status to "above towers". Once connection to the network has been reestablished and/or the devices registers a new location update it will resume normal location tracking, setting it's state to "heading down". Additionally, when out of cellular range or if the device has not registered a change in it's location in kTimeInterval seconds, the application will listen for significant location updates (such as connecting to s new cell tower) while "above towers", and will reengage location tracking and transmission when it registers such a location update.

SpaceCalc

SpaceCalc is used in the field before and during your launch. The Calc tab will allow you to input the mass of you payload, the size of your balloon, you desired burst altitude, and the descent rate provided by your parachute manufacturer.

Pressing the Calc button will calculate the amount of helium needed for your balloon and payload to reach your desired burst altitude. It will also kick off the prediction generation scripts which will calculate the expected flight path and landing location of your capsule using your current location as a launch point.

Once your prediction is finished you can click the Map tab to view it on the map. Inputting a tripid and pressing tue Search button will retrieve all location and Stste information from the server that corresponds to that tripid and display it on the map. The blue dot represents the user's location. Clicking on it will display the furred distance between the user and the last reported location of the device (if any). Green pins represent location data transmitted by the SpaceCalc application and the red pin represents the last location received. Clicking on them will display state and altitude information of the device. The predicted flight path is drawn by a purple line, with a purple pin representing the expected landing location. If the "Launch" button has been presses, clocking on this pin will display the predicted time of touchdown. If not, it will display the predicted flight time.

Pressing the "Search" button will start polling for location data from the server, as well as retrieve prediction data, if available. The application will check for updates every 5 minutes and display them on the map as they arrive. You may additionally manually refresh the map and request all data ve retransmitted by pressing the refresh button. Pausing polling will allow you to update the tripid and restart polling, reloading the map with all new location and prediction dats corresponding to the new tripid.

Pressing the location accuracy button labelled "nearest10" will allow you to instruct the SpaceTeans app to adjust it's location accuracy. Remember that increasing the locally accuracy will cause significant increase in battery drain, particularly when setting it to "best for nav". Save this for when you are actually searching for your capsule.

Recommended Launch Procedure

  1. Use the CUSF landing predictor on the day of launch to ensure that your expected landing location and flight path are unacceptable proximity to your desired launch location and do not near any airports, urban areas, or geographic hazards.
  2. At launch location, create prediction using actual weight of balloon and payload using the Calc tab of the SpaceCalc app.
  3. Before placing other phone in capsule, begin transmitting using SpacsTrans app and ensure data is sent successfully. Leave app running in foreground, lock screen, secure device in capsule.
  4. In Map tab of SpaceCalc, ensure that predicted flight path, expected landing locstion, and location data from SpacsTrans is being received from server.
  5. Press the launch button in SpaceCalc as you release the balloon, capturing the launch time and allowing the app to compute the expected landing time.

License

This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This work is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

Credits & Acknowledgments

Kevin James Hunt - SpaceCalc and SpaceTrans applications and supporting scripts Homepage: http://kevinjameshunt.com Email: kevinjameshunt@gmail.com

Server-side prediction software and web interface developed by Jon Sowman, Adam Greig, Rich Wareham, Fergus Noble, Ed Moore and many others.