Skip to content

Commit

Permalink
added scapix class, update build.gradle version
Browse files Browse the repository at this point in the history
  • Loading branch information
pmokeev committed Aug 4, 2021
1 parent 1adbad8 commit cf61bdb
Show file tree
Hide file tree
Showing 26 changed files with 10,209 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ lint/tmp/
sync-server/__pycache__/

sync-server/*.csv

# Scapix unnecessary files
app/src/main/cpp/generated/bridge/cs
app/src/main/cpp/generated/bridge/js
app/src/main/cpp/generated/bridge/objc
app/src/main/cpp/generated/bridge/python
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "app/src/main/cpp/lib/spline"]
path = app/src/main/cpp/lib/spline
url = https://github.com/ttk592/spline
[submodule "app/src/main/cpp/lib/eigen"]
path = app/src/main/cpp/lib/eigen
url = https://gitlab.com/libeigen/eigen
39 changes: 32 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileSdkVersion 30
buildToolsVersion '30.0.3'
ndkVersion "22.1.7171670"
defaultConfig {
applicationId "skoltech.mobilerobotics.capturesync"
minSdkVersion 23
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags '-O2'
arguments "-DANDROID_ARM_NEON=FALSE"
}
}
}
buildTypes {
release {
Expand All @@ -22,9 +28,28 @@ android {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.18.1'
}
}
buildFeatures {
viewBinding true
}
lintOptions {
disable 'LongLogTag'
}
sourceSets {
main {
java {
srcDirs = [
"src/main/cpp/generated/bridge/java",
"src/main/java"
]
}
}
}
}

tasks.withType(Test) {
Expand All @@ -37,8 +62,8 @@ tasks.withType(Test) {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.googleresearch.capturesync;

import android.content.Context;
import android.util.Pair;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.platform.app.InstrumentationRegistry;

import com.googleresearch.capturesync.softwaresync.TimeSync;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class ReceiveDelayTests {
Context unitTestContext;

@Before
public void initContext() {
unitTestContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
unitTestContext = ApplicationProvider.getApplicationContext();
}

@Test
public void receiveValueFirstTest_isCorrect() {
String firstNameFile = "ForUnitTestFile4.csv";
Pair<double[][], double[]> firstPair = ReadFromFile.ReadFromCSV(firstNameFile, unitTestContext);
String secondNameFile = "ForUnitTestFile5.csv";
Pair<double[][], double[]> secondPair = ReadFromFile.ReadFromCSV(secondNameFile, unitTestContext);

TimeSync currentObject = new TimeSync(firstPair.first, secondPair.first, firstPair.second, secondPair.second, false);
currentObject.resample(1.0);
currentObject.obtainDelay();
double timeDelay = currentObject.getTimeDelay();

Assert.assertEquals(0.005384159941042243, timeDelay, 0.000001);
}

@Test
public void receiveValueSecondTest_isCorrect() {
String firstNameFile = "ForUnitTestFile6.csv";
Pair<double[][], double[]> firstPair = ReadFromFile.ReadFromCSV(firstNameFile, unitTestContext);
String secondNameFile = "ForUnitTestFile7.csv";
Pair<double[][], double[]> secondPair = ReadFromFile.ReadFromCSV(secondNameFile, unitTestContext);

TimeSync currentObject = new TimeSync(firstPair.first, secondPair.first, firstPair.second, secondPair.second, false);
currentObject.resample(1.0);
currentObject.obtainDelay();
double timeDelay = currentObject.getTimeDelay();

Assert.assertEquals(0.0493466958931981, timeDelay, 0.000001);
}
}
Loading

0 comments on commit cf61bdb

Please sign in to comment.