Cleaned up code a bit

This commit is contained in:
Alex Davies 2023-11-08 06:45:11 -08:00
parent 53119c8b2a
commit 36ccdb364b
1 changed files with 0 additions and 20 deletions

View File

@ -10,26 +10,6 @@ import os
rosbridge = roslibpy.Ros(host=os.environ['HOST'], port=int(os.environ['PORT']))
rosbridge.run()
def callback_battery(data):
print(data)
print("-------")
class GenericMessageSubscriber(object):
def __init__(self, topic_name, callback):
self._binary_sub = rospy.Subscriber(
topic_name, rospy.AnyMsg, self.generic_message_callback)
self._callback = callback
def generic_message_callback(self, data):
connection_header = data._connection_header['type'].split('/')
ros_pkg = connection_header[0] + '.msg'
msg_type = connection_header[1]
msg_class = getattr(import_module(ros_pkg), msg_type)
msg = msg_class().deserialize(data._buff)
self._callback(msg)
class GenericMessageRelay(object):
def __init__(self, topic_name,topic_prefix=""):
"""topic_prefix is what we prefix the topic with