Code Structure

On this page

This page contains a very broad look at the parts of the code for Invisible Map. For more detailed descriptions of the ins and outs of the code, look at the pages linked under the Component Details category on the home page.

Currently, the code consists of three main parts: the front-end map creation (Invisible Map Creator), the back-end map processing, and the front-end map viewing (Invisible Map). The code for the front-end parts are in the InvisibleMap repository on Github, and the code for the back-end is in the invisible-map-generation repository.

An important usage note: as of 6/17/2021, maps generated using the code in the master branches of the invisible map repositories are not compatible with the code in the floor-detection and lidar-mesh branches of the repositories and vice versa. The map data was restrucured, thus most maps uploaded to Firebase after this date only work with the newest code.

Invisible Map Creator

InvisibleMapCreator is an iOS app written in Swift and using SwiftUI and ARKit. The most recent version of the map creator is in the InvisibleMapCreator2 folder of the lidar-mesh branch of the InvisibleMap repository. The floor-detection branch of this repository also contains an updated version of the structure of the data collected and includes gathering extra data about the planes detected by ARKit. The most recent code is in the lidar-mesh branch, which contains new UI elements and also uses planes detected by ARKit (especially on phones with LiDAR sensors) to more accurately position tags.

InvisibleMapCreator2 is a restructuring and redesign of the original InvisibleMapCreator app. Marion and Avery describe the code structure in their write-up of their work and also link to more detailed resources to understand the architecture. In summary, the app utilizes a composable finite state machine, which tracks the different UIs (views) of the app. The state machine responds to events which are usually triggered by some user input or action, and can transition between states or emit a command in response to an events. The commands are used to communicate with the main functional components of the app (such as gathering data points). The map creator uploads the data to Firebase, which hosts Invisible Map's data.

The InvisibleMapCreator detects AprilTags as the user walks and also allows the user to save locations at any points of interest they choose.

Map Processing (Optimization)

The back-end map processing code is written in Python and must be run from a Linux machine. The most recent version of the processing code is in the floor-detection branch of the invisible-map-generation repository. The README contains instructions on installing and running the code and its dependencies. The back-end imports the raw map data from Firebase, runs it through the G2O algorithm to optimize the map (phone positions and tag positions), and uploads the optimized map to Firebase for the Invisible Map app to access.

Invisible Map

Invisible Map is an app written in Swift and C++ and using UIKit and ARKit. The most recent version of the code is in the master branch of the InvisibleMap repository. This app pulls the optimized map data from Firebase, and allows the user to pick a map and navigate around a space. The app will show predicted locations of the AprilTags as well as any saved locations as the user walks around.