Fix server, add dummy python controller.

This commit is contained in:
Piv
2019-11-14 18:50:26 +10:30
parent bd74ca3c66
commit 5024796785
3 changed files with 13 additions and 29 deletions

View File

@@ -14,7 +14,7 @@ servo_pin = 18
timeout_length = 3
motor = Motor()
servo = Servo()
servo = Servo(servo_pin)
class MotorServicer(motorService_pb2_grpc.CarControlServicer):
def __init__(self):
@@ -24,7 +24,7 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
self._timer = None
def SetThrottle(self, request_iterator, context):
# 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.
# This isn't a stream right now, however may change it to be so since we'll constantly
# be sending values...
throttleFailed = False
@@ -58,7 +58,7 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
self.motor.stop()
def start_server(self):
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
server = grpc.server(futures.ThreadPoolExecutor(max_workers=8))
motorService_pb2_grpc.add_CarControlServicer_to_server(MotorServicer(), server)
server.add_insecure_port('[::]:50051')
server.start()