From 1feb8c235e9c967442342ca6b5489f7a30c70b26 Mon Sep 17 00:00:00 2001 From: Michael Pivato Date: Sun, 29 Sep 2019 18:58:17 +0930 Subject: [PATCH] Fixed imports and some things from first run. --- MotorControl/MotorServer.py | 6 +++--- MotorControl/gpiozero/motor_session.py | 7 +++---- MotorControl/motorService_pb2_grpc.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) mode change 100644 => 100755 MotorControl/MotorServer.py diff --git a/MotorControl/MotorServer.py b/MotorControl/MotorServer.py old mode 100644 new mode 100755 index 8c63c18..af7e106 --- a/MotorControl/MotorServer.py +++ b/MotorControl/MotorServer.py @@ -6,8 +6,8 @@ from concurrent import futures import grpc -from . import motorService_pb2 -from . import motorService_pb2_grpc +import motorService_pb2 +import motorService_pb2_grpc from MotorControl.gpiozero.motor_session import Motor servo_pin = 18 @@ -60,4 +60,4 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer): server.start() servicer = MotorServicer() -servicer.start_server() \ No newline at end of file +servicer.start_server() diff --git a/MotorControl/gpiozero/motor_session.py b/MotorControl/gpiozero/motor_session.py index 8563a65..45362a0 100644 --- a/MotorControl/gpiozero/motor_session.py +++ b/MotorControl/gpiozero/motor_session.py @@ -8,9 +8,8 @@ class Motor: def __init__(self, motor_pin=19): # This may not work properly, should print. Device.pin_factory = PiGPIOFactory() - print('Using pin factory: ' + Device.pin_factory) - # This will say it fails if pigpio daemon is already started, just ignore it. - os.system("sudo pigpiod") + print('Using pin factory:') + print(Device.pin_factory) self.set_motor_pin(motor_pin) self.initialise_motor() @@ -43,4 +42,4 @@ class Motor: return False def stop(self): - self.set_throttle(0) \ No newline at end of file + self.set_throttle(0) diff --git a/MotorControl/motorService_pb2_grpc.py b/MotorControl/motorService_pb2_grpc.py index c01b2ce..995aec8 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 -from . import motorService_pb2 as motorService__pb2 +import motorService_pb2 as motorService__pb2 class CarControlStub(object):