Fixed imports and some things from first run.

This commit is contained in:
Michael Pivato
2019-09-29 18:58:17 +09:30
parent 78ba890669
commit 1feb8c235e
3 changed files with 7 additions and 8 deletions

6
MotorControl/MotorServer.py Normal file → Executable file
View File

@@ -6,8 +6,8 @@ from concurrent import futures
import grpc import grpc
from . import motorService_pb2 import motorService_pb2
from . import motorService_pb2_grpc import motorService_pb2_grpc
from MotorControl.gpiozero.motor_session import Motor from MotorControl.gpiozero.motor_session import Motor
servo_pin = 18 servo_pin = 18
@@ -60,4 +60,4 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
server.start() server.start()
servicer = MotorServicer() servicer = MotorServicer()
servicer.start_server() servicer.start_server()

View File

@@ -8,9 +8,8 @@ class Motor:
def __init__(self, motor_pin=19): def __init__(self, motor_pin=19):
# This may not work properly, should print. # This may not work properly, should print.
Device.pin_factory = PiGPIOFactory() Device.pin_factory = PiGPIOFactory()
print('Using pin factory: ' + Device.pin_factory) print('Using pin factory:')
# This will say it fails if pigpio daemon is already started, just ignore it. print(Device.pin_factory)
os.system("sudo pigpiod")
self.set_motor_pin(motor_pin) self.set_motor_pin(motor_pin)
self.initialise_motor() self.initialise_motor()
@@ -43,4 +42,4 @@ class Motor:
return False return False
def stop(self): def stop(self):
self.set_throttle(0) self.set_throttle(0)

View File

@@ -1,7 +1,7 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc import grpc
from . import motorService_pb2 as motorService__pb2 import motorService_pb2 as motorService__pb2
class CarControlStub(object): class CarControlStub(object):