diff --git a/Messaging/clientEx copy.py b/Messaging/clientEx copy.py deleted file mode 100644 index b9d21ee..0000000 --- a/Messaging/clientEx copy.py +++ /dev/null @@ -1,58 +0,0 @@ -import umsgpack -import paho.mqtt.client as mqtt -import time -import ssl -import json - -cfg = None -with open('config.json') as json_config: - cfg = json.load(json_config) -connected = False - -def on_connect(client, userdata, flags, rc): - print("Connected with result code " + str(rc)) - if rc == 0: - global connected - connected = True - - client.subscribe('hello/test', qos=1) - -def on_message(client, userdata, message): - p = umsgpack.unpackb(message.payload) - print("Received message '" + p["message"] + "' on topic '" - + message.topic + "' with QoS " + str(message.qos)) - -def on_disconnect(client, userdata, rc): - if rc != 0: - print("Unexpected disconnection.") - -mqttc = mqtt.Client() - -# mqttc.tls_set_context(context = ssl.create_default_context()) - -mqttc.on_connect = on_connect -mqttc.on_disconnect = on_disconnect -mqttc.on_message = on_message - -mqttc.connect(cfg["mqtt"]["host"], cfg["mqtt"]["port"], cfg["mqtt"]["timeout"]) - -mqttc.loop_start() - -# mqttc.will_set("hello/test", "Disconnected", ) - -pub = input("Enter something to publish: ") - -while pub != 'q': - if(connected): - pub = umsgpack.packb({"message":pub}) - mqttc.publish('hello/test', pub) - pub = input("Enter something to publish: ") - print('Message is: ' + pub) - else: - pub = input('Would you like to reconnect? ') - if pub == 'y': - mqttc.reconnect() - time.sleep(2) - -mqttc.loop_stop() -mqttc.disconnect() \ No newline at end of file diff --git a/Messaging/clientEx.py b/Messaging/clientEx.py deleted file mode 100644 index 5c799bb..0000000 --- a/Messaging/clientEx.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Tue Nov 27 14:17:45 2018 - -@author: pivatom -""" - -import paho.mqtt.client as mqtt - -# These are just the defaults. -mqttc = mqtt.Client(client_id="", clean_session=True, userdata=None, protocol=MQTTv311, transport="tcp") - -mqttc.tls_set(ca_certs=None, certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED, - tls_version=ssl.PROTOCOL_TLS, ciphers=None) - -# Use port 8883 for SSL -# Host is just an ip address or hostname of the broker. -mqttc.connect(host, port=1883, keepalive=60, bind_address="") - -# Topic is a string of the topic to publish to. -mqttc.publish(topic, payload=None, qos=0, retain=False) - -# Just subscribe to a topic. -mqttc.subscribe(topic, qos=0) - -def on_message(client, userdata, message): - ''' - Do something with the message. Choose based on what the topic is. - - Can also just assign different callback functions for different topics - using message_callback_add(sub, callback) - ''' - print("Received message '" + str(message.payload) + "' on topic '" - + message.topic + "' with QoS " + str(message.qos)) - -mqttc.on_message = on_message - -# Or for specific callback: -# Can use foo/# for all subtopics of foo/, or -# +/bar for all topics that include bar. -mqttc.message_callback_add(sub, on_message) - diff --git a/MotorControl/MotorServer.py b/control/MotorServer.py similarity index 89% rename from MotorControl/MotorServer.py rename to control/MotorServer.py index cbc408c..cd29eb6 100755 --- a/MotorControl/MotorServer.py +++ b/control/MotorServer.py @@ -7,11 +7,11 @@ import time import grpc -import MotorControl.motorService_pb2 as motorService_pb2 -import MotorControl.motorService_pb2_grpc as motorService_pb2_grpc -from MotorControl.gpiozero.motor_session import Motor -from SlamController.slam_servicer import SlamServicer -import SlamController.SlamController_pb2_grpc as SlamController_pb2_grpc +import control.motorService_pb2 as motorService_pb2 +import control.motorService_pb2_grpc as motorService_pb2_grpc +from control.gpiozero.motor_session import Motor +from slam.slam_servicer import SlamServicer +import slam.SlamController_pb2_grpc as SlamController_pb2_grpc class MotorServicer(motorService_pb2_grpc.CarControlServicer): diff --git a/MotorControl/PythonRemoteController.py b/control/PythonRemoteController.py similarity index 100% rename from MotorControl/PythonRemoteController.py rename to control/PythonRemoteController.py diff --git a/MotorControl/__init__.py b/control/__init__.py similarity index 100% rename from MotorControl/__init__.py rename to control/__init__.py diff --git a/MotorControl/gpiozero/__init__.py b/control/gpiozero/__init__.py similarity index 100% rename from MotorControl/gpiozero/__init__.py rename to control/gpiozero/__init__.py diff --git a/MotorControl/gpiozero/motor_session.py b/control/gpiozero/motor_session.py similarity index 100% rename from MotorControl/gpiozero/motor_session.py rename to control/gpiozero/motor_session.py diff --git a/MotorControl/motorService_pb2.py b/control/motorService_pb2.py similarity index 84% rename from MotorControl/motorService_pb2.py rename to control/motorService_pb2.py index 7bb5287..098d0e5 100644 --- a/MotorControl/motorService_pb2.py +++ b/control/motorService_pb2.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: motorService.proto +# source: control/motorService.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) @@ -16,11 +16,11 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( - name='motorService.proto', + name='control/motorService.proto', 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\xac\x01\n\nCarControl\x12N\n\x0bSetThrottle\x12\x1d.MotorControl.ThrottleRequest\x1a\x1e.MotorControl.ThrottleResponse\"\x00\x12N\n\x0bSetSteering\x12\x1d.MotorControl.SteeringRequest\x1a\x1e.MotorControl.SteeringResponse\"\x00\x62\x06proto3') + serialized_pb=_b('\n\x1a\x63ontrol/motorService.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\xac\x01\n\nCarControl\x12N\n\x0bSetThrottle\x12\x1d.MotorControl.ThrottleRequest\x1a\x1e.MotorControl.ThrottleResponse\"\x00\x12N\n\x0bSetSteering\x12\x1d.MotorControl.SteeringRequest\x1a\x1e.MotorControl.SteeringResponse\"\x00\x62\x06proto3') ) @@ -52,8 +52,8 @@ _THROTTLEREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=36, - serialized_end=71, + serialized_start=44, + serialized_end=79, ) @@ -83,8 +83,8 @@ _THROTTLERESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=73, - serialized_end=112, + serialized_start=81, + serialized_end=120, ) @@ -114,8 +114,8 @@ _STEERINGREQUEST = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=114, - serialized_end=149, + serialized_start=122, + serialized_end=157, ) @@ -145,8 +145,8 @@ _STEERINGRESPONSE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=151, - serialized_end=190, + serialized_start=159, + serialized_end=198, ) DESCRIPTOR.message_types_by_name['ThrottleRequest'] = _THROTTLEREQUEST @@ -157,28 +157,28 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) ThrottleRequest = _reflection.GeneratedProtocolMessageType('ThrottleRequest', (_message.Message,), { 'DESCRIPTOR' : _THROTTLEREQUEST, - '__module__' : 'motorService_pb2' + '__module__' : 'control.motorService_pb2' # @@protoc_insertion_point(class_scope:MotorControl.ThrottleRequest) }) _sym_db.RegisterMessage(ThrottleRequest) ThrottleResponse = _reflection.GeneratedProtocolMessageType('ThrottleResponse', (_message.Message,), { 'DESCRIPTOR' : _THROTTLERESPONSE, - '__module__' : 'motorService_pb2' + '__module__' : 'control.motorService_pb2' # @@protoc_insertion_point(class_scope:MotorControl.ThrottleResponse) }) _sym_db.RegisterMessage(ThrottleResponse) SteeringRequest = _reflection.GeneratedProtocolMessageType('SteeringRequest', (_message.Message,), { 'DESCRIPTOR' : _STEERINGREQUEST, - '__module__' : 'motorService_pb2' + '__module__' : 'control.motorService_pb2' # @@protoc_insertion_point(class_scope:MotorControl.SteeringRequest) }) _sym_db.RegisterMessage(SteeringRequest) SteeringResponse = _reflection.GeneratedProtocolMessageType('SteeringResponse', (_message.Message,), { 'DESCRIPTOR' : _STEERINGRESPONSE, - '__module__' : 'motorService_pb2' + '__module__' : 'control.motorService_pb2' # @@protoc_insertion_point(class_scope:MotorControl.SteeringResponse) }) _sym_db.RegisterMessage(SteeringResponse) @@ -191,8 +191,8 @@ _CARCONTROL = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=0, serialized_options=None, - serialized_start=193, - serialized_end=365, + serialized_start=201, + serialized_end=373, methods=[ _descriptor.MethodDescriptor( name='SetThrottle', diff --git a/MotorControl/motorService_pb2_grpc.py b/control/motorService_pb2_grpc.py similarity index 66% rename from MotorControl/motorService_pb2_grpc.py rename to control/motorService_pb2_grpc.py index 36234b2..dbf664b 100644 --- a/MotorControl/motorService_pb2_grpc.py +++ b/control/motorService_pb2_grpc.py @@ -1,7 +1,7 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -import motorService_pb2 as motorService__pb2 +from control import motorService_pb2 as control_dot_motorService__pb2 class CarControlStub(object): @@ -16,13 +16,13 @@ class CarControlStub(object): """ self.SetThrottle = channel.unary_unary( '/MotorControl.CarControl/SetThrottle', - request_serializer=motorService__pb2.ThrottleRequest.SerializeToString, - response_deserializer=motorService__pb2.ThrottleResponse.FromString, + request_serializer=control_dot_motorService__pb2.ThrottleRequest.SerializeToString, + response_deserializer=control_dot_motorService__pb2.ThrottleResponse.FromString, ) self.SetSteering = channel.unary_unary( '/MotorControl.CarControl/SetSteering', - request_serializer=motorService__pb2.SteeringRequest.SerializeToString, - response_deserializer=motorService__pb2.SteeringResponse.FromString, + request_serializer=control_dot_motorService__pb2.SteeringRequest.SerializeToString, + response_deserializer=control_dot_motorService__pb2.SteeringResponse.FromString, ) @@ -49,13 +49,13 @@ def add_CarControlServicer_to_server(servicer, server): rpc_method_handlers = { 'SetThrottle': grpc.unary_unary_rpc_method_handler( servicer.SetThrottle, - request_deserializer=motorService__pb2.ThrottleRequest.FromString, - response_serializer=motorService__pb2.ThrottleResponse.SerializeToString, + request_deserializer=control_dot_motorService__pb2.ThrottleRequest.FromString, + response_serializer=control_dot_motorService__pb2.ThrottleResponse.SerializeToString, ), 'SetSteering': grpc.unary_unary_rpc_method_handler( servicer.SetSteering, - request_deserializer=motorService__pb2.SteeringRequest.FromString, - response_serializer=motorService__pb2.SteeringResponse.SerializeToString, + request_deserializer=control_dot_motorService__pb2.SteeringRequest.FromString, + response_serializer=control_dot_motorService__pb2.SteeringResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( diff --git a/generate-proto b/generate-proto new file mode 100755 index 0000000..6ca8031 --- /dev/null +++ b/generate-proto @@ -0,0 +1,3 @@ +python3 -m grpc_tools.protoc -I proto --python_out=. --grpc_python_out=. proto/control/motorService.proto +python3 -m grpc_tools.protoc -I proto --python_out=. --grpc_python_out=. proto/slam/SlamController.proto +python3 -m grpc_tools.protoc -I proto --python_out=. --grpc_python_out=. proto/tracking/lidar_tracker.proto \ No newline at end of file diff --git a/MotorControl/protos/motorService.proto b/proto/control/motorService.proto similarity index 100% rename from MotorControl/protos/motorService.proto rename to proto/control/motorService.proto diff --git a/SlamController/proto/SlamController.proto b/proto/slam/SlamController.proto similarity index 100% rename from SlamController/proto/SlamController.proto rename to proto/slam/SlamController.proto diff --git a/persontracking/protos/persontracking/lidar_tracker.proto b/proto/tracking/lidar_tracker.proto similarity index 100% rename from persontracking/protos/persontracking/lidar_tracker.proto rename to proto/tracking/lidar_tracker.proto diff --git a/SlamController/SlamController_pb2.py b/slam/SlamController_pb2.py similarity index 86% rename from SlamController/SlamController_pb2.py rename to slam/SlamController_pb2.py index bcce021..cfd0a38 100644 --- a/SlamController/SlamController_pb2.py +++ b/slam/SlamController_pb2.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: SlamController.proto +# source: slam/SlamController.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) @@ -16,11 +16,11 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( - name='SlamController.proto', + name='slam/SlamController.proto', package='', syntax='proto3', serialized_options=None, - serialized_pb=_b('\n\x14SlamController.proto\"M\n\x0bSlamDetails\x12\x17\n\x0fmap_size_pixels\x18\x01 \x01(\x05\x12\x17\n\x0fmap_size_meters\x18\x02 \x01(\x05\x12\x0c\n\x04port\x18\x03 \x01(\x05\"\x19\n\x07SlamRow\x12\x0e\n\x06points\x18\x01 \x03(\x05\"3\n\x0cSlamLocation\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\r\n\x05theta\x18\x03 \x01(\x02\"8\n\x08SlamScan\x12\x0b\n\x03map\x18\x01 \x01(\x0c\x12\x1f\n\x08location\x18\x02 \x01(\x0b\x32\r.SlamLocation\"\x07\n\x05\x45mpty2`\n\x0bSlamControl\x12-\n\x13start_map_streaming\x12\x0c.SlamDetails\x1a\x06.Empty\"\x00\x12\"\n\x0estop_streaming\x12\x06.Empty\x1a\x06.Empty\"\x00\x62\x06proto3') + serialized_pb=_b('\n\x19slam/SlamController.proto\"M\n\x0bSlamDetails\x12\x17\n\x0fmap_size_pixels\x18\x01 \x01(\x05\x12\x17\n\x0fmap_size_meters\x18\x02 \x01(\x05\x12\x0c\n\x04port\x18\x03 \x01(\x05\"\x19\n\x07SlamRow\x12\x0e\n\x06points\x18\x01 \x03(\x05\"3\n\x0cSlamLocation\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\r\n\x05theta\x18\x03 \x01(\x02\"8\n\x08SlamScan\x12\x0b\n\x03map\x18\x01 \x01(\x0c\x12\x1f\n\x08location\x18\x02 \x01(\x0b\x32\r.SlamLocation\"\x07\n\x05\x45mpty2`\n\x0bSlamControl\x12-\n\x13start_map_streaming\x12\x0c.SlamDetails\x1a\x06.Empty\"\x00\x12\"\n\x0estop_streaming\x12\x06.Empty\x1a\x06.Empty\"\x00\x62\x06proto3') ) @@ -66,8 +66,8 @@ _SLAMDETAILS = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=24, - serialized_end=101, + serialized_start=29, + serialized_end=106, ) @@ -97,8 +97,8 @@ _SLAMROW = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=103, - serialized_end=128, + serialized_start=108, + serialized_end=133, ) @@ -142,8 +142,8 @@ _SLAMLOCATION = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=130, - serialized_end=181, + serialized_start=135, + serialized_end=186, ) @@ -180,8 +180,8 @@ _SLAMSCAN = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=183, - serialized_end=239, + serialized_start=188, + serialized_end=244, ) @@ -204,8 +204,8 @@ _EMPTY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=241, - serialized_end=248, + serialized_start=246, + serialized_end=253, ) _SLAMSCAN.fields_by_name['location'].message_type = _SLAMLOCATION @@ -218,35 +218,35 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) SlamDetails = _reflection.GeneratedProtocolMessageType('SlamDetails', (_message.Message,), { 'DESCRIPTOR' : _SLAMDETAILS, - '__module__' : 'SlamController_pb2' + '__module__' : 'slam.SlamController_pb2' # @@protoc_insertion_point(class_scope:SlamDetails) }) _sym_db.RegisterMessage(SlamDetails) SlamRow = _reflection.GeneratedProtocolMessageType('SlamRow', (_message.Message,), { 'DESCRIPTOR' : _SLAMROW, - '__module__' : 'SlamController_pb2' + '__module__' : 'slam.SlamController_pb2' # @@protoc_insertion_point(class_scope:SlamRow) }) _sym_db.RegisterMessage(SlamRow) SlamLocation = _reflection.GeneratedProtocolMessageType('SlamLocation', (_message.Message,), { 'DESCRIPTOR' : _SLAMLOCATION, - '__module__' : 'SlamController_pb2' + '__module__' : 'slam.SlamController_pb2' # @@protoc_insertion_point(class_scope:SlamLocation) }) _sym_db.RegisterMessage(SlamLocation) SlamScan = _reflection.GeneratedProtocolMessageType('SlamScan', (_message.Message,), { 'DESCRIPTOR' : _SLAMSCAN, - '__module__' : 'SlamController_pb2' + '__module__' : 'slam.SlamController_pb2' # @@protoc_insertion_point(class_scope:SlamScan) }) _sym_db.RegisterMessage(SlamScan) Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { 'DESCRIPTOR' : _EMPTY, - '__module__' : 'SlamController_pb2' + '__module__' : 'slam.SlamController_pb2' # @@protoc_insertion_point(class_scope:Empty) }) _sym_db.RegisterMessage(Empty) @@ -259,8 +259,8 @@ _SLAMCONTROL = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=0, serialized_options=None, - serialized_start=250, - serialized_end=346, + serialized_start=255, + serialized_end=351, methods=[ _descriptor.MethodDescriptor( name='start_map_streaming', diff --git a/SlamController/SlamController_pb2_grpc.py b/slam/SlamController_pb2_grpc.py similarity index 69% rename from SlamController/SlamController_pb2_grpc.py rename to slam/SlamController_pb2_grpc.py index dd7bdf5..6eb349f 100644 --- a/SlamController/SlamController_pb2_grpc.py +++ b/slam/SlamController_pb2_grpc.py @@ -1,7 +1,7 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -from . import SlamController_pb2 as SlamController__pb2 +from slam import SlamController_pb2 as slam_dot_SlamController__pb2 class SlamControlStub(object): @@ -16,13 +16,13 @@ class SlamControlStub(object): """ self.start_map_streaming = channel.unary_unary( '/SlamControl/start_map_streaming', - request_serializer=SlamController__pb2.SlamDetails.SerializeToString, - response_deserializer=SlamController__pb2.Empty.FromString, + request_serializer=slam_dot_SlamController__pb2.SlamDetails.SerializeToString, + response_deserializer=slam_dot_SlamController__pb2.Empty.FromString, ) self.stop_streaming = channel.unary_unary( '/SlamControl/stop_streaming', - request_serializer=SlamController__pb2.Empty.SerializeToString, - response_deserializer=SlamController__pb2.Empty.FromString, + request_serializer=slam_dot_SlamController__pb2.Empty.SerializeToString, + response_deserializer=slam_dot_SlamController__pb2.Empty.FromString, ) @@ -49,13 +49,13 @@ def add_SlamControlServicer_to_server(servicer, server): rpc_method_handlers = { 'start_map_streaming': grpc.unary_unary_rpc_method_handler( servicer.start_map_streaming, - request_deserializer=SlamController__pb2.SlamDetails.FromString, - response_serializer=SlamController__pb2.Empty.SerializeToString, + request_deserializer=slam_dot_SlamController__pb2.SlamDetails.FromString, + response_serializer=slam_dot_SlamController__pb2.Empty.SerializeToString, ), 'stop_streaming': grpc.unary_unary_rpc_method_handler( servicer.stop_streaming, - request_deserializer=SlamController__pb2.Empty.FromString, - response_serializer=SlamController__pb2.Empty.SerializeToString, + request_deserializer=slam_dot_SlamController__pb2.Empty.FromString, + response_serializer=slam_dot_SlamController__pb2.Empty.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( diff --git a/SlamController/__init__.py b/slam/__init__.py similarity index 100% rename from SlamController/__init__.py rename to slam/__init__.py diff --git a/SlamController/slam_servicer.py b/slam/slam_servicer.py similarity index 78% rename from SlamController/slam_servicer.py rename to slam/slam_servicer.py index f76a114..3ee7bf8 100644 --- a/SlamController/slam_servicer.py +++ b/slam/slam_servicer.py @@ -1,10 +1,10 @@ -from . import SlamController_pb2_grpc -from . import SlamController_pb2 -from . import slam_streamer as slam +import slam.SlamController_pb2_grpc as grpc +import slam.SlamController_pb2 as proto +import slam.slam_streamer as slam from multiprocessing import Process -class SlamServicer(SlamController_pb2_grpc.SlamControlServicer): +class SlamServicer(grpc.SlamControlServicer): slam_thread = None def __init__(self, lidar_connection): @@ -21,11 +21,11 @@ class SlamServicer(SlamController_pb2_grpc.SlamControlServicer): self.slam.map_meters = request.map_size_meters self.slam_thread = Process(target=self.slam.start) self.slam_thread.start() - return SlamController_pb2.Empty() + return proto.Empty() def stop_streaming(self, request, context): if self.slam_thread is not None: self.slam.stop_scanning() self.slam_thread.join() self.slam = None - return SlamController_pb2.Empty() + return proto.Empty() diff --git a/SlamController/slam_streamer.py b/slam/slam_streamer.py similarity index 98% rename from SlamController/slam_streamer.py rename to slam/slam_streamer.py index be77d0e..5c30126 100644 --- a/SlamController/slam_streamer.py +++ b/slam/slam_streamer.py @@ -3,8 +3,8 @@ from breezyslam.algorithms import RMHC_SLAM from breezyslam.sensors import RPLidarA1 as LaserModel from rplidar import RPLidar as Lidar from .SlamController_pb2 import SlamScan, SlamLocation -import Messaging.message_factory as mf -import Messaging.messages as messages +import messaging.message_factory as mf +import messaging.messages as messages # Left here as was used in the example, configure as necessary. diff --git a/SlamController/zmq_pair_testing/pair.py b/slam/zmq_pair_testing/pair.py similarity index 100% rename from SlamController/zmq_pair_testing/pair.py rename to slam/zmq_pair_testing/pair.py diff --git a/persontracking/__init__.py b/tracking/__init__.py similarity index 100% rename from persontracking/__init__.py rename to tracking/__init__.py diff --git a/persontracking/algorithms.py b/tracking/algorithms.py similarity index 100% rename from persontracking/algorithms.py rename to tracking/algorithms.py diff --git a/persontracking/lidar_cache.py b/tracking/lidar_cache.py similarity index 95% rename from persontracking/lidar_cache.py rename to tracking/lidar_cache.py index ce5c294..22d60ef 100644 --- a/persontracking/lidar_cache.py +++ b/tracking/lidar_cache.py @@ -1,8 +1,8 @@ import rplidar from rplidar import RPLidar from threading import Thread -from persontracking import algorithms -import persontracking.lidar_tracker_pb2 as tracker_pb +from tracking import algorithms +import tracking.lidar_tracker_pb2 as tracker_pb import zmq import Messaging.message_factory as mf import Messaging.messages as messages diff --git a/persontracking/lidar_servicer.py b/tracking/lidar_servicer.py similarity index 70% rename from persontracking/lidar_servicer.py rename to tracking/lidar_servicer.py index e4a5315..f2cd66c 100644 --- a/persontracking/lidar_servicer.py +++ b/tracking/lidar_servicer.py @@ -1,6 +1,6 @@ -import persontracking.lidar_tracker_pb2 as lidar_tracker_pb2 -from persontracking.lidar_tracker_pb2_grpc import PersonTrackingServicer -from persontracking.lidar_cache import LidarCache +import tracking.lidar_tracker_pb2 as lidar_tracker_pb2 +from tracking.lidar_tracker_pb2_grpc import PersonTrackingServicer +from tracking.lidar_cache import LidarCache from multiprocessing import Process diff --git a/persontracking/lidar_tracker_pb2.py b/tracking/lidar_tracker_pb2.py similarity index 79% rename from persontracking/lidar_tracker_pb2.py rename to tracking/lidar_tracker_pb2.py index 61393f5..f4a719e 100644 --- a/persontracking/lidar_tracker_pb2.py +++ b/tracking/lidar_tracker_pb2.py @@ -1,5 +1,6 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: persontracking/lidar_tracker.proto +# source: tracking/lidar_tracker.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) @@ -15,11 +16,11 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( - name='persontracking/lidar_tracker.proto', + name='tracking/lidar_tracker.proto', package='persontracking', syntax='proto3', serialized_options=_b('\n\031com.example.carcontrollerB\021MotorServiceProtoP\001'), - serialized_pb=_b('\n\"persontracking/lidar_tracker.proto\x12\x0epersontracking\"\x1b\n\nInt32Value\x12\r\n\x05value\x18\x01 \x01(\x05\"\x07\n\x05\x45mpty\">\n\x05Point\x12\r\n\x05\x61ngle\x18\x01 \x01(\x01\x12\x10\n\x08\x64istance\x18\x02 \x01(\x05\x12\x14\n\x0cgroup_number\x18\x03 \x01(\x05\"2\n\tPointScan\x12%\n\x06points\x18\x01 \x03(\x0b\x32\x15.persontracking.Point2\xe3\x01\n\x0ePersonTracking\x12I\n\x12set_tracking_group\x12\x1a.persontracking.Int32Value\x1a\x15.persontracking.Empty\"\x00\x12?\n\rstop_tracking\x12\x15.persontracking.Empty\x1a\x15.persontracking.Empty\"\x00\x12\x45\n\x0estart_tracking\x12\x1a.persontracking.Int32Value\x1a\x15.persontracking.Empty\"\x00\x42\x30\n\x19\x63om.example.carcontrollerB\x11MotorServiceProtoP\x01\x62\x06proto3') + serialized_pb=_b('\n\x1ctracking/lidar_tracker.proto\x12\x0epersontracking\"\x1b\n\nInt32Value\x12\r\n\x05value\x18\x01 \x01(\x05\"\x07\n\x05\x45mpty\">\n\x05Point\x12\r\n\x05\x61ngle\x18\x01 \x01(\x01\x12\x10\n\x08\x64istance\x18\x02 \x01(\x05\x12\x14\n\x0cgroup_number\x18\x03 \x01(\x05\"2\n\tPointScan\x12%\n\x06points\x18\x01 \x03(\x0b\x32\x15.persontracking.Point2\xe3\x01\n\x0ePersonTracking\x12I\n\x12set_tracking_group\x12\x1a.persontracking.Int32Value\x1a\x15.persontracking.Empty\"\x00\x12?\n\rstop_tracking\x12\x15.persontracking.Empty\x1a\x15.persontracking.Empty\"\x00\x12\x45\n\x0estart_tracking\x12\x1a.persontracking.Int32Value\x1a\x15.persontracking.Empty\"\x00\x42\x30\n\x19\x63om.example.carcontrollerB\x11MotorServiceProtoP\x01\x62\x06proto3') ) @@ -51,8 +52,8 @@ _INT32VALUE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=54, - serialized_end=81, + serialized_start=48, + serialized_end=75, ) @@ -75,8 +76,8 @@ _EMPTY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=83, - serialized_end=90, + serialized_start=77, + serialized_end=84, ) @@ -120,8 +121,8 @@ _POINT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=92, - serialized_end=154, + serialized_start=86, + serialized_end=148, ) @@ -151,8 +152,8 @@ _POINTSCAN = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=156, - serialized_end=206, + serialized_start=150, + serialized_end=200, ) _POINTSCAN.fields_by_name['points'].message_type = _POINT @@ -162,32 +163,32 @@ DESCRIPTOR.message_types_by_name['Point'] = _POINT DESCRIPTOR.message_types_by_name['PointScan'] = _POINTSCAN _sym_db.RegisterFileDescriptor(DESCRIPTOR) -Int32Value = _reflection.GeneratedProtocolMessageType('Int32Value', (_message.Message,), dict( - DESCRIPTOR = _INT32VALUE, - __module__ = 'persontracking.lidar_tracker_pb2' +Int32Value = _reflection.GeneratedProtocolMessageType('Int32Value', (_message.Message,), { + 'DESCRIPTOR' : _INT32VALUE, + '__module__' : 'tracking.lidar_tracker_pb2' # @@protoc_insertion_point(class_scope:persontracking.Int32Value) - )) + }) _sym_db.RegisterMessage(Int32Value) -Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), dict( - DESCRIPTOR = _EMPTY, - __module__ = 'persontracking.lidar_tracker_pb2' +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { + 'DESCRIPTOR' : _EMPTY, + '__module__' : 'tracking.lidar_tracker_pb2' # @@protoc_insertion_point(class_scope:persontracking.Empty) - )) + }) _sym_db.RegisterMessage(Empty) -Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), dict( - DESCRIPTOR = _POINT, - __module__ = 'persontracking.lidar_tracker_pb2' +Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), { + 'DESCRIPTOR' : _POINT, + '__module__' : 'tracking.lidar_tracker_pb2' # @@protoc_insertion_point(class_scope:persontracking.Point) - )) + }) _sym_db.RegisterMessage(Point) -PointScan = _reflection.GeneratedProtocolMessageType('PointScan', (_message.Message,), dict( - DESCRIPTOR = _POINTSCAN, - __module__ = 'persontracking.lidar_tracker_pb2' +PointScan = _reflection.GeneratedProtocolMessageType('PointScan', (_message.Message,), { + 'DESCRIPTOR' : _POINTSCAN, + '__module__' : 'tracking.lidar_tracker_pb2' # @@protoc_insertion_point(class_scope:persontracking.PointScan) - )) + }) _sym_db.RegisterMessage(PointScan) @@ -199,8 +200,8 @@ _PERSONTRACKING = _descriptor.ServiceDescriptor( file=DESCRIPTOR, index=0, serialized_options=None, - serialized_start=209, - serialized_end=436, + serialized_start=203, + serialized_end=430, methods=[ _descriptor.MethodDescriptor( name='set_tracking_group', diff --git a/persontracking/lidar_tracker_pb2_grpc.py b/tracking/lidar_tracker_pb2_grpc.py similarity index 64% rename from persontracking/lidar_tracker_pb2_grpc.py rename to tracking/lidar_tracker_pb2_grpc.py index 187f25f..ec7d070 100644 --- a/persontracking/lidar_tracker_pb2_grpc.py +++ b/tracking/lidar_tracker_pb2_grpc.py @@ -1,7 +1,7 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc -from persontracking import lidar_tracker_pb2 as persontracking_dot_lidar__tracker__pb2 +from tracking import lidar_tracker_pb2 as tracking_dot_lidar__tracker__pb2 class PersonTrackingStub(object): @@ -16,18 +16,18 @@ class PersonTrackingStub(object): """ self.set_tracking_group = channel.unary_unary( '/persontracking.PersonTracking/set_tracking_group', - request_serializer=persontracking_dot_lidar__tracker__pb2.Int32Value.SerializeToString, - response_deserializer=persontracking_dot_lidar__tracker__pb2.Empty.FromString, + request_serializer=tracking_dot_lidar__tracker__pb2.Int32Value.SerializeToString, + response_deserializer=tracking_dot_lidar__tracker__pb2.Empty.FromString, ) self.stop_tracking = channel.unary_unary( '/persontracking.PersonTracking/stop_tracking', - request_serializer=persontracking_dot_lidar__tracker__pb2.Empty.SerializeToString, - response_deserializer=persontracking_dot_lidar__tracker__pb2.Empty.FromString, + request_serializer=tracking_dot_lidar__tracker__pb2.Empty.SerializeToString, + response_deserializer=tracking_dot_lidar__tracker__pb2.Empty.FromString, ) self.start_tracking = channel.unary_unary( '/persontracking.PersonTracking/start_tracking', - request_serializer=persontracking_dot_lidar__tracker__pb2.Int32Value.SerializeToString, - response_deserializer=persontracking_dot_lidar__tracker__pb2.Empty.FromString, + request_serializer=tracking_dot_lidar__tracker__pb2.Int32Value.SerializeToString, + response_deserializer=tracking_dot_lidar__tracker__pb2.Empty.FromString, ) @@ -61,18 +61,18 @@ def add_PersonTrackingServicer_to_server(servicer, server): rpc_method_handlers = { 'set_tracking_group': grpc.unary_unary_rpc_method_handler( servicer.set_tracking_group, - request_deserializer=persontracking_dot_lidar__tracker__pb2.Int32Value.FromString, - response_serializer=persontracking_dot_lidar__tracker__pb2.Empty.SerializeToString, + request_deserializer=tracking_dot_lidar__tracker__pb2.Int32Value.FromString, + response_serializer=tracking_dot_lidar__tracker__pb2.Empty.SerializeToString, ), 'stop_tracking': grpc.unary_unary_rpc_method_handler( servicer.stop_tracking, - request_deserializer=persontracking_dot_lidar__tracker__pb2.Empty.FromString, - response_serializer=persontracking_dot_lidar__tracker__pb2.Empty.SerializeToString, + request_deserializer=tracking_dot_lidar__tracker__pb2.Empty.FromString, + response_serializer=tracking_dot_lidar__tracker__pb2.Empty.SerializeToString, ), 'start_tracking': grpc.unary_unary_rpc_method_handler( servicer.start_tracking, - request_deserializer=persontracking_dot_lidar__tracker__pb2.Int32Value.FromString, - response_serializer=persontracking_dot_lidar__tracker__pb2.Empty.SerializeToString, + request_deserializer=tracking_dot_lidar__tracker__pb2.Int32Value.FromString, + response_serializer=tracking_dot_lidar__tracker__pb2.Empty.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler(