Initial Commit

This commit is contained in:
Piv
2020-02-03 18:58:42 +10:30
commit 89a7572fde
60 changed files with 1927 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

58
app/build.gradle Normal file
View File

@@ -0,0 +1,58 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.carcontroller"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
plugins {
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.25.0'
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {}
grpc { // Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'io.grpc:grpc-okhttp:1.25.0'
implementation 'io.grpc:grpc-protobuf-lite:1.25.0'
implementation 'io.grpc:grpc-stub:1.25.0'
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'org.zeromq:jeromq:0.5.2'
}

21
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,27 @@
package com.example.carcontroller;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.carcontroller", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.carcontroller">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SLAM.SlamController"></activity>
<activity android:name=".LidarTrackingController" />
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_settings"
android:parentActivityName=".MainActivity" />
<activity android:name=".SimpleController" />
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,36 @@
package com.example.carcontroller;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class LidarTrackingController extends AppCompatActivity {
private LidarView lidarMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lidar_tracking_controller);
lidarMap = findViewById(R.id.lidarMap);
}
@Override
protected void onResume() {
super.onResume();
if (lidarMap != null) {
lidarMap.resume();
}
}
@Override
protected void onPause() {
super.onPause();
if (lidarMap != null) {
lidarMap.pause();
}
}
}

View File

@@ -0,0 +1,106 @@
package com.example.carcontroller;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
public class LidarView extends SurfaceView implements Runnable {
private boolean running;
private Thread lidarThread;
private SurfaceHolder holder;
PersonTrackingGrpc.PersonTrackingBlockingStub stub;
private int mBitmapX, mBitmapY, mViewWidth, mViewHeight;
private Bitmap mBitmap;
public LidarView(Context context) {
super(context);
}
public LidarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LidarView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
// Get the group that was selected and select on the grpc controller.
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
}
return true;
}
@Override
public void run() {
Canvas canvas;
while (running) {
if (holder.getSurface().isValid()) {
canvas = holder.lockCanvas();
canvas.save();
// Get the updated points from the raspberry pi.
// Iterate through every point (hist point) and draw to the canvas.
}
}
}
public void pause() {
running = false;
try {
lidarThread.join();
} catch (InterruptedException e) {
}
}
public void resume() {
lidarThread = new Thread(this);
lidarThread.start();
running = true;
}
private static class Point {
private double x;
private double y;
private Point(double x, double y) {
this.x = x;
this.y = y;
}
static Point fromXY(double x, double y) {
return new Point(x, y);
}
static Point fromHist(double distance, double angle) {
return fromHist(distance, angle, new Point(0, 0));
}
static Point fromHist(double distance, double angle, Point offset) {
return new Point(distance * Math.sin(angle) + offset.x, distance * Math.cos(angle) + offset.y);
}
}
}

View File

@@ -0,0 +1,69 @@
package com.example.carcontroller;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.SeekBar;
import com.example.carcontroller.SLAM.SlamController;
import java.util.concurrent.CountDownLatch;
import io.grpc.stub.StreamObserver;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}
public void loadSimpleController(View view) {
Intent intent = new Intent(getApplicationContext(), SimpleController.class);
startActivity(intent);
}
public void loadLidarController(View view) {
Intent intent = new Intent(getApplicationContext(), LidarTrackingController.class);
startActivity(intent);
}
public void loadCameraController(View view) {
}
public void loadSlamController(View view) {
Intent intent = new Intent(getApplicationContext(), SlamController.class);
startActivity(intent);
}
}

View File

