diff --git a/.Dockerfile b/.Dockerfile
index b91b1b2bf..e1f76e6c4 100644
--- a/.Dockerfile
+++ b/.Dockerfile
@@ -1,12 +1,12 @@
# ROSPlan docker image
-FROM ros:melodic
+FROM ros:noetic
SHELL ["/bin/bash", "-c"]
WORKDIR /root/ws
# install dependencies
-RUN apt update -qq && apt install python-catkin-tools git vim bash-completion -y -qq
+RUN apt update -qq && apt install python3-catkin-tools python3-osrf-pycommon git vim bash-completion -y -qq
# Create WS
RUN source /opt/ros/$ROS_DISTRO/setup.bash &&\
@@ -35,4 +35,4 @@ RUN catkin build --summarize --no-status
# Prepare workspace for runtime. Set the prompt to be colored
RUN echo -e "source /opt/ros/$ROS_DISTRO/setup.bash\nsource devel/setup.bash" >> ~/.bashrc &&\
- sed -i s/^#force_color_prompt/force_color_prompt/g ~/.bashrc
\ No newline at end of file
+ sed -i s/^#force_color_prompt/force_color_prompt/g ~/.bashrc
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5929a092d..9c8d64da7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,12 +7,12 @@ on:
branches-ignore: gh-pages
env:
- ROS_VERSION: melodic
+ ROS_VERSION: noetic
jobs:
build:
runs-on: ubuntu-latest
container:
- image: ros:melodic
+ image: ros:noetic
steps:
- name: Prepare docker
run: |
@@ -20,7 +20,7 @@ jobs:
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true apt-key adv --keyserver keyserver.ubuntu.com --recv-key E1DD270288B4E6030699E45FA1715D88E1DF1F24 2>&1
echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" | tee /etc/apt/sources.list.d/git.list
sudo apt update -qq
- sudo apt install python-catkin-tools git -y -qq
+ sudo apt install python3-catkin-tools python3-osrf-pycommon git -y -qq
- name: Create ROS workspace
run: |
source /opt/ros/$ROS_VERSION/setup.bash
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a8bbc4fc2..d9e94223f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -3,11 +3,11 @@ name: test
on: [push, pull_request]
env:
- ROS_VERSION: melodic
+ ROS_VERSION: noetic
jobs:
build-and-test:
runs-on: ubuntu-latest
- container: ros:melodic
+ container: ros:noetic
steps:
- name: Prepare docker
run: |
@@ -15,7 +15,7 @@ jobs:
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true apt-key adv --keyserver keyserver.ubuntu.com --recv-key E1DD270288B4E6030699E45FA1715D88E1DF1F24 2>&1
echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" | tee /etc/apt/sources.list.d/git.list
sudo apt update -qq
- sudo apt install python-catkin-tools git -y -qq
+ sudo apt install python3-catkin-tools python3-osrf-pycommon git -y -qq
- name: Create ROS workspace
run: |
source /opt/ros/$ROS_VERSION/setup.bash
diff --git a/README.md b/README.md
index bdad74dac..4ea937a9a 100644
--- a/README.md
+++ b/README.md
@@ -15,11 +15,11 @@ Several demos are available in the [rosplan_demos repository](https://github.com
## Installation
-ROSPlan supports kinetic and melodic ROS distributions and is developed under Ubuntu 16.04 / 18.04, being linux Ubuntu 18.04 + melodic the recommended setup.
+ROSPlan supports by default noetic ROS1 distribution and is developed under Ubuntu 20.04.
Install dependencies:
```sh
-sudo apt install flex bison freeglut3-dev libbdd-dev python-catkin-tools ros-$ROS_DISTRO-tf2-bullet
+sudo apt install flex bison freeglut3-dev libbdd-dev python3-osrf-pycommon python3-catkin-tools
```
Select or create a [catkin workspace](http://wiki.ros.org/catkin/Tutorials/create_a_workspace):
diff --git a/rosplan_action_interface/setup.py b/rosplan_action_interface/setup.py
index 004d01b3c..39deeef6a 100644
--- a/rosplan_action_interface/setup.py
+++ b/rosplan_action_interface/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
diff --git a/rosplan_action_interface/src/ActionInterfaceManager.py b/rosplan_action_interface/src/ActionInterfaceManager.py
index 917954200..63ab47abe 100755
--- a/rosplan_action_interface/src/ActionInterfaceManager.py
+++ b/rosplan_action_interface/src/ActionInterfaceManager.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
from rosplan_dispatch_msgs.msg import ActionDispatch, ActionFeedback
diff --git a/rosplan_action_interface/src/ActionlibActionInterface.py b/rosplan_action_interface/src/ActionlibActionInterface.py
index ac74a3869..4bbc1a0d7 100644
--- a/rosplan_action_interface/src/ActionlibActionInterface.py
+++ b/rosplan_action_interface/src/ActionlibActionInterface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
import importlib
diff --git a/rosplan_action_interface/src/BaseActionInterface.py b/rosplan_action_interface/src/BaseActionInterface.py
index dcbadb26b..c73ff4a19 100644
--- a/rosplan_action_interface/src/BaseActionInterface.py
+++ b/rosplan_action_interface/src/BaseActionInterface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
import actionlib
diff --git a/rosplan_action_interface/src/FSMActionInterface.py b/rosplan_action_interface/src/FSMActionInterface.py
index 48f3a788c..5fee80e90 100644
--- a/rosplan_action_interface/src/FSMActionInterface.py
+++ b/rosplan_action_interface/src/FSMActionInterface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy, copy
import actionlib
diff --git a/rosplan_action_interface/src/RPKnowledgeBaseLink.py b/rosplan_action_interface/src/RPKnowledgeBaseLink.py
index 9230f0e2d..6a55ce381 100644
--- a/rosplan_action_interface/src/RPKnowledgeBaseLink.py
+++ b/rosplan_action_interface/src/RPKnowledgeBaseLink.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from collections import defaultdict
diff --git a/rosplan_action_interface/src/ServiceActionInterface.py b/rosplan_action_interface/src/ServiceActionInterface.py
index 6540f62a9..b6b23c469 100644
--- a/rosplan_action_interface/src/ServiceActionInterface.py
+++ b/rosplan_action_interface/src/ServiceActionInterface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
import importlib
diff --git a/rosplan_dependencies/CMakeLists.txt b/rosplan_dependencies/CMakeLists.txt
index 7d6eacad0..378912a3a 100644
--- a/rosplan_dependencies/CMakeLists.txt
+++ b/rosplan_dependencies/CMakeLists.txt
@@ -89,7 +89,7 @@ if (LBITS EQUAL 64)
else()
SET (RDDL_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif(LBITS EQUAL 64)
-SET (RDDL_CMAKE_CXX_FLAGS "${RDDL_CMAKE_CXX_FLAGS} -g -Wall -W -Wno-sign-compare -Wno-deprecated -ansi -pedantic -Werror -std=c++11 -O3 -DNDEBUG -fomit-frame-pointer")
+SET (RDDL_CMAKE_CXX_FLAGS "${RDDL_CMAKE_CXX_FLAGS} -g -Wall -W -Wno-sign-compare -Wno-deprecated -ansi -pedantic -Werror -std=c++11 -O3 -DNDEBUG -fomit-frame-pointer -Wno-error=deprecated-copy")
# Lexer and parser
find_package(BISON 3.0.4 REQUIRED)
@@ -346,4 +346,3 @@ endif(ROSPLAN_COMPILE_CHIMP)
########################################################################################################################
########################################################################################################################
-
diff --git a/rosplan_dependencies/chimp b/rosplan_dependencies/chimp
index ce7ad7926..af1fbfeff 160000
--- a/rosplan_dependencies/chimp
+++ b/rosplan_dependencies/chimp
@@ -1 +1 @@
-Subproject commit ce7ad7926c0a1b8dd7790763bb8e7b85dbe768a1
+Subproject commit af1fbfeffb3dde515cda24c25495fb5413593e23
diff --git a/rosplan_planning_system/scripts/direct_esterel_parser.py b/rosplan_planning_system/scripts/direct_esterel_parser.py
index 13aec1153..cb1d256a0 100755
--- a/rosplan_planning_system/scripts/direct_esterel_parser.py
+++ b/rosplan_planning_system/scripts/direct_esterel_parser.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
import genpy
diff --git a/rosplan_rqt/package.xml b/rosplan_rqt/package.xml
index 5973c034c..6f9629e8e 100644
--- a/rosplan_rqt/package.xml
+++ b/rosplan_rqt/package.xml
@@ -1,21 +1,21 @@
- rosplan_rqt
- 0.0.0
- The rosplan_rqt package
- michael
- BSD
- https://github.com/KCL-Planning/ROSPlan
+ rosplan_rqt
+ 0.0.0
+ The rosplan_rqt package
+ michael
+ BSD
+ https://github.com/KCL-Planning/ROSPlan
- catkin
+ catkin
- python-rospkg
- rqt_gui
- rqt_gui_py
- std_msgs
- rqt_graph
+ python3-rospkg
+ rqt_gui
+ rqt_gui_py
+ std_msgs
+ rqt_graph
-
-
-
+
+
+
diff --git a/rosplan_rqt/scripts/esterel_plan_viewer.py b/rosplan_rqt/scripts/esterel_plan_viewer.py
index 00daa0901..314405df3 100755
--- a/rosplan_rqt/scripts/esterel_plan_viewer.py
+++ b/rosplan_rqt/scripts/esterel_plan_viewer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
diff --git a/rosplan_rqt/src/rosplan_rqt/ROSPlanActionDispatcher.py b/rosplan_rqt/src/rosplan_rqt/ROSPlanActionDispatcher.py
index 21e8dfa64..12c05ca61 100644
--- a/rosplan_rqt/src/rosplan_rqt/ROSPlanActionDispatcher.py
+++ b/rosplan_rqt/src/rosplan_rqt/ROSPlanActionDispatcher.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import rospy
@@ -51,8 +51,8 @@ def __init__(self, plugin=None):
label_list.append(param.key)
self._parameter_type_list[op.name] = param_list
self._parameter_label_list[op.name] = label_list
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
self._handle_operator_name_changed(0)
# connect components
diff --git a/rosplan_rqt/src/rosplan_rqt/ROSPlanDispatcher.py b/rosplan_rqt/src/rosplan_rqt/ROSPlanDispatcher.py
index 497e4f362..befed68c9 100644
--- a/rosplan_rqt/src/rosplan_rqt/ROSPlanDispatcher.py
+++ b/rosplan_rqt/src/rosplan_rqt/ROSPlanDispatcher.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import rospy
@@ -6,7 +6,6 @@
import sys
from itertools import product
-from string import join, split
from std_msgs.msg import *
from diagnostic_msgs.msg import KeyValue
@@ -61,8 +60,8 @@ def __init__(self, plugin=None):
label_list.append(param.key)
self._predicate_param_type_list[pred.name] = param_list
self._predicate_param_label_list[pred.name] = label_list
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
self._handle_goal_name_changed(0)
self._handle_fact_name_changed(0)
@@ -75,8 +74,8 @@ def __init__(self, plugin=None):
for typename in resp.types:
self.typeComboBox.addItem(typename)
self._type_list.append(typename)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
# connect components
self.planButton.clicked[bool].connect(self._handle_plan_clicked)
@@ -144,8 +143,8 @@ def refresh_model(self):
self._goal_list[goalText] = goal
if goalText in selected_list:
item.setSelected(True)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
# facts and functions
rospy.wait_for_service('rosplan_knowledge_base/state/propositions')
selected_list = []
@@ -171,8 +170,8 @@ def refresh_model(self):
self._fact_list[attributeText] = attribute
if attributeText in selected_list:
item.setSelected(True)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
# instances
expanded_list = []
root = self.instanceView.invisibleRootItem()
@@ -184,7 +183,7 @@ def refresh_model(self):
self.instanceView.clear()
for typename in self._type_list:
instance_client = rospy.ServiceProxy('rosplan_knowledge_base/state/instances', GetInstanceService)
- resp = instance_client(typename)
+ resp = instance_client(type_name=typename)
item = QTreeWidgetItem(self.instanceView)
item.setText(0, typename)
for instancename in resp.instances:
@@ -274,13 +273,15 @@ def _handle_predicate_name_change(self, predName, combo):
for param_type in self._predicate_param_type_list[predName]:
try:
predicates_client = rospy.ServiceProxy('rosplan_knowledge_base/state/instances', GetInstanceService)
- resp = predicates_client(param_type)
+ resp = predicates_client(type_name=param_type)
parameters.append(resp.instances)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
for element in product(*parameters):
- pred = join(element, ' ')
- combo.addItem(pred)
+ pred = ''
+ for single_element in element:
+ pred += f'{single_element} '
+ combo.addItem(pred[:-1])
def _handle_goal_name_changed(self, index):
self._handle_predicate_name_change(self.goalNameComboBox.itemText(index), self.goalComboBox)
@@ -299,15 +300,15 @@ def _handle_add_button_clicked(self, updateType, predName, combo):
knowledge.knowledge_type = KnowledgeItem.FACT
knowledge.attribute_name = predName
index = 0
- for param in split(combo.currentText()):
+ for param in str.split(combo.currentText()):
pair = KeyValue()
pair.key = (self._predicate_param_label_list[knowledge.attribute_name])[index]
index = index + 1
pair.value = param
knowledge.values.append(pair)
resp = update_client(updateType, knowledge)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
def _handle_add_goal_clicked(self, data):
self._handle_add_button_clicked(KnowledgeUpdateServiceRequest.ADD_GOAL, self.goalNameComboBox.currentText(), self.goalComboBox)
@@ -326,8 +327,8 @@ def _handle_remove_button_clicked(self, updateType, removeNameList, removeMsgLis
try:
update_client = rospy.ServiceProxy('rosplan_knowledge_base/update', KnowledgeUpdateService)
resp = update_client(updateType, removeMsgList[item.text()])
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
self.refresh_model()
def _handle_remove_goal_clicked(self, checked):
@@ -352,8 +353,8 @@ def _handle_add_instance_clicked(self, checked):
knowledge.instance_type = self.typeComboBox.currentText()
knowledge.instance_name = self.instanceNameEdit.text()
resp = update_client(KnowledgeUpdateServiceRequest.ADD_KNOWLEDGE, knowledge)
- except rospy.ServiceException, e:
- print "Service call failed: %s"%e
+ except rospy.ServiceException as e:
+ rospy.logerr(f'Service call failed: {e}')
self.refresh_model()
"""
diff --git a/rosplan_rqt/src/rosplan_rqt/ROSPlanEsterelPlanViewer.py b/rosplan_rqt/src/rosplan_rqt/ROSPlanEsterelPlanViewer.py
index 3bbcbb112..f1d049e11 100644
--- a/rosplan_rqt/src/rosplan_rqt/ROSPlanEsterelPlanViewer.py
+++ b/rosplan_rqt/src/rosplan_rqt/ROSPlanEsterelPlanViewer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import rospy
diff --git a/rosplan_rqt/src/rosplan_rqt/ROSPlanProblemViewer.py b/rosplan_rqt/src/rosplan_rqt/ROSPlanProblemViewer.py
index b5ff884e2..b2f79e5fe 100644
--- a/rosplan_rqt/src/rosplan_rqt/ROSPlanProblemViewer.py
+++ b/rosplan_rqt/src/rosplan_rqt/ROSPlanProblemViewer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import rospy
@@ -6,7 +6,6 @@
import sys
from itertools import product
-from string import join, split
from std_msgs.msg import *
from diagnostic_msgs.msg import KeyValue
diff --git a/rosplan_rqt/src/rosplan_rqt/graphUpdater.py b/rosplan_rqt/src/rosplan_rqt/graphUpdater.py
index 04b4aa779..2551b12c1 100644
--- a/rosplan_rqt/src/rosplan_rqt/graphUpdater.py
+++ b/rosplan_rqt/src/rosplan_rqt/graphUpdater.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import rospy
diff --git a/rosplan_rqt/src/rosplan_rqt/xdot_qt.py b/rosplan_rqt/src/rosplan_rqt/xdot_qt.py
index 5336e87f7..e3727c015 100644
--- a/rosplan_rqt/src/rosplan_rqt/xdot_qt.py
+++ b/rosplan_rqt/src/rosplan_rqt/xdot_qt.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
# NOTE: Important, this file can be safely removed once one of this PR gets accepted:
# https://github.com/ros-visualization/executive_smach_visualization/pull/22
# https://github.com/jbohren/xdot/pull/18
@@ -6,7 +8,6 @@
# or
# from xdot.xdot_qt import DotWidget
-#!/usr/bin/env python
#
# Copyright 2008 Jose Fonseca
#
@@ -218,7 +219,7 @@ def __init__(self, pen, points, filled=False):
def draw(self, painter, highlight=False):
painter_path = QPainterPath()
painter_path.moveTo(QPointF(*self.points[0]))
- for i in xrange(1, len(self.points), 3):
+ for i in range(1, len(self.points), 3):
painter_path.cubicTo(
QPointF(*self.points[i]),
QPointF(*self.points[i + 1]),
@@ -571,6 +572,8 @@ def parse(self):
elif op == "p":
points = self.read_polygon()
self.handle_polygon(points, filled=False)
+ elif op == "":
+ break
else:
sys.stderr.write("unknown xdot opcode '%s'\n" % op)
break
@@ -1324,7 +1327,7 @@ def drag(self, deltax, deltay):
def draw(self, painter):
#TODO: implement this for qt
- print "ERROR: UNIMPLEMENTED ZoomAreaAction.draw"
+ print('ERROR: UNIMPLEMENTED ZoomAreaAction.draw')
return
painter.save()
painter.set_source_rgba(.5, .5, 1.0, 0.25)
@@ -1405,8 +1408,6 @@ def set_filter(self, filter):
self.filter = filter
def set_dotcode(self, dotcode, filename='',center=True):
- if isinstance(dotcode, unicode):
- dotcode = dotcode.encode('utf8')
p = subprocess.Popen(
[self.filter, '-Txdot'],
stdin=subprocess.PIPE,
@@ -1417,7 +1418,7 @@ def set_dotcode(self, dotcode, filename='',center=True):
)
xdotcode, error = p.communicate(dotcode)
if p.returncode != 0:
- print "UNABLE TO SHELL TO DOT", error
+ print(f'UNABLE TO SHELL TO DOT, error ; {error}')
# dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
# message_format=error,
# buttons=gtk.BUTTONS_OK)
@@ -1437,7 +1438,7 @@ def set_dotcode(self, dotcode, filename='',center=True):
# Store references to subgraph states
self.subgraph_shapes = self.graph.subgraph_shapes
- except ParseError, ex:
+ except ParseError as ex:
# dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
# message_format=str(ex),
# buttons=gtk.BUTTONS_OK)
@@ -1846,7 +1847,7 @@ def open_file(self, filename=None):
self.set_dotcode(fp.read(), filename)
fp.close()
self.add_recent_file(filename)
- except IOError, ex:
+ except IOError as ex:
pass
def on_open(self):
diff --git a/rosplan_sensing_interface/example.py b/rosplan_sensing_interface/example.py
index ca9c93bb7..0d7143b62 100644
--- a/rosplan_sensing_interface/example.py
+++ b/rosplan_sensing_interface/example.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from geometry_msgs.msg import PoseStamped
from math import sqrt
@@ -59,5 +59,5 @@ def req_docked():
return SetBoolRequest(data=False)
def docked(res, params): # params is a list with all the parameters - fully instantiated for services!
- print params
+ print(params)
return int(res.message.split(' ')[3])%2 == 0
diff --git a/rosplan_sensing_interface/icaps2019_tutorial.py b/rosplan_sensing_interface/icaps2019_tutorial.py
index e9755db4c..90f48b8c1 100644
--- a/rosplan_sensing_interface/icaps2019_tutorial.py
+++ b/rosplan_sensing_interface/icaps2019_tutorial.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from geometry_msgs.msg import PoseStamped
from math import sqrt
diff --git a/rosplan_sensing_interface/scripts/sensing_interface.py b/rosplan_sensing_interface/scripts/sensing_interface.py
index 2b4904108..1ebf7ff40 100755
--- a/rosplan_sensing_interface/scripts/sensing_interface.py
+++ b/rosplan_sensing_interface/scripts/sensing_interface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import rospy
import rospkg
@@ -6,7 +6,8 @@
import threading
import numpy as np
from threading import Lock
-import imp
+import importlib
+from functools import reduce
from rosplan_knowledge_msgs.srv import KnowledgeUpdateServiceArray, KnowledgeUpdateServiceArrayRequest
from rosplan_knowledge_msgs.srv import GetDomainPredicateDetailsService, GetDomainPredicateDetailsServiceRequest
from rosplan_knowledge_msgs.srv import GetDomainAttributeService
@@ -79,7 +80,7 @@ def __init__(self):
# Load scripts
self.scripts = None
if self.functions_path:
- self.scripts = imp.load_source('sensing_scripts', self.functions_path)
+ self.scripts = importlib.machinery.SourceFileLoader('sensing_scripts', self.functions_path).load_module()
# Declare tools in the scripts module:
self.scripts.get_kb_attribute = self.get_kb_attribute
self.scripts.rospy = rospy
@@ -93,7 +94,7 @@ def __init__(self):
######
# Subscribe to all the topics
self.offset = {} # Offset for reading cfg
- for predicate_name, predicate_info in self.cfg_topics.iteritems():
+ for predicate_name, predicate_info in self.cfg_topics.items():
if type(predicate_info) is list: # We have nested elements in the predicate
for i, pi in enumerate(predicate_info):
pi['sub_idx'] = i
@@ -118,7 +119,7 @@ def __init__(self):
self.request_src = []
self.response_process_src = []
self.clients_sub_idx = []
- for predicate_name, predicate_info in self.cfg_service.iteritems():
+ for predicate_name, predicate_info in self.cfg_service.items():
if type(predicate_info) is list:
for i, pi in enumerate(predicate_info):
pi['sub_idx'] = i
@@ -152,7 +153,7 @@ def load_params(self, predicate_name, predicate_info):
kb_params = []
for p in kb_info.typed_parameters:
- instances = self.get_instances_srv.call(GetInstanceServiceRequest(p.value, True)).instances
+ instances = self.get_instances_srv.call(GetInstanceServiceRequest(p.value, True, True)).instances
kb_params.append(instances)
if 'params' in predicate_info:
@@ -457,7 +458,7 @@ def update_kb(self):
sensed_predicates.update(self.sensed_services.copy())
self.srv_mutex.release()
- for predicate, (val, changed, updated) in sensed_predicates.iteritems():
+ for predicate, (val, changed, updated) in sensed_predicates.items():
if updated:
continue
@@ -518,7 +519,7 @@ def kb_update_status(self, msg):
self.srv_mutex.acquire(True)
# Dump cache, it will be reloaded in the next update
- for predicate, (val, changed, updated) in self.sensed_topics.iteritems():
+ for predicate, (val, changed, updated) in self.sensed_topics.items():
self.sensed_topics[predicate] = (val, changed, False)
self.sensed_services.clear()