Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	FantasmoDemoApp/app/libs/FantasmoSDK_3.0.0.aar
#	FantasmoDemoApp/app/libs/FantasmoSDK_3.0.1.aar
#	FantasmoDemoApp/app/libs/FantasmoSDK_3.1.0.aar
#	FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/CustomDemoFragment.kt
#	FantasmoDemoApp/app/src/main/java/com/example/fantasmo_android/DemoFragment.kt
#	FantasmoSDK/app/build.gradle
#	FantasmoSDK/app/src/main/assets/config/default-config.json
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/FMLocationManager.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/config/RemoteConfig.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/filters/FMBlurFilter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/filters/FMCameraPitchFilter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/filters/FMFrameFilter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/filters/FMImageQualityFilter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/filters/FMMovementFilter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/analytics/FrameFilterRejectionStatistics.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/models/tensorflowML/ImageQualityModelUpdater.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/network/FMApi.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/network/FMNetworkManager.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/utilities/YuvToRgbConverter.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMParkingView.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMQRScanningView.kt
#	FantasmoSDK/app/src/main/java/com/fantasmo/sdk/views/FMSessionStatisticsView.kt
#	FantasmoSDK/app/src/main/res/layout/fmstatisticsview.xml
#	FantasmoSDK/app/src/main/res/values/strings.xml
#	FantasmoSDK/app/src/test/java/com/fantasmo/sdk/FMLocationManagerTest.kt
#	FantasmoSDK/app/src/test/java/com/fantasmo/sdk/filters/FMInputQualityTest.kt
#	FantasmoSDK/app/src/test/java/com/fantasmo/sdk/filters/FMMovementFilterTest.kt
#	FantasmoSDK/app/src/test/java/com/fantasmo/sdk/network/FMNetworkManagerTest.kt
#	README.md
#	ReleaseNotes.txt
  • Loading branch information
jpvsilva-fss committed Feb 1, 2022
2 parents 17b4ae2 + 4267ed8 commit e504eac
Show file tree
Hide file tree
Showing 46 changed files with 1,921 additions and 580 deletions.
18 changes: 17 additions & 1 deletion FantasmoDemoApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ implementation 'com.google.mlkit:barcode-scanning:17.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.android.volley:volley:1.2.0'

// TensorFlow Lite
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0'
```

## Building

On the module-level `build.gradle`, inside the `android` properties you should add the following instruction. This will allow to add a machine learning model and to loaded it when in a Localizing Session.
```kotlin
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
```

## Permissions and requirements
Expand Down Expand Up @@ -90,7 +104,8 @@ After this, we are ready to connect to the Fantasmo SDK. We need to provide a co
```kotlin
fmParkingView.fmParkingViewController = fmParkingViewController
val sessionId = UUID.randomUUID().toString()
fmParkingView.connect(sessionId)
val sessionTags = listOf("berlin", "e-scooter") //optional tags
fmParkingView.connect(sessionId, sessionTags)
```

The SDK provides an internal LocationManager and it will give updates on location. If you want to use your own Location Manager, all you have to do is set `fmParkingView.usesInternalLocationManager` to false and call the `fmParkingView.updateLocation(location: Location)` on your location manager in order to get location updates. If you check `CustomDemoFragment.kt` there's an example of how to manage your own location updates:
Expand Down Expand Up @@ -163,6 +178,7 @@ override fun fmParkingView(qrCodeString: String, continueBlock: (Boolean) -> Uni
continueBlock(validQRCode)
}
```

**Note:** During a QR code scanning session, it is not possible to turn on the flashlight due to ARCore being used on the FMParkingView. ARCore blocks any input regarding turning on/off the flashlight during an AR session, limiting QR code readability on dark environments.

### Customizing UI
Expand Down
10 changes: 10 additions & 0 deletions FantasmoDemoApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ android {
}
}

aaptOptions {
noCompress "tflite"
noCompress "lite"
}
}

dependencies {
Expand Down Expand Up @@ -92,6 +96,12 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.android.volley:volley:1.2.0'

// Tensor
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'

implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
Binary file removed FantasmoDemoApp/app/libs/FantasmoSDK_3.0.1.aar
Binary file not shown.
Binary file added FantasmoDemoApp/app/libs/FantasmoSDK_3.1.0.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class CustomDemoFragment : Fragment() {
resultsLayout = currentView.findViewById(R.id.resultsLayout)
resultTextView = currentView.findViewById(R.id.localizationResultView)
mapPinButton = currentView.findViewById(R.id.mapPinButton)

enterQRButton = currentView.findViewById(R.id.enterQRCodeButton)
enterQRButton.setOnClickListener{
handleEnterQRCode()
Expand Down Expand Up @@ -199,11 +198,14 @@ class CustomDemoFragment : Fragment() {
}

private fun startParkingFlow() {
// Display `FMParkingView` and initialize `sessionId`. This is typically a UUID string
// Display `FMParkingView` and initialize `sessionId` and `sessionTags`. This is typically a UUID string
// but it can also follow your own format. It is used for analytics and billing purposes and
// should represent a single parking session.
val sessionId = UUID.randomUUID().toString()

// Optional list used mainly to label and group parking sessions that have something in common.
val sessionTags = listOf("android-sdk-test-harness")

// Assign a controller
fmParkingView.fmParkingViewController = fmParkingViewController

Expand All @@ -220,7 +222,7 @@ class CustomDemoFragment : Fragment() {
fmParkingView.registerLocalizingViewController(fmLocalizingViewController)

// Present the FMParkingView
fmParkingView.connect(sessionId)
fmParkingView.connect(sessionId, sessionTags)

useOwnLocationProvider()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DemoFragment : Fragment() {

endRideButton = currentView.findViewById(R.id.endRideButton)
endRideButton.setOnClickListener {
if(!hasRequestedEndRide){
if (!hasRequestedEndRide) {
handleEndRideButton()
hasRequestedEndRide = true
}
Expand Down Expand Up @@ -139,34 +139,25 @@ class DemoFragment : Fragment() {
} else {
location = deviceLocation
}
updateEndRideButtonState()
return location
}

private val systemLocationListener: SystemLocationListener =
object : SystemLocationListener {
override fun onLocationUpdate(currentLocation: Location) {
deviceLocation = currentLocation
updateEndRideButtonState()
}

override fun hasLocation() {
updateEndRideButtonState()
}
}

private fun updateEndRideButtonState() {
if (endRideButton.visibility == View.GONE) {
endRideButton.visibility = View.VISIBLE
}
}

private fun startParkingFlow() {
// Display `FMParkingView` and initialize `sessionId`. This is typically a UUID string
// Display `FMParkingView` and initialize `sessionId` and `sessionTags`. This is typically a UUID string
// but it can also follow your own format. It is used for analytics and billing purposes and
// should represent a single parking session.
val sessionId = UUID.randomUUID().toString()

// Optional list used mainly to label and group parking sessions that have something in common.
val sessionTags = listOf("android-sdk-test-harness")

// Assign a controller
fmParkingView.fmParkingViewController = fmParkingViewController

Expand All @@ -178,7 +169,7 @@ class DemoFragment : Fragment() {
fmParkingView.showStatistics = showStatisticsSwitch.isChecked

// Present the FMParkingView to start
fmParkingView.connect(sessionId)
fmParkingView.connect(sessionId, sessionTags)

resultsLayout.visibility = View.GONE
controlsLayout.visibility = View.GONE
Expand Down Expand Up @@ -235,7 +226,7 @@ class DemoFragment : Fragment() {

override fun fmParkingView(qrCode: Barcode, continueBlock: (Boolean) -> Unit) {
Log.d(TAG, "QR Code Scan Successful From Barcode")
val validQRCode = qrCode.rawValue!=null
val validQRCode = qrCode.rawValue != null
// Optional validation of the QR code can be done here
// Note: If you choose to implement this method, you must call the `continueBlock` with the validation result
// show dialogue to accept or refuse
Expand Down
1 change: 0 additions & 1 deletion FantasmoDemoApp/app/src/main/res/layout/demo_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/end_ride"
android:visibility="gone"
app:backgroundTint="@color/black"
app:layout_constraintBottom_toTopOf="@+id/simulationModeSwitch"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
44 changes: 15 additions & 29 deletions FantasmoSDK/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 52
versionName "3.0.1"
versionCode 60
versionName "3.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "String", "VERSION_NAME", "\"$versionName\""
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io/v1/image.localize\""
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io\""
buildConfigField "String", "FM_GPS_LAT_LONG", "\"48.12863302178715,11.572371166069702\""
}

buildTypes {
debug{
buildConfigField "String", "FM_API_BASE_URL", "\"https://api-dev.fantasmo.io\""
minifyEnabled = false
shrinkResources false
}
release {
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io\""
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand All @@ -47,32 +49,6 @@ android {
jvmTarget = '1.8'
}

flavorDimensions "env"
productFlavors {
prod{
dimension "env"
buildConfigField "String", "VERSION_NAME", "\"$defaultConfig.versionName\""
}
devParis {
dimension "env"
buildConfigField "String", "VERSION_NAME", "\"$defaultConfig.versionName\""
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io/v1/image.localize\""
buildConfigField "String", "FM_GPS_LAT_LONG", "\"48.848138681935886,2.371750713292894\""
}
devMunich {
dimension "env"
buildConfigField "String", "VERSION_NAME", "\"$defaultConfig.versionName\""
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io/v1/image.localize\""
buildConfigField "String", "FM_GPS_LAT_LONG", "\"48.12863302178715,11.572371166069702\""
}
devMiami{
dimension "env"
buildConfigField "String", "VERSION_NAME", "\"$defaultConfig.versionName\""
buildConfigField "String", "FM_API_BASE_URL", "\"https://api.fantasmo.io/v1/image.localize\""
buildConfigField "String", "FM_GPS_LAT_LONG", "\"25.762586765198417,-80.19404801110545\""
}
}

libraryVariants.all { variant ->
variant.outputs.all {
def appName = "FantasmoSDK"
Expand All @@ -89,6 +65,11 @@ android {
outputFileName = newName
}
}

aaptOptions {
noCompress "tflite"
noCompress "lite"
}
}

dependencies {
Expand All @@ -107,6 +88,11 @@ dependencies {
// Barcode model dependencies
implementation 'com.google.mlkit:barcode-scanning:17.0.0'

// TensorFlow Lite
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0'

// Layouts
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
Expand Down
17 changes: 17 additions & 0 deletions FantasmoSDK/app/src/main/assets/config/default-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"remote_config_id": "default-android_17.01.22",
"frame_acceptance_threshold_timeout": 1.0,
"is_behavior_requester_enabled": true,
"is_tracking_state_filter_enabled": true,
"is_movement_filter_enabled": true,
"movement_filter_threshold": 0.001,
"is_blur_filter_enabled": true,
"blur_filter_variance_threshold": 250.0,
"blur_filter_sudden_drop_threshold": 0.4,
"blur_filter_average_throughput_threshold": 0.25,
"is_camera_pitch_filter_enabled": true,
"camera_pitch_filter_max_upward_tilt": 30.0,
"camera_pitch_filter_max_downward_tilt": 65.0,
"is_image_quality_filter_enabled": true,
"image_quality_filter_score_threshold": 0.0
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@ class FMConfiguration {
* API base url
*/
fun getServerURL(): String {
return BuildConfig.FM_API_BASE_URL
return BuildConfig.FM_API_BASE_URL + "/v1/image.localize"
}

/**
* API is_localization_available url
*/
fun getIsLocalizationAvailableURL(): String {
return BuildConfig.FM_API_BASE_URL + "/v2/isLocalizationAvailable"
}

/**
* API initialize url
*/
fun getInitializeURL(): String {
return BuildConfig.FM_API_BASE_URL + "/v2/initialize"
}

/**
Expand Down
Loading

0 comments on commit e504eac

Please sign in to comment.