Stop using a grpc stream.

This commit is contained in:
Piv
2019-11-28 08:01:26 +10:30
parent eae291da07
commit 10e45f5b45
4 changed files with 14 additions and 18 deletions

View File

@@ -20,16 +20,12 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
self._timer = None
def SetThrottle(self, request_iterator, context):
# gRPC streams currently don't work between python and android.
# If we don't get a response every 3 seconds, stop the car.
# This isn't a stream right now, however may change it to be so since we'll constantly
# be sending values...
throttleFailed = False
for throttleRequest in request_iterator:
print('Setting throttle to: ' + str(throttleRequest.throttle))
self.set_timeout(3)
throttleFailed = self.motor.set_throttle(throttleRequest.throttle)
if not throttleFailed:
break
print('Setting throttle to: ' + str(throttleRequest.throttle))
self.set_timeout(3)
throttleFailed = self.motor.set_throttle(throttleRequest.throttle)
return motorService_pb2.ThrottleResponse(throttleSet = throttleFailed)
def SetSteering(self, request, context):