@@ -0,0 +1,71 @@
package com.example.carcontroller;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
public class PiLoader implements Runnable {
Integer steeringValue = 50;
Integer throttleValue = 50;
private ManagedChannel mChannel;
private CarControlGrpc.CarControlBlockingStub stub;
private AtomicBoolean stop = new AtomicBoolean(false);
Thread piUpdaterThread;
public PiLoader(String host, Integer port) {
mChannel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build();
// Create an async stub.
stub = CarControlGrpc.newBlockingStub(mChannel);
}
private void createAndStart() {
piUpdaterThread = new Thread(this);
piUpdaterThread.start();
}
public void updateSteering(int value) {
steeringValue = value;
}
public void updateThrottle(int value) {
throttleValue = value;
}
public void stop() {
stop.lazySet(true);
if (!stop.get()) {
piUpdaterThread.interrupt();
}
}
public void start() {
stop.lazySet(false);
createAndStart();
}
@Override
public void run() {
while (!stop.get() && !Thread.interrupted()) {
try {
SteeringResponse steeringResponse = stub.setSteering(SteeringRequest.newBuilder().setSteering((float) steeringValue / 50f - 1).build());
ThrottleResponse throttleResponse = stub.setThrottle(ThrottleRequest.newBuilder().setThrottle((float) throttleValue / 50f - 1).build());
} catch (Exception e) {
System.out.println("Error");
stop();
}
try {
// Use the same update rate as a typical screen refresh rate.
TimeUnit.MILLISECONDS.sleep(15);
} catch (InterruptedException e) {
// TODO: Handle when interrupted and sleeping.
}
}
}
}

View File

@@ -0,0 +1,90 @@
package com.example.carcontroller.SLAM;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.SeekBar;
import com.example.carcontroller.PiLoader;
import com.example.carcontroller.R;
public class SlamController extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
SeekBar steeringSlider;
SeekBar throttleSlider;
private static PiLoader grpcController;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_slam_controller);
steeringSlider = findViewById(R.id.steeringBar);
if (steeringSlider != null) {
steeringSlider.setOnSeekBarChangeListener(this);
}
throttleSlider = findViewById(R.id.throttleBar);
if (throttleSlider != null) {
throttleSlider.setOnSeekBarChangeListener(this);
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
// Call the gRPC method to change the throttle.
switch (seekBar.getId()) {
case R.id.steeringBar:
if (grpcController != null) {
grpcController.updateSteering(i);
}
break;
case R.id.throttleBar:
if (grpcController != null) {
grpcController.updateThrottle(i);
}
break;
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Reset back to the middle, as this is how the controller will normally work.
// Check if this will actually still call the onProgressChanged listener method.
// Otherwise update the steering/throttle here as well.
steeringSlider.setProgress(50);
throttleSlider.setProgress(50);
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (grpcController == null) {
grpcController = new PiLoader(prefs.getString("host", "10.0.0.53"), Integer.parseInt(prefs.getString("port", "50051")));
}
// Should call the equivalent of the load method either here or in the loader.
grpcController.start();
}
@Override
protected void onPause() {
super.onPause();
grpcController.stop();
}
@Override
protected void onStop() {
super.onStop();
grpcController.stop();
}
}

View File

@@ -0,0 +1,60 @@
package com.example.carcontroller.SLAM;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.view.SurfaceView;
import androidx.preference.PreferenceManager;
import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
public class SlamView extends SurfaceView implements Runnable {
ZContext context;
String host;
String port;
Thread mapThread;
public SlamView(Context context) {
super(context);
init();
}
public SlamView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public SlamView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
context = new ZContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
host = prefs.getString("host", "10.0.0.53");
port = prefs.getString("port", "50051");
}
@Override
public void run() {
// Receive map from zmq and update appropriately.
try (ZMQ.Socket socket = context.createSocket(SocketType.SUB)) {
socket.connect("tcp://" + host + ":" + port);
while (!Thread.currentThread().isInterrupted()) {
byte[] map = socket.recv();
}
}
}
public void stop(){
// Use grpc to tell the loader to stop. Interrupt the loader thread as well.
mapThread.interrupt();
}
}

View File

@@ -0,0 +1,34 @@
package com.example.carcontroller;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
public class SettingsActivity extends AppCompatActivity {
public final static String HOST = "host";
public final static String PORT = "port";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.settings, new SettingsFragment())
.commit();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
public static class SettingsFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.root_preferences, rootKey);
}
}
}

View File

