You are on page 1of 13

TABLE OF CONTENTS

Content
1. INTRODUCTION ..................................................................................................................................... 2
1.1 Purpose of the Document: .............................................................................................................. 2
1.2 Repository Information ................................................................................................................... 2
2. Summary of changes ............................................................................................................................. 2
2.1 Project Structure Improvement....................................................................................................... 2
2.2 Challenges with Previous Yoozoo Code........................................................................................... 2
2.3 High-Level Overview of Changes Made ........................................................................................... 3
2.4 Summary of New Features .............................................................................................................. 3
Real-Time Location System (RTLS): ................................................................................................... 3
Compass Feature:.............................................................................................................................. 3
Mapbox Integration:.......................................................................................................................... 3
ASTAR Enhancement: ........................................................................................................................ 3
3. Coding Guidelines .................................................................................................................................. 3
3.1 Folder Structure............................................................................................................................... 3
3.2 Script Structure:............................................................................................................................... 3
3.3 Coding Standards............................................................................................................................. 4
4. Appendix ............................................................................................................................................... 4
1. INTRODUCTION

1.1 Purpose of the Document:


This document serves as a comprehensive guide to understanding the modifications, updates, and
additions made to the original Yoozoo code, as well as providing insights into the rationale behind
these changes and their implications for future development and maintenance.

1.2 Repository Information


Repository Name: hap-indoor-navigation-mapbox-AR

Branch: feature-direct-ar

URL: hap-indoor-navigation-mapbox-AR - Repos (azure.com)

2. Summary of changes

2.1 Project Structure Improvement


The previous Yoozoo codebase suffered from what is commonly known as "spaghetti code." This
term refers to a codebase characterized by a lack of clear separation of modules and dependencies,
resulting in a complex and tangled structure. The codebase was challenging to navigate and
understand due to its highly interconnected nature.

2.2 Challenges with Previous Yoozoo Code

• The lack of clear structure made the codebase difficult to maintain and extend. Any
modifications or additions to the code often resulted in unintended consequences due to
the intricate dependencies between different modules.
• Debugging issues was a significant challenge. Identifying the root cause of bugs or errors was
time-consuming and often required tracing through multiple layers of code, further
exacerbated by the tangled nature of the codebase.
• The unsustainable nature of the codebase became increasingly apparent as the project grew
in complexity. As new features were added and requirements evolved, the lack of
organization made it difficult to scale the codebase effectively.
• Additionally, the pathfinding algorithm relied on Unity's built-in functionality, which may not
provide the desired level of accuracy, especially in real-world scenarios. Furthermore, the 3D
models created had issues with exact scaling to the real world, impacting the accuracy and
effectiveness of augmented reality (AR) functionality.
2.3 High-Level Overview of Changes Made
• Implemented a clear and distinct project structure using an entity-data-system model for
better organization and maintainability.
• Added Real-Time Location System (RTLS) to recognize user start locations using AI.
• Integrated a compass feature to enhance RTLS accuracy.
• Replaced 2D maps and path generation with Mapbox integration for accurate real-world
scaling and obstacle avoidance.
• Enhanced ASTAR functionality to provide precise location coordinates based on real-time
photo submissions.

2.4 Summary of New Features

Real-Time Location System (RTLS):


Recognizes user start locations using AI for improved navigation accuracy.

Compass Feature:
Utilizes the device's built-in compass to enhance orientation accuracy in conjunction with RTLS.

Mapbox Integration:
Provides accurate real-world scaling institution maps and handles path generation, eliminating the
need for manual map and path setup within Unity.

ASTAR Enhancement:
Allows users to submit real-time photo locations, returning precise location coordinates.

This summary encapsulates the major changes made to the project structure, as well as the
introduction of new tasks and features aimed at enhancing navigation accuracy and user experience.

3. Coding Guidelines

3.1 Folder Structure


Folder Structure
Entity Contains entity-related scripts, assets, and configurations.
Data Contains data-related scripts, assets, and configurations.
System Contains system-level scripts, managers, and core functionalities.

3.2 Script Structure:

Script Structure
Variables Contains fields and properties used in the script.
Lifecycle Flow This section contains methods related to the basic flow of the script.
Public Access Includes publicly accessible elements like methods, fields, or properties.
Modules Contains methods responsible for handling script operations.
Callbacks Contains methods responsible for handling script event callback functions.

Interfaces This section includes implementations of specific interfaces required by the


script.

3.3 Coding Standards


• All private methods must have aggressive inlining.
• Variables are grouped by functions first then public/private.
• NoteBehavior is always on top of SerializeField.
• Use camel case for variables and method names.
• Use Pascal case for class names.
• Callbacks must have Callback in their function names.
• Always use LogMessage.Debug instead of Debug.Log.
• Ensure all custom scripting symbols start with a prefix “NTT”

By following this folder structure, developers can easily locate and manage scripts, assets, and
configurations within the project. It promotes organization and clarity, facilitating efficient
development and maintenance workflows.

4. Appendix
Overview of Tasks
# Summary Description
1 Task: Create AR Destination Canvas Added the following features:

* Replace direction arrow with human walk image

* Distance to show distance to last point instead of next point

2 Task: Create AR UI * -On first load-

** -Display canvas to show AR is trying to track-

** -Disable canvas once AR has started tracking-

* -On AR lost track-

** -Display canvas to show AR has lost track + reason of lost track-

** -Disable canvas once AR has resumed tracking-

* On quit AR

** Display confirmation pop up

*** Are you sure you want to end journey?

* -On AR tracking-
# Summary Description
** -Display dragging mini map to allow simultaneous usage of both mini map and AR
tracking-

3 Taking RTLS photo should automatically trigger AR

4 Task: Ensure all loading/info boxes have the same width All pop up messages/error/loading info boxes should retain same width/height for UI
and height consistency

5 Task: Account for safe area in all canvases

6 Task: Ensure project sustainability Previous behaviour: Project is too messy with no possible further sustainability.

Fixed by

* {color:#97a0af}_Clean up current project_ {color}

* Rewrite entire project

** Create generic folders/structures/scripts

7 Task: Create Path Rendering Entities Create path rendering entities and assets for both 2d map and AR mode

2D map

* -Animated line-

* -Animated points-

** -Replace with 2d circle sprite (similar to apple map)-

* -Animated different start and end marker-

AR mode

* -Animated line-

** -Replace long animated line with arrows in between each points instead-

* -Animated points-

** -Replace with pulsating circle on ground-

** -Replace with player to point distance above head-

** -Replace with direction to next point above head-

* -Animated dfferent start and end marker-

** -Replace with a better start and end marker just for AR (TBD)-

* -Enabled/Disabled mode-

** -Skip rendering/instantiation if not enabled-

* End

** Required for lift/stairs destination as well?

** Reached destination

** Particle effect?
# Summary Description
8 Task: Integrate new mapbox sdk for 2d maps Integrate new mapbox sdk

Successfully load new maps of different floors based on selected institution

9 Task: Integrate RTLS to output path module Integrate RTLS image capture module

Translate captured image to:

* Success

** send calls to path renderer to draw paths

** store current path into path data

* Fail

** display error message

** reset required fields to prevent bugs

10 Task: Integrate Cross Level Navigation Integrate cross level navigation

Integrate lift / stairs selection

Render two different paths for cross level navigation

Rework current path manager and path renderer manager to account for more than 1 path

Include UI buttons to switch map levels

11 Task: Pan map to start location once path is generated Pan camera and map to a path’s start location once a path has been generated

Account for cross level navigation

12 Task: Create redo path module Create a redo functionality to reset path once

* start and end point has been selected

* end point has been selected

13 TASK: AR - User should be set to the rotation value of User rotation value should be set to RTLS rotation output once AR is triggered
RTLS rotation output

14 Task: AR - Create AR Module Create AR base skeleton module

Create button to toggle on and off AR if a path has been generated

15 Task: AR - Add info messages Add info messages for the following

* When AR starts tracking, inform user to hold still

* When AR loses track, inform user of track lost reason and what to do

16 Task: AR - Create AR path navigation UI Create AR path navigation UI

* Inform user of distance to next point

* Inform user of direction to next point

17 Task: Complete camera permission module # -Add permission check to allow camera usage-

# Add permission check to allow camera usage again if previous permission check was
disabled
# Summary Description
## Check on first app launch if permission was granted, stored permission granted or not
under settings template

## Stored value on settings template to be used as reference subsequently to see if camera


permission was granted and to see if it’s posible to trigger permission grant pop up again

# Show error message and close web cam canvas if permission was denied

# Show error message and close ar camera if permission was denied

# {color:#ff5630}-Camera permission trigger is found under SessionManager’s-


{color}{{CheckDevicePermissions}}

# {color:#ff5630}-Complete SessionManager’s-{color}{color:#ff5630}
{color}{{CheckDevicePermissions}}{color:#ff5630} {color}{color:#ff5630}-for ios. Currently
only implemented for android (see SS)-{color}

!Screenshot 2023-12-19 at 5.06.45 PM.png|width=813,height=774!

18 Task: Create UI menu for POI selection -Create UI menu for poi selection-

19 Task: Migrate floor level int to floor level enum Deprecate floor level int

Migrate to floor level enum

20 Task: Build for ios successfully List down precise steps to solving any errors/issues that arise from building an ios app
successfully on both Unity and XCode

21 Task: Migrate current UI changes back to old UI changes

22 Task: Create UI menu for institution selection Display list of institutes for selection

23 Task: Integrate event calls for AR Manager Trigger appropriate event calls for AR manager

* Redo path calls

* AR manager start path

* AR manager end path

24 Task: Create generic logger and folder structures Create generic scripts

* logger

* session manager

* event manager

Create entity-data-system folder structure

25 Task: include complete poi data Create and assign poi data and display name for Sembawang polyclinic

Use display name instead of poi data string for users to view

26 Task: Create events for setting map zoom and pan speed Create event calls to allow different scripts to invoke and set map zoom and pan speed
# Summary Description
27 Task: Integrate all mini map functionalities

28 Task: AR Player top down camera to be centered at AR -AR mini map’s canvas should always display AR play at the center of the map-
mini map at all times

Ensure proper naming conventions in all scripts/templates used in this

29 Task: Create Pseudo AR functionality in editor Force AR to succeed in unity editor

30 Task: Create custom monobehaviour note Create custom editor inspector for all monobehaviour for documentation purposes

31 Task: Write class notes on all monobehaviours Reference Main Camera Manager

!Screenshot 2023-11-29 at 8.26.03 PM.png|width=387,height=559!

32 Task: Add comments to all scripts

33 Task: Document project using custom editor window * Content

* Rules

* Folder structure

* Program Flow

Separation of system and data

Clean up

Comment

34 Task: Create custom property drawer for fields and # -Create custom property drawer for fields for documentation-
properties

# Create custom property drawer for properties for documentation

35 Task: Utilize proper namespaces in all scripts

36 Task: Create prefab of all popup dialogs Create prefab of popup dialogs.

Create variant for yes/no selection

Create variant for image/image selection (stairs/lift)

!Screenshot 2023-11-30 at 1.29.55 PM.png|width=986,height=555!

37 Task: Create Appear/Disappear animation template and


apply to all UI objects

38 Task: Ensure proper ECS folder structure in all scripts and


folders

39 Task : Trigger journey module by selecting POI on 2d


maps directly instead of selecting start and end point
from list

40 Task: Write field notes on all monobehaviours

41 Task: Write class notes on all monobehaviours

42 Task: Create AR Tracking animation using reference Create new AR tracking animation using reference video
video

Delete and remove old AR tracking animation

43 Task: Create AR Tracking animation using reference Create new AR tracking animation using reference video
video

Delete and remove old AR tracking animation


# Summary Description
44 Task: Cross Level Navigation switch level should only
appear after user has reached lift/stairs

45 Task: Complete all TODO

46 Task: Create prefab of all popup dialogs Create prefab of popup dialogs.

Create variant for yes/no selection

Create variant for image/image selection (stairs/lift)

!Screenshot 2023-11-30 at 1.29.55 PM.png|width=986,height=555!

47 Task: Create Appear/Disappear animation template and


apply to all UI objects

48 Task: Ensure proper ECS folder structure in all scripts and


folders

49 Task : Trigger journey module by selecting POI on 2d


maps directly instead of selecting start and end point
from list

50 Task: Write field notes on all monobehaviours

51 Task: Write class notes on all monobehaviours

52 Task: Create AR Tracking animation using reference Create new AR tracking animation using reference video
video

Delete and remove old AR tracking animation

53 Task: Create AR Tracking animation using reference Create new AR tracking animation using reference video
video

Delete and remove old AR tracking animation

54 Task: Cross Level Navigation switch level should only


appear after user has reached lift/stairs

55 Task: Complete all TODO

56 Task: Ensure all scripts use proper namespaces

57 Task: Add comments, notes, class notes in all scripts Start from Institution folder in rider

58 Task: Complete migration from custom animator system CameraManager


to newly built interpolator system

Check other scripts

59 Task: Clean up OnCreated vs OnLaunched Necessary to have two variations?

Purpose of each variation?

OnLaunched reserved for interpolator?

60 Task: Create new AR Path Point Assets * -Deprecate previously created AR Path Point Asset-

* -Create new AR Path Point Asset-

** -Activated/Deactivated state depending on distance of asset to player-

** -Distance text that updates depending on distance of asset to player-

** Rotate correctly to face player when summoned for deactivated

** Added offset away from path line


# Summary Description
** Rotated correctly to face next direction for activated

61 Task: Create arrow to remind player to get back on track * Fix intermittent rotation issues
if veering off path

* Compass Circle

62 Task: Clean up gameobject layers Remove unnecessary layers

Ensure proper naming of layers

63 Task: Add request time out for network path return Do not want users to wait endlessly for network call return

Add message “network took too long to respond” for error canvas if error canvas does not
appear after timeout (Ensure error canvas appears if timeout fails)

Coroutine {{RequestPathDataCo}} under network manager should implement the time out.
Set acceptable timeout delay

64 Task: Reduce AR Path Point distance Current behaviour: AR Path Point distance switches to activated state at 10 meters or less

Ideal behaviour: 5 meters instead

Script : ARPathPointEntity

65 Task: Scale AR Path Assets relative to player's distance To be tested at sembawang to fine tune scale factor

66 Task: Clean up Path Renderer Types scripts Consistent folder structure

Consistent naming convention

67 Task: Clean up AR Direction Canvas * Make into prefab, similar to other sibling canvases

* Link to parent (ARUIManager), similar to other siblings

* Clean up code within script

* Move script location to appropriate folder (follow siblings' folder locations and structure)

* Complete Todo notes

** !Screenshot 2023-12-17 at 10.34.07 AM.png|width=815,height=723!

68 Task: Clean up AR Destination Canvas Clean up code

69 Task: Modularize POI List * Update UI

* Modularize POI list

70 Task: Upgrade path reminder arrow art asset Use latest art asset

71 Task: Ensure application fps settings is set to 30FPS


instead of 60FPS

72 Task: Remove unused assets * Art

* Models

* Prefabs
# Summary Description
* Scripts

* TEMP

73 Task: Come up with a way to not display multiple AR should be dynamic and display 1 by 1 following its index
Path Point Entities at the same time

74 Task: Replace Path Line Renderer with custom -To test actual new assets-
gameobject line renderer

Use better art asset for 2dmap

75 Task: Profile App Take screenshots of each screens and corresponding draw calls via frame debugger

!image-20240202-062002.png|width=1001,height=712!

!image-20240202-062352.png|width=1001,height=712!

!image-20240202-062426.png|width=1001,height=712!

!image-20240202-064442.png|width=1001,height=712!

!image-20240202-062840.png|width=1001,height=712!

!image-20240202-063506.png|width=1001,height=712!

!image-20240202-063534.png|width=1001,height=712!

!image-20240202-064154.png|width=1001,height=712!

!image-20240202-064320.png|width=1001,height=712!

!image-20240202-065005.png|width=1001,height=712!

!image-20240202-065258.png|width=1001,height=778!

!image-20240202-065410.png|width=1044,height=778!

76 Task: Apply AggressiveInlining to all interface base ITransformBase


methods

ICanvasBase

IRectTransformBase

IGameObjectBase

77 Task: Update custom line renderer scripts with comments

78 Task: Clean up path renderer entities * 2D

** Start here is too high up

** End Marker is no longer animating

** Line Layer to be updated

* AR

** Line Layer to be updated

79 Task: Replace 2d Path Point Asset with 2d circle


# Summary Description
80 Task: Clean up InstitutionTemplate * Convert {{InstitutionLevelComponent}} to use {{InstitutionLevelComponentTest}} and
remove deprecated

* Re-add all display and poi names

* Convert {{InstitutionLevelInfo}} to public get set, similar to other sibling variables

81 Task: Apply ITransformOffset to Path Rendering Entities

82 Task: Set Proper Prefab for AR Direction Canvas Follow Sibling prefab style

83 Task: Clean up ARMiniMap Canvas * Complete all todo in ARMiniMapUIManager (see ss)

** !Screenshot 2023-12-17 at 10.01.38 AM.png|width=837,height=720!

84 Task: Clean up ARMiniMapDragUIController Follow todo notes in ARMiniMapDragUIController. See ss

!Screenshot 2023-12-17 at 10.05.39 AM.png|width=856,height=573!

85 Task: Check if animator module is still in use Check if any scripts in the Animator folder is still being used elsewhere. List down what is
used and what is not and where it’s used. see SS.

!Screenshot 2023-12-20 at 4.39.58 PM.png|width=296,height=218!

86 Task: Clean up Path Folder Scripts * -Path Renderer-

* Path Renderer Entities

** Line

** Marker

** Point

* Path Manager

* Path Data Template

* Path Navigation Template

87 Task: Create user feedback upon reaching destination in * Particle System (Done by Klaus)
AR mode

* UI Pop up upon reached destination

** “You have reached your destination!”

** Delay timer before closing all AR stuffs (timer delay to be determined by Marcus)

* Should this be under AR Destination Canvas?

88 Task: AR lost tracking canvas should not appear when


switching map levels in AR mode

89 Task: POI Menu Enhancement * Remove poi from display list once a poi has been selected (Prevents users from accidentally
selecting same start and end point)
# Summary Description
* Ensure any previously removed poi is no longer removed once reset journey button has
been pressed

90 Task: Add info boards in AR mode

91 Task: Complete Cross Transport Level Selection UI

92 Task: Set proper script folder locations for ICanvasBase,


IGameObjectBase etc

93 Task: Add IDynamicScale to AR Path Line Entities

You might also like