Use car package and ghetto singleton motor/servo.
This commit is contained in:
@@ -6,17 +6,21 @@ from concurrent import futures
|
|||||||
|
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
import motorService_pb2
|
import car.MotorControl.motorService_pb2 as motorService_pb2
|
||||||
import motorService_pb2_grpc
|
import car.MotorControl.motorService_pb2_grpc as motorService_pb2_grpc
|
||||||
from MotorControl.gpiozero.motor_session import Motor
|
from MotorControl.gpiozero.motor_session import Motor
|
||||||
|
|
||||||
servo_pin = 18
|
servo_pin = 18
|
||||||
timeout_length = 3
|
timeout_length = 3
|
||||||
|
|
||||||
|
motor = Motor()
|
||||||
|
servo = Servo()
|
||||||
|
|
||||||
class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.motor = Motor()
|
global motor, servo
|
||||||
self.servo = Servo(servo_pin)
|
self.motor = motor
|
||||||
|
self.servo = servo
|
||||||
self._timer = None
|
self._timer = None
|
||||||
|
|
||||||
def SetThrottle(self, request_iterator, context):
|
def SetThrottle(self, request_iterator, context):
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
import motorService_pb2 as motorService__pb2
|
import car.MotorControl.motorService_pb2 as motorService__pb2
|
||||||
|
|
||||||
|
|
||||||
class CarControlStub(object):
|
class CarControlStub(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user