Use the throttle as the heartbeat message.
This commit is contained in:
@@ -16,6 +16,10 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
||||
self._timer = None
|
||||
|
||||
def SetThrottle(self, request, context):
|
||||
# If we don't get a response every 3 seconds, stop the car.
|
||||
# This isn't a stream right now, however may change it to be so since we'll constantly
|
||||
# be sending values...
|
||||
self.set_timeout(timeout_length)
|
||||
return motorService_pb2.ThrottleResponse(throttleSet = (True if self.motor.set_throttle(request.throttle) else False))
|
||||
|
||||
def SetSteering(self, request, context):
|
||||
@@ -23,12 +27,6 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
|
||||
self.servo.value = request.steering
|
||||
return motorService_pb2.SteeringResponse(steeringSet = True)
|
||||
|
||||
def Heartbeat(self, request, context):
|
||||
# If we don't get a response every 3 seconds, stop the car.
|
||||
# This isn't a stream right now, however may change it to be so since we'll constantly
|
||||
# be sending values...
|
||||
self.set_timeout(timeout_length)
|
||||
|
||||
def set_timeout(self, min_timeout):
|
||||
"""Stops the old timer and restarts it to the specified time.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user