@@ -0,0 +1,90 @@
package com.example.carcontroller;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.SeekBar;
import java.util.concurrent.CountDownLatch;
import io.grpc.stub.StreamObserver;
public class SimpleController extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
SeekBar steeringSlider;
SeekBar throttleSlider;
private static PiLoader grpcController;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple_controller);
steeringSlider = findViewById(R.id.steeringBar);
if (steeringSlider != null) {
steeringSlider.setOnSeekBarChangeListener(this);
}
throttleSlider = findViewById(R.id.throttleBar);
if (throttleSlider != null) {
throttleSlider.setOnSeekBarChangeListener(this);
}
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (grpcController == null) {
grpcController = new PiLoader(prefs.getString("host", "10.0.0.53"), Integer.parseInt(prefs.getString("port", "50051")));
}
// Should call the equivalent of the load method either here or in the loader.
grpcController.start();
}
@Override
protected void onPause() {
super.onPause();
grpcController.stop();
}
@Override
protected void onStop() {
super.onStop();
grpcController.stop();
}
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
// Call the gRPC method to change the throttle.
switch (seekBar.getId()) {
case R.id.steeringBar:
if (grpcController != null) {
grpcController.updateSteering(i);
}
break;
case R.id.throttleBar:
if (grpcController != null) {
grpcController.updateThrottle(i);
}
break;
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Reset back to the middle, as this is how the controller will normally work.
// Check if this will actually still call the onProgressChanged listener method.
// Otherwise update the steering/throttle here as well.
steeringSlider.setProgress(50);
throttleSlider.setProgress(50);
}
}

View File

@@ -0,0 +1,31 @@
syntax = "proto3";
message SlamDetails {
int32 map_size_pixels = 1;
int32 map_size_meters = 2;
}
message SlamRow{
repeated int32 points = 1;
}
message SlamLocation{
int32 x = 1;
int32 y = 2;
int32 theta = 3;
}
message SlamScan{
bytes map = 1;
SlamLocation location = 2;
}
message Empty{
}
service SlamControl {
rpc start_map_streaming(SlamDetails) returns (Empty) {}
rpc stop_streaming(Empty) returns (Empty) {}
}

View File

@@ -0,0 +1,34 @@
syntax = "proto3";
package persontracking;
option java_multiple_files = true;
option java_package = "com.example.carcontroller";
option java_outer_classname = "PersonTrackingProto";
message Int32Value{
int32 value = 1;
}
message Empty{
}
message Point{
double angle = 1;
int32 distance = 2;
int32 group_number = 3;
}
message PointScan{
repeated Point points = 1;
}
service PersonTracking{
rpc set_tracking_group(Int32Value) returns (Empty) {}
rpc stop_tracking(Empty) returns (Empty) {}
rpc get_scan_data(Empty) returns (PointScan) {}
}

View File

@@ -0,0 +1,29 @@
syntax = "proto3";
package MotorControl;
option java_multiple_files = true;
option java_package = "com.example.carcontroller";
option java_outer_classname = "MotorServiceProto";
message ThrottleRequest{
float throttle = 1;
}
message ThrottleResponse{
bool throttleSet = 1;
}
message SteeringRequest{
float steering = 1;
}
message SteeringResponse{
bool steeringSet = 1;
}
service CarControl{
rpc SetThrottle(ThrottleRequest) returns (ThrottleResponse){}
rpc SetSteering(SteeringRequest) returns (SteeringResponse){}
}

View File

