Fix motor control
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from threading import Timer, Thread
|
||||
from gpiozero import Servo, Device
|
||||
from concurrent import futures
|
||||
import time
|
||||
|
||||
@@ -10,7 +9,6 @@ import grpc
|
||||
import control.motorService_pb2 as motorService_pb2
|
||||
import control.motorService_pb2_grpc as motorService_pb2_grpc
|
||||
from control.gpiozero.vehicle import Vehicle
|
||||
from control.gpiozero.mockvehicle import MockVehicle
|
||||
from slam.slam_servicer import SlamServicer
|
||||
import slam.SlamController_pb2_grpc as SlamController_pb2_grpc
|
||||
import tracking.lidar_tracker_pb2_grpc as lidar_tracker_pb2_grpc
|
||||
@@ -25,11 +23,10 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
||||
def SetThrottle(self, request, context):
|
||||
# gRPC streams currently don't work between python and android.
|
||||
# If we don't get a response every 3 seconds, stop the car.
|
||||
throttleFailed = False
|
||||
print('Setting throttle to: ' + str(request.throttle))
|
||||
self.set_timeout(3)
|
||||
throttleFailed = self.vehicle.set_throttle(request.throttle)
|
||||
return motorService_pb2.ThrottleResponse(throttleSet=throttleFailed)
|
||||
self.vehicle.throttle = request.throttle
|
||||
return motorService_pb2.ThrottleResponse(throttleSet=True)
|
||||
|
||||
def SetSteering(self, request, context):
|
||||
print('Setting steering to: ' + str(request.steering))
|
||||
|
||||
Reference in New Issue
Block a user