Fix the motor server

This commit is contained in:
Piv
2019-11-28 08:03:28 +10:30
parent 10e45f5b45
commit 7793f808ea

View File

@@ -19,13 +19,13 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
self.servo = servo self.servo = servo
self._timer = None self._timer = None
def SetThrottle(self, request_iterator, context): def SetThrottle(self, request, context):
# gRPC streams currently don't work between python and android. # gRPC streams currently don't work between python and android.
# If we don't get a response every 3 seconds, stop the car. # If we don't get a response every 3 seconds, stop the car.
throttleFailed = False throttleFailed = False
print('Setting throttle to: ' + str(throttleRequest.throttle)) print('Setting throttle to: ' + str(request.throttle))
self.set_timeout(3) self.set_timeout(3)
throttleFailed = self.motor.set_throttle(throttleRequest.throttle) throttleFailed = self.motor.set_throttle(request.throttle)
return motorService_pb2.ThrottleResponse(throttleSet = throttleFailed) return motorService_pb2.ThrottleResponse(throttleSet = throttleFailed)
def SetSteering(self, request, context): def SetSteering(self, request, context):