From 4d8dddbef0718bbe0806a84190b6fe9fa019c254 Mon Sep 17 00:00:00 2001 From: piv <> Date: Sat, 15 Oct 2022 13:55:21 +1030 Subject: [PATCH] Add print vehicle to car-rs, update android gradle versions --- .idea/compiler.xml | 6 ++++++ .idea/gradle.xml | 4 ++-- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 12 ----------- app/build.gradle | 26 ++++++++++++------------ app/src/main/AndroidManifest.xml | 6 +++--- build.gradle | 4 +--- car-rs/src/lib.rs | 26 ++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 .idea/compiler.xml delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ad99ec1..c4477f7 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,9 +4,10 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59..6199cc2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index bff755d..8fd9e73 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,12 +4,11 @@ plugins{ } android { - compileSdkVersion 30 - buildToolsVersion "29.0.2" + compileSdkVersion 32 defaultConfig { applicationId "org.vato.carcontroller" minSdkVersion 26 - targetSdkVersion 30 + targetSdkVersion 32 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -27,24 +26,25 @@ android { buildFeatures { mlModelBinding true } + namespace 'org.vato.carcontroller' } dependencies { implementation project(':protobuf') implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation 'com.google.android.material:material:1.3.0' - implementation 'androidx.preference:preference:1.1.1' + implementation 'androidx.appcompat:appcompat:1.5.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.preference:preference:1.2.0' implementation 'org.tensorflow:tensorflow-lite-support:0.1.0' - implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0-rc1' + implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2' implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + androidTestImplementation 'androidx.test:runner:1.4.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation 'io.grpc:grpc-okhttp:1.29.0' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-protobuf-lite:1.29.0' // CURRENT_GRPC_VERSION - implementation 'io.grpc:grpc-stub:1.29.0' // CURRENT_GRPC_VERSION - implementation 'javax.annotation:javax.annotation-api:1.2' + implementation 'io.grpc:grpc-protobuf-lite:1.39.0' // CURRENT_GRPC_VERSION + implementation 'io.grpc:grpc-stub:1.39.0' // CURRENT_GRPC_VERSION + implementation 'javax.annotation:javax.annotation-api:1.3.2' implementation 'org.zeromq:jeromq:0.5.2' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7afa1dd..0d4515e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + @@ -12,7 +11,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/build.gradle b/build.gradle index 4eb8095..fe738a3 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,9 @@ buildscript { repositories { google() - jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.3.1' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.16' // NOTE: Do not place your application dependencies here; they belong @@ -17,7 +16,6 @@ buildscript { allprojects { repositories { google() - jcenter() mavenLocal() } } diff --git a/car-rs/src/lib.rs b/car-rs/src/lib.rs index cf22e2b..16f1781 100644 --- a/car-rs/src/lib.rs +++ b/car-rs/src/lib.rs @@ -173,3 +173,29 @@ impl Vehicle for ServoVehicle { self.steering_servo.set_value(steering); } } + +#[derive(Default, Debug)] +pub struct PrintVehicle { + throttle: f64, + steering: f64, +} + +impl Vehicle for PrintVehicle { + fn get_throttle(&self) -> f64 { + self.throttle + } + + fn set_throttle(&mut self, throttle: f64) { + println!("New Throttle: {}", throttle); + self.throttle = throttle; + } + + fn get_steering(&self) -> f64 { + self.steering + } + + fn set_steering(&mut self, steering: f64) { + println!("New Steering: {}", steering); + self.steering = steering; + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f371643..41dfb87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists