FIx Slam protos
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user