FIx Slam protos

This commit is contained in:
Piv
2020-02-05 22:16:23 +10:30
parent 89a7572fde
commit 2c8f61e8a6
7 changed files with 35 additions and 18 deletions

View File

@@ -41,7 +41,6 @@ protobuf {
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

View File

@@ -33,7 +33,6 @@ public class LidarView extends SurfaceView implements Runnable {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
}
@Override

View File

@@ -7,6 +7,9 @@ import android.view.SurfaceView;
import androidx.preference.PreferenceManager;
import com.example.carcontroller.SlamScan;
import com.google.protobuf.InvalidProtocolBufferException;
import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
@@ -43,13 +46,19 @@ public class SlamView extends SurfaceView implements Runnable {
@Override
public void run() {
// Receive map from zmq and update appropriately.
try (ZMQ.Socket socket = context.createSocket(SocketType.SUB)) {
try (ZMQ.Socket socket = context.createSocket(SocketType.PAIR)) {
socket.connect("tcp://" + host + ":" + port);
socket.send("Hi");
while (!Thread.currentThread().isInterrupted()) {
byte[] map = socket.recv();
SlamScan scan = SlamScan.parseFrom(map);
for (Byte b : scan.getMap()) {
}
}
} catch (InvalidProtocolBufferException e) {
System.out.println("Invalid map found");
}
}

View File

@@ -0,0 +1,11 @@
syntax = "proto3";
package persontracking;
option java_multiple_files = true;
option java_package = "com.example.carcontroller";
option java_outer_classname = "EmptyProto";
message Empty{
}

View File

@@ -1,5 +1,11 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.example.carcontroller";
option java_outer_classname = "SlamControllerProto";
import "Empty.proto";
message SlamDetails {
int32 map_size_pixels = 1;
int32 map_size_meters = 2;
@@ -20,12 +26,8 @@ message SlamScan{
SlamLocation location = 2;
}
message Empty{
}
service SlamControl {
rpc start_map_streaming(SlamDetails) returns (Empty) {}
rpc start_map_streaming(SlamDetails) returns (persontracking.Empty) {}
rpc stop_streaming(Empty) returns (Empty) {}
rpc stop_streaming(persontracking.Empty) returns (persontracking.Empty) {}
}

View File

@@ -6,15 +6,12 @@ option java_multiple_files = true;
option java_package = "com.example.carcontroller";
option java_outer_classname = "PersonTrackingProto";
import "Empty.proto";
message Int32Value{
int32 value = 1;
}
message Empty{
}
message Point{
double angle = 1;
int32 distance = 2;
@@ -26,9 +23,9 @@ message PointScan{
}
service PersonTracking{
rpc set_tracking_group(Int32Value) returns (Empty) {}
rpc set_tracking_group(Int32Value) returns (persontracking.Empty) {}
rpc stop_tracking(Empty) returns (Empty) {}
rpc stop_tracking(persontracking.Empty) returns (persontracking.Empty) {}
rpc get_scan_data(Empty) returns (PointScan) {}
rpc get_scan_data(persontracking.Empty) returns (PointScan) {}
}

View File

@@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
// NOTE: Do not place your application dependencies here; they belong