Use a stream for the steering as well.
This commit is contained in:
@@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
package='MotorControl',
|
||||
syntax='proto3',
|
||||
serialized_options=None,
|
||||
serialized_pb=_b('\n\x12motorService.proto\x12\x0cMotorControl\"#\n\x0fThrottleRequest\x12\x10\n\x08throttle\x18\x01 \x01(\x02\"\'\n\x10ThrottleResponse\x12\x13\n\x0bthrottleSet\x18\x01 \x01(\x08\"#\n\x0fSteeringRequest\x12\x10\n\x08steering\x18\x01 \x01(\x02\"\'\n\x10SteeringResponse\x12\x13\n\x0bsteeringSet\x18\x01 \x01(\x08\x32\xae\x01\n\nCarControl\x12P\n\x0bSetThrottle\x12\x1d.MotorControl.ThrottleRequest\x1a\x1e.MotorControl.ThrottleResponse\"\x00(\x01\x12N\n\x0bSetSteering\x12\x1d.MotorControl.SteeringRequest\x1a\x1e.MotorControl.SteeringResponse\"\x00\x62\x06proto3')
|
||||
serialized_pb=_b('\n\x12motorService.proto\x12\x0cMotorControl\"#\n\x0fThrottleRequest\x12\x10\n\x08throttle\x18\x01 \x01(\x02\"\'\n\x10ThrottleResponse\x12\x13\n\x0bthrottleSet\x18\x01 \x01(\x08\"#\n\x0fSteeringRequest\x12\x10\n\x08steering\x18\x01 \x01(\x02\"\'\n\x10SteeringResponse\x12\x13\n\x0bsteeringSet\x18\x01 \x01(\x08\x32\xb0\x01\n\nCarControl\x12P\n\x0bSetThrottle\x12\x1d.MotorControl.ThrottleRequest\x1a\x1e.MotorControl.ThrottleResponse\"\x00(\x01\x12P\n\x0bSetSteering\x12\x1d.MotorControl.SteeringRequest\x1a\x1e.MotorControl.SteeringResponse\"\x00(\x01\x62\x06proto3')
|
||||
)
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ _CARCONTROL = _descriptor.ServiceDescriptor(
|
||||
index=0,
|
||||
serialized_options=None,
|
||||
serialized_start=193,
|
||||
serialized_end=367,
|
||||
serialized_end=369,
|
||||
methods=[
|
||||
_descriptor.MethodDescriptor(
|
||||
name='SetThrottle',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
import grpc
|
||||
|
||||
import MotorControl.motorService_pb2 as motorService__pb2
|
||||
import motorService_pb2 as motorService__pb2
|
||||
|
||||
|
||||
class CarControlStub(object):
|
||||
@@ -19,7 +19,7 @@ class CarControlStub(object):
|
||||
request_serializer=motorService__pb2.ThrottleRequest.SerializeToString,
|
||||
response_deserializer=motorService__pb2.ThrottleResponse.FromString,
|
||||
)
|
||||
self.SetSteering = channel.unary_unary(
|
||||
self.SetSteering = channel.stream_unary(
|
||||
'/MotorControl.CarControl/SetSteering',
|
||||
request_serializer=motorService__pb2.SteeringRequest.SerializeToString,
|
||||
response_deserializer=motorService__pb2.SteeringResponse.FromString,
|
||||
@@ -37,7 +37,7 @@ class CarControlServicer(object):
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetSteering(self, request, context):
|
||||
def SetSteering(self, request_iterator, context):
|
||||
# missing associated documentation comment in .proto file
|
||||
pass
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
@@ -52,7 +52,7 @@ def add_CarControlServicer_to_server(servicer, server):
|
||||
request_deserializer=motorService__pb2.ThrottleRequest.FromString,
|
||||
response_serializer=motorService__pb2.ThrottleResponse.SerializeToString,
|
||||
),
|
||||
'SetSteering': grpc.unary_unary_rpc_method_handler(
|
||||
'SetSteering': grpc.stream_unary_rpc_method_handler(
|
||||
servicer.SetSteering,
|
||||
request_deserializer=motorService__pb2.SteeringRequest.FromString,
|
||||
response_serializer=motorService__pb2.SteeringResponse.SerializeToString,
|
||||
|
||||
@@ -20,5 +20,5 @@ message SteeringResponse{
|
||||
|
||||
service CarControl{
|
||||
rpc SetThrottle(stream ThrottleRequest) returns (ThrottleResponse){}
|
||||
rpc SetSteering(SteeringRequest) returns (SteeringResponse){}
|
||||
rpc SetSteering(stream SteeringRequest) returns (SteeringResponse){}
|
||||
}
|
||||
Reference in New Issue
Block a user