@@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,92 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="839dp"
android:height="1562dp"
android:viewportWidth="839"
android:viewportHeight="1562">
<path
android:pathData="M789.56,658.22C789.56,558.39 708.46,477.34 608.56,477.34L230.27,477.34C130.38,477.34 49.28,558.39 49.28,658.22L49.28,1020C49.28,1119.83 135.76,1142.73 235.65,1142.73L612.46,1141.67C712.35,1141.67 789.56,1119.83 789.56,1020L789.56,658.22Z"
android:strokeWidth="6.61"
android:fillColor="#959595"
android:strokeColor="#000000"/>
<path
android:pathData="M593.58,735.46l130.66,0l0,339.77l-130.66,0z"
android:strokeWidth="8.26"
android:fillColor="#FF5B5B"
android:strokeColor="#FF5B5B"/>
<path
android:pathData="M62.32,263.9l701.35,0l0,97.23l-701.35,0z"
android:strokeWidth="5.49"
android:fillColor="#959595"
android:strokeColor="#000000"/>
<path
android:pathData="M520.64,128.48L312.01,128.48C312.01,128.48 318.74,377.25 305.95,433.92C297.02,473.49 256.48,485.63 256.48,485.63C359.14,497.03 463.82,495.92 565.56,483.57C565.56,483.57 525.38,467.15 519.22,433.27C508.92,376.66 520.64,128.48 520.64,128.48Z"
android:fillColor="#959595"/>
<path
android:fillColor="#FF000000"
android:pathData="M804.56,166.28C804.44,98.35 627.23,9.88 411.18,10.41C195.13,10.94 21.53,100.29 21.65,168.22C112.96,147.61 256.89,130.71 413.04,130.33C569.19,129.94 713.19,146.13 804.56,166.28Z"
android:strokeWidth="15.05"
android:strokeColor="#000000"/>
<path
android:pathData="M109.03,244.91C109.03,219.23 88.19,198.39 62.51,198.39C36.84,198.39 16,219.23 16,244.91L16,405.89C16,431.56 36.84,452.4 62.51,452.4C88.19,452.4 109.03,431.56 109.03,405.89L109.03,244.91Z"
android:strokeWidth="24.67"
android:fillColor="#212121"
android:strokeColor="#000000"/>
<path
android:pathData="M810.95,240.92C810.95,215.25 790.11,194.4 764.44,194.4C738.77,194.4 717.92,215.25 717.92,240.92L717.92,401.9C717.92,427.57 738.77,448.41 764.44,448.41C790.11,448.41 810.95,427.57 810.95,401.9L810.95,240.92Z"
android:strokeWidth="24.67"
android:fillColor="#212121"
android:strokeColor="#000000"/>
<path
android:pathData="M71.75,1214.82l701.35,0l0,97.23l-701.35,0z"
android:strokeWidth="5.49"
android:fillColor="#959595"
android:strokeColor="#000000"/>
<path
android:pathData="M118.46,1195.83C118.46,1170.16 97.62,1149.32 71.95,1149.32C46.27,1149.32 25.43,1170.16 25.43,1195.83L25.43,1356.82C25.43,1382.48 46.27,1403.33 71.95,1403.33C97.62,1403.33 118.46,1382.48 118.46,1356.82L118.46,1195.83Z"
android:strokeWidth="24.67"
android:fillColor="#212121"
android:strokeColor="#000000"/>
<path
android:pathData="M820.39,1191.85C820.39,1166.17 799.55,1145.33 773.87,1145.33C748.2,1145.33 727.36,1166.17 727.36,1191.85L727.36,1352.83C727.36,1378.5 748.2,1399.34 773.87,1399.34C799.55,1399.34 820.39,1378.5 820.39,1352.83L820.39,1191.85Z"
android:strokeWidth="24.67"
android:fillColor="#212121"
android:strokeColor="#000000"/>
<path
android:pathData="M314.65,139.81C314.65,139.81 318.32,391.79 307.47,431.33C296.61,470.87 266.86,477.55 266.86,477.55"
android:strokeWidth="9.16"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M516.81,142.15C516.81,142.15 509.63,370.26 518.54,427.13C524.05,462.27 561.97,477.35 561.97,477.35"
android:strokeWidth="9.82"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M551.91,1138.12C461.5,1124.24 376.81,1126.26 296.14,1137.68C296.14,1137.68 306.38,1137.65 322.37,1176.7C341.62,1223.73 322.37,1443.64 322.37,1443.64L522.69,1443.64C522.69,1443.64 500.5,1222.03 520.53,1175.64C536.27,1139.21 551.91,1138.12 551.91,1138.12Z"
android:fillColor="#959595"/>
<path
android:pathData="M818.08,1498.76C818.08,1467.81 792.96,1442.69 762.02,1442.69L85.51,1442.69C54.57,1442.69 29.45,1467.81 29.45,1498.76C29.45,1529.7 54.57,1554.82 85.51,1554.82L762.02,1554.82C792.96,1554.82 818.08,1529.7 818.08,1498.76Z"
android:strokeWidth="9.96"
android:fillColor="#212121"
android:strokeColor="#000000"/>
<path
android:pathData="M374.89,583.76h95.59v367.66h-95.59z"
android:strokeWidth="9.15"
android:fillColor="#3DDF43"
android:strokeColor="#3DDF43"/>
<path
android:pathData="M104.05,683.02h118.88v234.07h-118.88z"
android:strokeWidth="9.15"
android:fillColor="#3E79FF"
android:strokeColor="#3E79FF"/>
<path
android:pathData="M297.63,1142.72C297.63,1142.72 320.93,1129.19 331.43,1207.94C338,1257.15 322.47,1439.5 322.47,1439.5"
android:strokeWidth="9.15"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
<path
android:pathData="M552.08,1141.32C552.08,1141.32 531.49,1126.76 515.72,1183.75C502.41,1231.84 522.37,1438.36 522.37,1438.36"
android:strokeWidth="9.15"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
</vector>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LidarTrackingController">
<com.example.carcontroller.LidarView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lidarMap"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="37dp"
android:layout_height="21dp"
android:rotation="270"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_car" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SimpleController">
<SeekBar
android:id="@+id/steeringBar"
android:layout_width="200dp"
android:layout_height="44dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:max="100"
android:progress="50"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<SeekBar
android:id="@+id/throttleBar"
android:layout_width="200dp"
android:layout_height="242dp"
android:layout_marginBottom="32dp"
android:max="100"
android:progress="50"
android:rotation="270"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SLAM.SlamController">
<SeekBar
android:id="@+id/steeringBar"
android:layout_width="200dp"
android:layout_height="44dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="32dp"
android:max="100"
android:progress="50"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<SeekBar
android:id="@+id/throttleBar"
android:layout_width="200dp"
android:layout_height="242dp"
android:layout_marginBottom="32dp"
android:max="100"
android:progress="50"
android:rotation="270"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LidarTrackingController">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please Switch to Landscape Orientation"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SimpleController">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/switch.to.landscape"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SLAM.SlamController">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please Change to Landscape Rotation"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="32dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="loadSimpleController"
android:text="Simple Controller" />
<Button
style="@style/Widget.AppCompat.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="loadSlamController"
android:text="SLAM Controller" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="loadLidarController"
android:text="Controls with LIDAR Tracking" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="loadCameraController"
android:text="Controls with Camera" />
</LinearLayout>

View File

@@ -0,0 +1,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.appwithsettings.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,12 @@
<resources>
<!-- Reply Preference -->
<string-array name="reply_entries">
<item>Reply</item>
<item>Reply to all</item>
</string-array>
<string-array name="reply_values">
<item>reply</item>
<item>reply_all</item>
</string-array>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

View File

@@ -0,0 +1,21 @@
<resources>
<string name="app_name">CarController</string>
<string name="switch.to.landscape">Please switch to landscape orientation</string>
<string name="title_activity_settings">Settings</string>
<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>
<string name="action_settings">Settings</string>
<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<!-- Sync Preferences -->
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
</resources>

View File

@@ -0,0 +1,21 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

View File

@@ -0,0 +1,45 @@
<!--
~ Copyright 2018 The app Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="Car Connection">
<EditTextPreference
app:key="host"
app:title="Pi IP Address/Hostname"
app:useSimpleSummaryProvider="true" />
<EditTextPreference
android:title="Port number"
app:key="port"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory android:title="Car Calibration">
<SeekBarPreference
android:defaultValue="50"
android:max="100"
android:title="Steering Trim - Unimplemented ATM"
app:key="steering_trim"
app:min="0"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,17 @@
package com.example.carcontroller;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}