diff --git a/MotorControl/MotorServer.py b/MotorControl/MotorServer.py index a1e89a0..e042e5a 100755 --- a/MotorControl/MotorServer.py +++ b/MotorControl/MotorServer.py @@ -6,17 +6,21 @@ from concurrent import futures import grpc -import motorService_pb2 -import motorService_pb2_grpc +import car.MotorControl.motorService_pb2 as motorService_pb2 +import car.MotorControl.motorService_pb2_grpc as motorService_pb2_grpc from MotorControl.gpiozero.motor_session import Motor servo_pin = 18 timeout_length = 3 +motor = Motor() +servo = Servo() + class MotorServicer(motorService_pb2_grpc.CarControlServicer): def __init__(self): - self.motor = Motor() - self.servo = Servo(servo_pin) + global motor, servo + self.motor = motor + self.servo = servo self._timer = None def SetThrottle(self, request_iterator, context): diff --git a/MotorControl/motorService_pb2_grpc.py b/MotorControl/motorService_pb2_grpc.py index 995aec8..93e3a6d 100644 --- a/MotorControl/motorService_pb2_grpc.py +++ b/MotorControl/motorService_pb2_grpc.py @@ -1,7 +1,7 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -import motorService_pb2 as motorService__pb2 +import car.MotorControl.motorService_pb2 as motorService__pb2 class CarControlStub(object):