FIx Slam protos
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,17 +46,23 @@ 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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
public void stop() {
|
||||
// Use grpc to tell the loader to stop. Interrupt the loader thread as well.
|
||||
mapThread.interrupt();
|
||||
}
|
||||
|
||||
11
app/src/main/proto/Empty.proto
Normal file
11
app/src/main/proto/Empty.proto
Normal 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{
|
||||
|
||||
}
|
||||
@@ -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) {}
|
||||
}
|
||||
@@ -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) {}
|
||||
}
|
||||
Reference in New Issue
Block a user