From 491717493ab2f21e08f77cc653227b0e67abd41f Mon Sep 17 00:00:00 2001 From: "Lux, Dominik" Date: Mon, 24 Jun 2019 13:21:09 +0200 Subject: [PATCH 1/3] New ObjectConverter, fixes #18 , removed RCM and RosConfigurator refactoring Due to the new Converter, this partially fixes #19 . Keep in Mind that this functionality only works as long as ROS does not change their 'inner' Conversions for Python. Removed rcm completely (it is/was unused). Refactored RosConfigurator. There still might be some flaws due to missing tests --- CMakeLists.txt | 17 -- data/ros_msgs/CB_Event.msg | 8 - data/ros_msgs/Robot_Event.msg | 8 - data/ros_service_info/FIROS_Info.srv | 16 -- firos/core.py | 6 +- firos/include/FiwareObjectConverter | 2 +- firos/include/confManager.py | 9 +- firos/include/rcm/__init__.py | 17 -- firos/include/rcm/rcmutils.py | 25 -- firos/include/rcm/topicManager.py | 78 ------ firos/include/ros/rosConfigurator.py | 334 ++++++++++--------------- firos/include/ros/topicHandler.py | 10 +- firos/include/server/requestHandler.py | 8 +- 13 files changed, 155 insertions(+), 383 deletions(-) delete mode 100644 data/ros_msgs/CB_Event.msg delete mode 100644 data/ros_msgs/Robot_Event.msg delete mode 100644 data/ros_service_info/FIROS_Info.srv delete mode 100644 firos/include/rcm/__init__.py delete mode 100644 firos/include/rcm/rcmutils.py delete mode 100644 firos/include/rcm/topicManager.py diff --git a/CMakeLists.txt b/CMakeLists.txt index c181bb0..07310ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,23 +9,6 @@ find_package(catkin REQUIRED COMPONENTS message_generation ) -## Generate messages in the 'data/ros_msgs' folder -add_message_files( - DIRECTORY - data/ros_msgs - FILES - Robot_Event.msg - CB_Event.msg -) - -## Generate services in the 'data/ros_service_info' folder -add_service_files( - DIRECTORY - data/ros_service_info - FILES - FIROS_Info.srv -) - ## Generate messages which firos depends on generate_messages( DEPENDENCIES diff --git a/data/ros_msgs/CB_Event.msg b/data/ros_msgs/CB_Event.msg deleted file mode 100644 index 4293861..0000000 --- a/data/ros_msgs/CB_Event.msg +++ /dev/null @@ -1,8 +0,0 @@ -# entity_name provides the name of the robot as is presented to the context broker by firos -string entity_name - -# entity_status provides the status of the robot in the context broker: CREATED=1 or REMOVED=0 -int16 entity_status - -int16 CREATED=1 -int16 REMOVED=0 diff --git a/data/ros_msgs/Robot_Event.msg b/data/ros_msgs/Robot_Event.msg deleted file mode 100644 index 5d95b57..0000000 --- a/data/ros_msgs/Robot_Event.msg +++ /dev/null @@ -1,8 +0,0 @@ -# instance_name provides the name of the robot as is presented in the rcm platform -string instance_name - -# instance_status provides the status of the robot in the rcm platform: CONNECTED=1 or DISCONNECTED=0 -int16 instance_status - -int16 CONNECTED=1 -int16 DISCONNECTED=0 diff --git a/data/ros_service_info/FIROS_Info.srv b/data/ros_service_info/FIROS_Info.srv deleted file mode 100644 index 178c331..0000000 --- a/data/ros_service_info/FIROS_Info.srv +++ /dev/null @@ -1,16 +0,0 @@ -# identifies the robot -string instance_name ---- -# a string in json format which represents the configuration data for the robot -# { -# "ROBOT_NAME": { -# "topics": [ -# { -# "name": "TOPIC NAME", -# "msg": "TOPIC MESSAGE TYPE", -# "type": "COMMUNICATION TYPE" -# } -# ] -# } -# } -string json_format diff --git a/firos/core.py b/firos/core.py index afbbbff..f660600 100755 --- a/firos/core.py +++ b/firos/core.py @@ -81,10 +81,8 @@ from include import confManager from include.logger import Log, initLog from include.server.firosServer import FirosServer - + from include.ros.topicHandler import RosTopicHandler, loadMsgHandlers, createConnectionListeners, initPubAndSub - from include.rcm.topicManager import TopicManager - # Overwrite global variables with command line arguments (iff set) if results.port is not None: @@ -109,7 +107,6 @@ Log("INFO", "Initialized") - toMa = TopicManager() try: server = FirosServer("0.0.0.0", C.MAP_SERVER_PORT) @@ -119,7 +116,6 @@ def signal_handler(signal, frame): Log("INFO", ('\nExiting from the application')) RosTopicHandler.unregisterAll() - toMa.removeListeners() server.close() Log("INFO", ('\nExit')) sys.exit(0) diff --git a/firos/include/FiwareObjectConverter b/firos/include/FiwareObjectConverter index 4391225..38d9367 160000 --- a/firos/include/FiwareObjectConverter +++ b/firos/include/FiwareObjectConverter @@ -1 +1 @@ -Subproject commit 439122561c0755039f87ea5c344115802fe44e95 +Subproject commit 38d936776db0816736e97d8cd9e9c9fd5da32a5d diff --git a/firos/include/confManager.py b/firos/include/confManager.py index c364ced..1febdaf 100644 --- a/firos/include/confManager.py +++ b/firos/include/confManager.py @@ -34,9 +34,10 @@ def getRobots(refresh=False): robots we might send a lot of data. ''' try: - #Retrieves the whitelist.json. If it does not exists, it returns all topics. + # Retrieves the whitelist.json. If it does not exists, it returns all topics. robots = copy.deepcopy(RosConfigurator.systemTopics(refresh)) - #Retrieves the robots.json. + + # Retrieves the robots.json. robots_json = getRobotsByJson() if len(robots_json) == 0: Log("ERROR", "The file 'robots.json' is either empty or does not exist!\n\nExiting") @@ -52,10 +53,12 @@ def getRobots(refresh=False): for topic_name in robots_json[robot_name]["topics"]: topic = robots_json[robot_name]["topics"][topic_name] + # Overwrite or add! robots[robot_name]["topics"][str(topic_name)] = { - "msg": str(topic["msg"]) if type(topic["msg"]) is str else topic["msg"], + "msg": str(topic["msg"]), "type": str(topic["type"]) } + return robots except Exception as e: diff --git a/firos/include/rcm/__init__.py b/firos/include/rcm/__init__.py deleted file mode 100644 index 06c4e5c..0000000 --- a/firos/include/rcm/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -# MIT License -# -# Copyright (c) <2015> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/firos/include/rcm/rcmutils.py b/firos/include/rcm/rcmutils.py deleted file mode 100644 index fdce4e2..0000000 --- a/firos/include/rcm/rcmutils.py +++ /dev/null @@ -1,25 +0,0 @@ -import re -from include.ros.rosConfigurator import getWhiteLists - - -def toMsgType(msg): - return msg.replace("msgs/", "msgs.msg.").replace("/", ".msg.") - - -def getRobotConfig(robot_name="", topics=[]): - white_lists = getWhiteLists() - _topics = { - } - for topic in topics: - _topic = "/" + robot_name + "/" + topic['name'] - pubsub = topic['type'] - if (white_lists[pubsub] is not None and re.search(white_lists[pubsub], _topic) is not None) or (white_lists[pubsub] is None): - _topics[topic['name']] = { - "msg": toMsgType(topic["msg"]), - "type": pubsub - } - return { - robot_name: { - "topics": _topics - } - } diff --git a/firos/include/rcm/topicManager.py b/firos/include/rcm/topicManager.py deleted file mode 100644 index 6fbec12..0000000 --- a/firos/include/rcm/topicManager.py +++ /dev/null @@ -1,78 +0,0 @@ -import json -import rospy -import std_msgs.msg - -from firos.srv import FIROS_Info -from firos.msg import Robot_Event, CB_Event -from include.constants import Constants as C -from include.ros.topicHandler import robotDisconnection, loadMsgHandlers -from include.rcm.rcmutils import getRobotConfig - - -class TopicManager(object): - rcm_listener = None - firos_connect_listener = None - firos_disconnect_listener = None - robot_topics_service = None - - - def __init__(self): - ''' Lazy Initialization of all inner class attrs - ''' - self.rcm_listener = rospy.Subscriber("/rcm/robot_event", Robot_Event, self.onRcmEvent, {}) - self.firos_disconnect_listener = rospy.Subscriber(C.ROS_NODE_NAME + "/disconnect", std_msgs.msg.String, self.onDisconnect) - self.firos_connect_listener = rospy.Subscriber(C.ROS_NODE_NAME + "/connect", std_msgs.msg.String, self.onConnect) - self.cb_publisher = rospy.Publisher("/" + C.ROS_NODE_NAME + "/cb_event", CB_Event, queue_size=C.ROS_SUB_QUEUE_SIZE) - self.robot_topics_service = rospy.ServiceProxy('/' + C.ROS_NODE_NAME + '_info', FIROS_Info) - - def getRobotTopics(self, robot_name): - robot_json = self.robot_topics_service(robot_name) - parsed = json.loads(robot_json.json_format) - robot_data = getRobotConfig(robot_name, parsed[robot_name]["topics"]) - return robot_data - - - def onRcmEvent(self, data, args=None): - ## \brief Callback to handle ROS published data and send it to Context Broker - # \param data - # \param extra arguments - - msg = CB_Event() - msg.entity_name = data.instance_name - - # DISCONNECTION - if data.instance_status == 0: - robot_data = std_msgs.msg.String() - robot_data.data = data.instance_name - robotDisconnection(robot_data) - msg.entity_status = 0 - self.cb_publisher.publish(msg) - - # CONNECTION - elif data.instance_status == 1: - robot_data = self.getRobotTopics(data.instance_name) - loadMsgHandlers(robot_data) - msg.entity_status = 1 - self.cb_publisher.publish(msg) - - - def onDisconnect(self, data): - self.sendConnection(data.data, 0) - - - def onConnect(self, data): - self.sendConnection(data.data, 1) - - - def sendConnection(self, robot_name, status): - msg = CB_Event() - msg.entity_name = robot_name - msg.entity_status = status - self.cb_publisher.publish(msg) - - - def removeListeners(self): - self.rcm_listener.unregister() - self.firos_disconnect_listener.unregister() - self.firos_connect_listener.unregister() - self.cb_publisher.unregister() diff --git a/firos/include/ros/rosConfigurator.py b/firos/include/ros/rosConfigurator.py index 930e5c7..d2f4798 100644 --- a/firos/include/ros/rosConfigurator.py +++ b/firos/include/ros/rosConfigurator.py @@ -14,227 +14,167 @@ # FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import os import re import json -import socket import rostopic -import rosgraph +import rospy from include.logger import Log from include.constants import Constants as C -# TODO DL previously ur'' was used instead of r''? or ''? . Working? Refactor! -#map_regex = re.compile(ur'^.*\/(map)[\/]*$') -map_regex = re.compile(u'^.*\/(map).*$') -topic_regex = re.compile(u'^\/([\w]+)\/*([\/\-\w]*)$') -substitution_regex = re.compile(u'^([\/\-\w]*)\/([\w]+)$') -robots = {} -ROBO_TOPIC_REG = {} - -CURRENT_TOPIC_REG = {} - -mem_whitelist = None +entries = [] # Entries we found in the ROS-World +whitelist = {} # The Current Whitelist FIROS is currently using +robots = {} # The dictionary containing: robots[ROBOT_ID]["topics"][TOPIC_NAME]["msg"/"type"] class RosConfigurator: - ## \brief Tool to get Ros data from system + ''' + RosConfigurator -> This is an OLD Name + This loads the Whitelist.json and generates the first + ''' @staticmethod - def getMapTopics(): - ## \brief Get topics that are maps + def getAllTopics(refresh=True): + ''' + this retrieves all Entries/Topics found in the current + ROS-World. The Parameter, refresh, indicates, whether we want to + update our current information abour the entries or not + ''' + global entries + if refresh or len(entries) == 0: + listOfData = rospy.get_published_topics() + entries = [item for sublist in listOfData for item in sublist] + + return entries + - master = rosgraph.Master('/rostopic') - maps = [] - try: - state = master.getSystemState() + @staticmethod + def getWhiteList(restore=False): + ''' + This retrieves the Whitelist.json Configuration + and overwrites the data, depending on the restore-Flag + ''' + global whitelist + if whitelist == {} or restore: + json_path = C.PATH + "/whitelist.json" + whitelist = json.load(open(json_path)) + if len(whitelist) == 0: + Log("WARNING", "The 'whitelist.json' was not set. You might want to use a whitelist to avoid subscribing to every existing topic!") - pubs, subs, _ = state + return whitelist - for topic_name, l in pubs: - if re.search(map_regex, topic_name): - maps.append(topic_name) - except socket.error: - raise rostopic.ROSTopicIOException("Unable to communicate with master!") - return maps @staticmethod - def topic_type(t, topic_types): - ## \brief Get topic's data type - # \param topic - # \param topic types - matches = [t_type for t_name, t_type in topic_types if t_name == t] - if matches: - text = re.search(substitution_regex, str(matches[0])) - if text is not None: - return str(text.group(1)) + ".msg." + str(text.group(2)) - else: - return matches[0].replace("msgs/", "msgs.msg.").replace("/", ".msg.") - - return 'unknown type' + def systemTopics(refresh=False, restore=False): + ''' + This generates the actual robots-Structure + At First the Regex-Expressions are generated, then the Robot with the + topic is added iff it exists in the ROS-World. + + refresh: Refreshes the ROS-World Information if set to True AND the robots dictionary + restore: Restores the Whitelist to the original Whitelist.json-File + if set to True + ''' + global entries + global whitelist + global robots + if refresh: + # Only Update robots if we want to + entries = RosConfigurator.getAllTopics(refresh=refresh) + whitelist = RosConfigurator.getWhiteList(restore=restore) + # Create the robots Structure as follows: + # robots[robotID]['topic'][topic]['publisher'/'subscriber']['type'/'msg'] + _robots = {} + + for robotIDRegex in whitelist: + # For each RobotID Regex + if "publisher" in whitelist[robotIDRegex]: + for topicRegex in whitelist[robotIDRegex]["publisher"]: + # For each topic Regex in publisher + # Build the Regex: + fullRegex = ("^\/("+ robotIDRegex + ")\/("+ topicRegex + ")$") + RosConfigurator.addRobots(_robots, fullRegex, entries, "publisher") + + if "subscriber" in whitelist[robotIDRegex]: + for topicRegex in whitelist[robotIDRegex]["subscriber"]: + # For each topic Regex in subscriber + # Build the Regex: + fullRegex = ("^\/("+ robotIDRegex + ")\/("+ topicRegex + ")$") + RosConfigurator.addRobots(_robots, fullRegex, entries, "subscriber") + + robots = _robots + return robots + + @staticmethod - def setRobot(_robots, topic, t_type, pubsub, whiteLists): - ## \brief Set robot in robot container based on whitelist and topic lifecycle - # \param local robot dictionary - # \param topic name - # \param topic type - # \param publisher/subscriber action - # \param whitelist regular expresions - global ROBO_TOPIC_REG - global robots - matching = re.search(topic_regex, topic) - robot_topic = matching.group(2) - if robot_topic != '': - robot_name = matching.group(1) - if (whiteLists[pubsub] is not None and re.search(whiteLists[pubsub], topic) is not None) or (whiteLists[pubsub] is None): - if robot_name not in ROBO_TOPIC_REG: - ROBO_TOPIC_REG[robot_name] = {"topics": []} - if robot_name not in CURRENT_TOPIC_REG: - CURRENT_TOPIC_REG[robot_name] = {"topics": []} - - if robot_name not in _robots: - _robots[robot_name] = {"topics": {}} - - if robot_topic not in _robots[robot_name]["topics"]: - CURRENT_TOPIC_REG[robot_name]["topics"].append(robot_topic) - _robots[robot_name]["topics"][robot_topic] = { - "msg": t_type, - "type": pubsub - } - - if robot_name not in robots: - robots[robot_name] = {"topics": {}} - if robot_topic not in robots[robot_name]["topics"]: - ROBO_TOPIC_REG[robot_name]["topics"].append(robot_topic) - robots[robot_name]["topics"][robot_topic] = { - "msg": t_type, - "type": pubsub - } + def addRobots(robots, regex, entries, pubsub): + ''' + This adds the Entry in the complex robots dictionary + We iterate over each entry and initialize the robots-dict + appropiately. Then It is simply added. + + robots: The dictionary robots[ROBOT_ID]["topics"][TOPIC_NAME] = {msg, type} + regex: The Regex we try to match in each entry + entries:The String Entries. Each element is in the following structure "/ROBOT_ID/TOPIC_NAME" + pubsub: A String. Either "publisher" or "subscriber" + ''' + for entry in entries: + matches = re.search(regex, entry) + if matches is not None: + # We found a Match. Now add it to robots + robotID = matches.group(1) + topic = matches.group(2) + + if robotID not in robots: + # Init robot Dict + robots[robotID] = {} + robots[robotID]["topics"] = {} + + if topic not in robots[robotID]["topics"]: + # Init topic Dict + robots[robotID]["topics"][topic] = {} + + # Get Message Type and convert it to Python-Specific Import + topic_type, _, _ = rostopic.get_topic_type(entry) + msg_type = topic_type.replace("/", ".msg.") + + # Set it in robots + robots[robotID]["topics"][topic]["type"] = pubsub + robots[robotID]["topics"][topic]["msg"] = msg_type + @staticmethod def removeRobot(robot_name): - ## \brief Remove robot from list - # \param robot name + ''' + This removes the robot from robots + ''' global robots if robot_name in robots: del robots[robot_name] - del ROBO_TOPIC_REG[robot_name] + @staticmethod - def systemTopics(refresh=False): - ## \brief Get existing topics and return in a map grouped by namespace - # \param refresh list - global robots - global CURRENT_TOPIC_REG - CURRENT_TOPIC_REG = {} - if refresh: - existing_topics = { - "publisher": {}, - "subscriber": {} - } - whiteLists = getWhiteLists() - _robots = {} - master = rosgraph.Master('/rostopic') - try: - state = master.getSystemState() - topic_types = rostopic._master_get_topic_types(master) - - pubs, subs, _ = state - - for t, l in pubs: - existing_topics["publisher"][t] = l - for t, l in subs: - existing_topics["subscriber"][t] = l - - # ROS publisher --> firos subscribes to listen data published - for t, l in pubs: - subscribing = _isInFiros(t, existing_topics["subscriber"], l) - publishing = _isInFiros(t, existing_topics["publisher"], l) - if not subscribing and not publishing: - _type = RosConfigurator.topic_type(t, topic_types) - RosConfigurator.setRobot(_robots, t, _type, "subscriber", whiteLists) - RosConfigurator.setRobot(_robots, t, _type, "publisher", whiteLists) - - # ROS subscriber --> firos publishes data to them - for t, l in subs: - subscribing = _isInFiros(t, existing_topics["subscriber"], l) - publishing = _isInFiros(t, existing_topics["publisher"], l) - if not subscribing and not publishing: - _type = RosConfigurator.topic_type(t, topic_types) - RosConfigurator.setRobot(_robots, t, _type, "publisher", whiteLists) - RosConfigurator.setRobot(_robots, t, _type, "subscriber", whiteLists) - - except socket.error: - raise rostopic.ROSTopicIOException("Unable to communicate with master!") - - return _robots - else: - return robots - - -def setWhiteList(additions, deletions, restore=False): - global mem_whitelist - if mem_whitelist is None: - try: - json_path = C.PATH + "/whitelist.json" - mem_whitelist = json.load(open(json_path)) - if len(mem_whitelist) == 0: - Log("WARNING", "The 'whitelist.json' was not set. You might want to use a whitelist to avoid subscribing to every existing topic!") - except: - mem_whitelist = {} - if additions: - for robot_name in additions: - mem_whitelist[robot_name] = additions[robot_name] - if deletions: - for robot_name in deletions: - if robot_name in mem_whitelist: - for topic in deletions[robot_name]["publisher"]: - if topic in mem_whitelist[robot_name]["publisher"]: - mem_whitelist[robot_name]["publisher"].remove(topic) - for topic in deletions[robot_name]["subscriber"]: - if topic in mem_whitelist[robot_name]["subscriber"]: - mem_whitelist[robot_name]["subscriber"].remove(topic) - if restore: - mem_whitelist = None - - -def _isInFiros(topic_name, list2Check, nodes): - using = False - if topic_name not in list2Check: - return False - for node in list2Check[topic_name]: - if node == "/" + C.ROS_NODE_NAME: - using = True - break - - return using - - -def getWhiteLists(): - return { - "publisher": _getWhiteList("publisher"), - "subscriber": _getWhiteList("subscriber") - } - - -def _getWhiteList(pubsub): - try: - if mem_whitelist is None: - json_path = C.PATH + "/whitelist.json" - data = json.load(open(json_path)) - if len(data) == 0: - Log("WARNING", "The 'whitelist.json' was not set. You might want to use a whitelist to avoid subscribing to every existing topic!") - else: - data = mem_whitelist - - whiteregex = u'' - for robot_name in data: - for topic in data[robot_name][pubsub]: - whiteregex += '(/' + robot_name + '/' + topic + ')|' - whiteregex = whiteregex[:-1] - whiteregex += "$" - whiteregex = u'^' + whiteregex - return whiteregex - except: - return None + def setWhiteList(additions, deletions, restore=False): + ''' + This Adds or deletes entries inside the whitelist + ''' + global whitelist + + + if additions: + for robot_name in additions: + whitelist[robot_name] = additions[robot_name] + + if deletions: + for robot_name in deletions: + if robot_name in whitelist: + for topic in deletions[robot_name]["publisher"]: + if topic in whitelist[robot_name]["publisher"]: + whitelist[robot_name]["publisher"].remove(topic) + for topic in deletions[robot_name]["subscriber"]: + if topic in whitelist[robot_name]["subscriber"]: + whitelist[robot_name]["subscriber"].remove(topic) + + if restore: + whitelist = RosConfigurator.getWhiteList(restore=True) diff --git a/firos/include/ros/topicHandler.py b/firos/include/ros/topicHandler.py index 10d3f8a..de130c4 100644 --- a/firos/include/ros/topicHandler.py +++ b/firos/include/ros/topicHandler.py @@ -28,7 +28,7 @@ from include.logger import Log from include.constants import Constants as C from include.libLoader import LibLoader -from include.ros.rosConfigurator import RosConfigurator +from include import confManager # PubSub Handlers from include.contextbroker.cbPublisher import CbPublisher @@ -92,6 +92,8 @@ def loadMsgHandlers(robot_data): Log("INFO", "Getting configuration data") Log("INFO", "Generating topic handlers:") + # Generate + for robotID in robot_data.keys(): for topic in robot_data[robotID]['topics'].keys(): # for each robotID and topic in robot_data: @@ -287,11 +289,11 @@ def createConnectionListeners(): /ROS_NODE_NAME/connect --> std_msgs/String /ROS_NODE_NAME/disconnect --> std_msgs/String ''' - subscribers.append(rospy.Subscriber(C.ROS_NODE_NAME + "/disconnect", std_msgs.msg.String, robotDisconnection)) + subscribers.append(rospy.Subscriber(C.ROS_NODE_NAME + "/disconnect", std_msgs.msg.String, _robotDisconnection)) subscribers.append(rospy.Subscriber(C.ROS_NODE_NAME +"/connect", std_msgs.msg.String, _robotConnection)) -def robotDisconnection(data): +def _robotDisconnection(data): ''' Unregisters from a given robotID by a ROBOT data: The String which was sent to firos @@ -318,4 +320,4 @@ def _robotConnection(data): ''' robot_name = data.data Log("INFO", "Connected robot: " + robot_name) - loadMsgHandlers(RosConfigurator.systemTopics(True)) + loadMsgHandlers(confManager.getRobots(True)) diff --git a/firos/include/server/requestHandler.py b/firos/include/server/requestHandler.py index 79ee286..9a44e01 100644 --- a/firos/include/server/requestHandler.py +++ b/firos/include/server/requestHandler.py @@ -38,7 +38,7 @@ from include.logger import Log from include.confManager import getRobots -from include.ros.rosConfigurator import RosConfigurator, setWhiteList +from include.ros.rosConfigurator import RosConfigurator from include.ros.topicHandler import RosTopicHandler, loadMsgHandlers, ROS_PUBLISHER, ROS_SUBSCRIBER, ROS_TOPIC_AS_DICT from include.contextbroker.cbSubscriber import CbSubscriber from include.constants import Constants as C @@ -238,18 +238,18 @@ def onDisConnect(request, action): ### The below Operations are no longer maintained. def onWhitelistWrite(request, action): data = getPostParams(request) - setWhiteList(data, None) + RosConfigurator.setWhiteList(data, None) end_request(request, None, 200, "") def onWhitelistRemove(request, action): data = getPostParams(request) - setWhiteList(None, data) + RosConfigurator.setWhiteList(None, data) end_request(request, None, 200, "") def onWhitelistRestore(request, action): - setWhiteList(None, None, True) + RosConfigurator.setWhiteList(None, None, True) end_request(request, None, 200, "") ### The above Operations are no longer maintained From ea9fc6a84adc448ea6dd6b714f2623aa6de55d33 Mon Sep 17 00:00:00 2001 From: Peter Detzner <6792838+ptrdtznr@users.noreply.github.com> Date: Thu, 27 Jun 2019 13:41:11 +0200 Subject: [PATCH 2/3] Added a new presentation about it --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b34cb5e..d70343f 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,6 @@ Dominik Lux, Peter Detzner FIROS-Helping Robots to be Context Aware ([Slideshare](https://de.slideshare.net/FI-WARE/fiware-global-summit-FIROS-helping-robots-to-be-context-aware), 28.11.2018 FIWARE Global Summit, Malaga) +FIROS-Helping Robots to be Context Aware II +([Slideshare](https://de.slideshare.net/FI-WARE/fiware-global-summit-firos-making-robots-context-aware), +21.05.2019 FIWARE Global Summit, Genova) From aa1b3fc96150346f29c428a79cc4113ebe45fb82 Mon Sep 17 00:00:00 2001 From: Peter Detzner <6792838+ptrdtznr@users.noreply.github.com> Date: Thu, 27 Jun 2019 13:41:25 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d70343f..116cfeb 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ Dominik Lux, Peter Detzner FIROS-Helping Robots to be Context Aware ([Slideshare](https://de.slideshare.net/FI-WARE/fiware-global-summit-FIROS-helping-robots-to-be-context-aware), 28.11.2018 FIWARE Global Summit, Malaga) + FIROS-Helping Robots to be Context Aware II ([Slideshare](https://de.slideshare.net/FI-WARE/fiware-global-summit-firos-making-robots-context-aware), 21.05.2019 FIWARE Global Summit, Genova)