Use car package and ghetto singleton motor/servo.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user