meta-control / mc_mros_reasoner Goto Github PK
View Code? Open in Web Editor NEWlibrary for metacontrol-based self-adaptation using ontological reasoning, with wrappers for robotic systems based on ROS1 and ROS2
License: Apache License 2.0
library for metacontrol-based self-adaptation using ontological reasoning, with wrappers for robotic systems based on ROS1 and ROS2
License: Apache License 2.0
I get the following error:
bad callback: <function callbackDiagnostics at 0x7f392df50e18>
Traceback (most recent call last):
File "/home/nhg/rosin-paper/rospy3_melodic/src/ros_comm/rospy/src/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/home/nhg/rosin-paper/mros1_reasoner_ws/src/mros1_reasoner/mros1_reasoner/scripts/mros1_reasoner.py", line 220, in callbackDiagnostics
updateQA(diagnostic_status)
File "/home/nhg/rosin-paper/mros1_reasoner_ws/src/mros1_reasoner/mros1_reasoner/scripts/mros1_reasoner.py", line 238, in updateQA
fg = onto.search_one(solvesO=onto.search_one(iri="*" + "o_navigateA")) #TODO read objective from diagnostic_status
File "/home/nhg/rosin-paper/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/namespace.py", line 380, in search_one
def search_one(self, **kargs): return self.search(**kargs).first()
File "/home/nhg/rosin-paper/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/util.py", line 62, in first
if len(self) != 0: return self[0]
File "/home/nhg/rosin-paper/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/triplelite.py", line 1470, in __len__
sql, params = self.sql_request()
File "/home/nhg/rosin-paper/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/triplelite.py", line 1451, in sql_request
transits, sql, params = self.sql_components()
File "/home/nhg/rosin-paper/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/triplelite.py", line 1722, in sql_components
sql = "SELECT DISTINCT q%s.s FROM %s WHERE %s" % (self.target, ", " .join(tables), " AND ".join(conditions))
AttributeError: target
I am pretty sure I have to load somewhere a model (owl?) that set the target/objective, or maybe set the information manually but I don't know where
I followed: https://github.com/rosin-project/mros1_reasoner/tree/mvp
plus:
pip3 install catkin_pkg
pip3 install pyyaml
I followed: https://github.com/rosin-project/metacontrol_sim/tree/MVP_world
roslaunch metacontrol_sim MVP_metacontrol_world.launch
roslaunch mros1_reasoner run.launch
rosservice call /load_observer EnergyQualityObserver
rosservice call /load_observer SafetyQualityObserver
The error come periodically and just after call the observers services.
Packages in their most recent branches for MODELS paper: mvp
, master
or observers
Experiment command:
./run_single_sim.sh -i 2 -g 2 -n standard -r true -p 1.3
...
OBJECTIVE | STATUS | NFRs
o_navigateA | INTERNAL_ERROR | [('energy', 0.15), ('safety', 0.8)]
...
== Checking FDs for Objective with NFRs type: energy and value: 0.15
WARNING FD has no expected value for this QA
WARNING FD has no expected value for this QA
#### WARNING: no FDs meetf NFRs
== FunctionDesigns also meeting NFRs: []
*** OPERATOR NEEDED, NO SOLUTION FOUND ***
*** Objective o_navigateA cannot be realised ***
run_single_sim.sh -i 1 -g 1 -n f1_v3_r1 -r true
ERROR] [1590236368.127794]: = RECONFIGURATION SUCCEEDED =
[INFO] [1590236368.131871]: Exited timer_cb for metacontrol reasoning
[INFO] [1590236368.141647]: Entered timer_cb for metacontrol reasoning
[INFO] [1590236368.146012]: >> Started MAPE-K ** Analysis (ontological reasoning) **
* Owlready2 * Running Pellet...
...
[INFO] [1590236368.368852]: received QA observation
ERROR: FG not found
[INFO] [1590236368.377154]: received QA observation
ERROR: FG not found
[INFO] [1590236369.053949]: received QA observation
ERROR: FG not found
[INFO] [1590236369.060824]: received QA observation
ERROR: FG not found
[INFO] [1590236369.070854]: received QA observation
ERROR: FG not found
[INFO] [1590236369.596342]: received QA observation
ERROR: FG not found
[INFO] [1590236370.137616]: received QA observation
ERROR: FG not found
[INFO] [1590236370.143824]: received QA observation
ERROR: FG not found
[INFO] [1590236370.747393]: received QA observation
ERROR: FG not found
[INFO] [1590236371.426202]: received QA observation
ERROR: FG not found
[INFO] [1590236371.437687]: received QA observation
ERROR: FG not found <--------------------------------------------------------------------------
[ERROR] [1590236371.854689]: Reasoning error: <--------------------------------------
[INFO] [1590236371.868696]: >> Finished ontological reasoning)
Separate QA definition from the metacontroller, make QA application specific:
the developer should define the QAs needed for the application: energy
, safety
or qa_x
For this, we need to create the generic QA
class in tomasys
so that we can have individuals in the application model for the application specific QAs
After following the steps on README.md there are some dependencies repositories that need to be added to the reasoner_ws, they are on the package.xml but there's no indication on where to find them
These are the repositories needed and their locations
cheops_system_state_msgs
https://github.com/rosin-project/cheops/tree/master/cheops_system_state_msgs
cheops_graph_manipulation_msgs
https://github.com/rosin-project/cheops/tree/master/cheops_graph_manipulation_msgs
mc_mdl_tomasys
https://github.com/rosin-project/mc_mdl_tomasys
mc_mdl_abb
https://github.com/rosin-project/mc_mdl_abb
Otherwise in the next metacontrol cycle reconfiguration will be done again (but maybe different since the configuration that failed to solve the objective (fg.typeFD) would be a different one)
I tried to emulate Gij's instructions for Kinetic with Python3 support, to setup a ROS Melodic installation with Python3 support for the metacontrol reasoner, see branch melodic
I think I managed to properly setup my Python3 virtual environment, build ROS Melodic bare-bones in a workspace, and then overlay my workspace for mros1_reasoner.
However, when trying to launch the reasoner I get:
(venv3.6_ros) chcorbato@tud0038655:~/abb_metacontrol_ws$ roslaunch mros1_reasoner run.launch
Traceback (most recent call last):
File "/home/chcorbato/rospy3_melodic/devel/bin/roslaunch", line 15, in <module>
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/chcorbato/rospy3_melodic/src/ros_comm/roslaunch/scripts/roslaunch", line 34, in <module>
import roslaunch
ModuleNotFoundError: No module named 'roslaunch'
I have tried to create a mock diagnostics using rostopic pub ni the mros1_reasoner launch file, but I get the following error:
Traceback (most recent call last):
File "/home/chcorbato/rospy3_melodic/src/ros_comm/rostopic/scripts/rostopic", line 35, in <module>
rostopic.rostopicmain()
File "<string>", line 2118, in rostopicmain
File "/home/chcorbato/rospy3_melodic/devel/lib/python3/dist-packages/rosbag/__init__.py", line 34, in <module>
exec(__fh.read())
File "<string>", line 33, in <module>
File "/home/chcorbato/rospy3_melodic/src/ros_comm/rosbag/src/rosbag/bag.py", line 53, in <module>
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'
This is the code that causes it when added in the launchfile:
<node name="fake_m_diagnostics" pkg="rostopic" type="rostopic" args="pub /metacontrol_diagnostics DiagnosticArray.msg
'{[status: {level: 1, name: '', message: '', values: []}]
}' -r 2"/>
For the moment, I will use a launch file in the abb_cheops_ws
for this implementation of mock_metacontrol_diagnostic
with rostopic
Test performed:
Terminal 1:
OUTPUT
Actually it's switching to f1_v3_r1
which is strange because that one doesn't meet the safety requirements
Originally posted by @marioney in #53 (comment)
The desired behavior is that only one value for each QA type
is stored in the KB, and that value is continuously updated1
Example of desired printouts:
FG Statuses:
fg_standard None [('obs_mvp.safety', 1.0), ('obs_mvp.energy', 0.685)
But we are getting this:
FG Statuses:
fg_standard None [('obs_mvp.safety_18', 1.0), ('obs_mvp.safety_36', 1.0), ('obs_mvp.safety_54', 1.0), ('obs_mvp.safety_70', 1.0), ('obs_mvp.safety_88', 1.0), ('obs_mvp.safety_106', 1.0), ('obs_mvp.energy_133', 6.20881714097e-10), ('obs_mvp.safety_124', 1.0)]
and apparently in some runs no energy value is associated to the FG (to be confirmed)
[1] Note: this is not how ontologies are supposed to work, so this requires further analysis from an ontological perspective
Ontology file should be given as arg to the run.launch
file
e.g.
roslaunch mros1_reasoner run.launch onto:=mvp.owl
In the MAPE-K PLAN step, the metacontroller should select, amongst the FDs that fullfi the energy and safety NFRs, the one with better performance.
That is, Utility function for the metacontrol (the one used for selection) could be:
U = QAperformance_expected
we could also consider to include QAenergy_expected and QAsafety_expected
/diagnostics
(probably not the best idea I ever had). This input is mainly messages about QA values for energy and safety/ekf_localization
is also publishing in /diagnostics
mros1_reasoner
process these messages to update the KB (runtime ontology in memory)Sometimes no QA values at all are received by mros1_reasoner
See TEST 1 below
This is tricky because it only happens sometimes, especially for energy
(maybe because they are published less frequently)
See TEST 2
I have checked that sometimes energy and safety messages are published see TEST 3
Maybe this is related to the messages published in topic /diagnostics
Could it be that the diagnostic messages from /ekf_localization
are "jamming" the topic?
@marioney @gavanderhoorn advice from ROS experts is needed here.
/diagnostics
at all? At least not received by mros1_reasoner
Terminal 1: simulation + navigation + rosgraph_monitor
+ rosgraph_manipulator
roslaunch metacontrol_sim MVP_metacontrol_world.launch
OUTPUT analysis: All seems to work as expected
Terminal 2: rostopic echo /diagnostics
header:
seq: 20
stamp:
secs: 19
nsecs: 60000000
frame_id: ''
status:
-
level: 0
name: "ekf_localization: Filter diagnostic updater"
message: "The robot_localization state estimation node appears to be functioning properly."
hardware_id: "none"
values: []
-
level: 0
name: "ekf_localization: odometry/filtered topic status"
message: ''
hardware_id: "none"
values:
-
key: "Events in window"
value: "502"
-
key: "Events since startup"
value: "952"
-
key: "Duration of window (s)"
value: "10.040000"
-
key: "Actual frequency (Hz)"
value: "50.000000"
-
key: "Minimum acceptable frequency (Hz)"
value: "43.200000"
-
key: "Maximum acceptable frequency (Hz)"
value: "57.200000"
... __AND ONLY MESSAGES LIKE THE ONE ABOVE__
OUTPUT analysis: All seems to work as expected
Terminal 3: mros1_reasoner
roslaunch mros1_reasoner run.launch onto:=mvp.owl
...
RELEVANT OUTPUT
----------------------------
FG Statuses:
fg_standard None []
OUTPUT analysis: The callback for message reception does not seem to be triggered, since there is no output like this:
[INFO] [1590055021.497386, 38.601000]: received QA observation
safety
are receivedTerminal 1: simulation + navigation + rosgraph_monitor
+ rosgraph_manipulator
roslaunch metacontrol_sim MVP_metacontrol_world.launch
OUTPUT analysis: All seems to work as expected
Terminal 2: rostopic echo /diagnostics
Unfortunately not recorded, trying to reproduce
Terminal 3: mros1_reasoner
roslaunch mros1_reasoner run.launch onto:=mvp.owl
...
RELEVANT OUTPUT
----------------------------
[INFO] [1590055014.832565, 36.205000]: received QA observation
received QA about: mvp.fg_standard TYPE: safety
__5-6 LIKE THE ONE ABOVE on each reasoning period__
...
FG Statuses:
fg_standard None [('obs_mvp.safety_10', 1.0), ('obs_mvp.safety_14', 1.0), ('obs_mvp.safety_24', 1.0), ('obs_mvp.safety_33', 1.0), ('obs_mvp.safety_41', 1.0), ('obs_mvp.safety_52', 1.0), ('obs_mvp.safety_61', 1.0)]
OUTPUT analysis: The callback for message reception is triggered by the received messages with QA safety values
Terminal 1: simulation + navigation + rosgraph_monitor
+ rosgraph_manipulator
roslaunch metacontrol_sim MVP_metacontrol_world.launch
OUTPUT analysis: All seems to work as expected
Terminal 2: rostopic echo /diagnostics
...
---
header:
seq: 4
stamp:
secs: 3
nsecs: 0
frame_id: ''
status:
-
level: 0
name: "ekf_localization: Filter diagnostic updater"
message: "The robot_localization state estimation node appears to be functioning properly."
hardware_id: "none"
values: []
-
level: 0
name: "ekf_localization: odometry/filtered topic status"
message: ''
hardware_id: "none"
values:
-
key: "Events in window"
value: "147"
-
key: "Events since startup"
value: "147"
-
key: "Duration of window (s)"
value: "3.000000"
-
key: "Actual frequency (Hz)"
value: "49.000000"
-
key: "Minimum acceptable frequency (Hz)"
value: "43.200000"
-
key: "Maximum acceptable frequency (Hz)"
value: "57.200000"
---
header:
seq: 16
stamp:
secs: 2
nsecs: 802000000
frame_id: ''
status:
-
level: 0
name: ''
message: "QA status"
hardware_id: ''
values:
-
key: "safety"
value: "1.0"
---
header:
seq: 17
stamp:
secs: 2
nsecs: 4000000
frame_id: ''
status:
-
level: 0
name: ''
message: "QA status"
hardware_id: ''
values:
-
key: "energy"
value: "0.233684937159"
...
I will come back to check in detail, but this is happening to me all the time when I run:
./run_single_sim.sh -i 2 -g 2 -n standard -r true -p 1.3
[INFO] [1590164922.395471, 0.000000]: Controller frequency: 1.0
[INFO] [1590164922.457184, 0.000000]: Waiting for service...
energy
EnergyQualityObserver
[INFO] [1590164922.602716, 0.000000]: Waiting for service...
Could not start EnergyQualityObserver
Can be based on:
the one from Rainbow
Carlos' previous metacontroller
Implementation in rosin-project/metacontrol_sim#7
The rule in tomasys.owl
is:
if fg.qa.value
< obj.nfr.value
then obj
in INTERNAL_ERROR
nfr.value
= 1.5 https://github.com/rosin-project/mros1_reasoner/blob/382f4a0fae4233aaf79ff3a876cd8cc508d58bbe/mros1_reasoner/scripts/init_models.py#L49
updated QA energy values for fg (* for those above nfr value):
FG Statuses:
fg_nav_fast None [('obs_energy_1', '0.20000000298'), ('obs_energy_2', '**1.89199912548**'), ('obs_energy_3', '1.41609191895'), ('obs_energy_4', '1.42725098133'), ('obs_energy_5', '1.43280863762'), ('obs_energy_6', '1.43841362'), ('obs_energy_7', '1.45673406124'), ('obs_energy_8', '1.45814871788'), ('obs_energy_9', '1.45667350292'), ('obs_energy_10', '1.45740365982'), ('obs_energy_11', '1.45468640327'), ('obs_energy_12', '1.45513892174'), ('obs_energy_13', '1.45447206497'), ('obs_energy_14', '1.45391464233'), ('obs_energy_15', '1.45491302013'), ('obs_energy_16', '1.4551589489'), ('obs_energy_17', '1.45762276649'), ('obs_energy_18', '1.45493543148'), ('obs_energy_19', '1.45621967316'), ('obs_energy_20', '1.45462548733'), ('obs_energy_21', '1.45513737202'), ('obs_energy_22', '1.45356249809'), ('obs_energy_23', '1.4541246891'), ('obs_energy_24', '1.45473957062'), ('obs_energy_25', '1.45236492157'), ('obs_energy_26', '**1.68376469612**'), ('obs_energy_27', '**1.68711805344**')]
Potential causes of the undesired behavior:
tomasys
0 - worst case value
1 - desired value
We need to be able to deploy the mros1_reasoner in any machine.
As info, this is the excerpt of what @gavanderhoorn did in my machine to get it running
940 mkdir $HOME/ros_kinetic_py3
941 cd /home/chcorbato/ros_kinetic_py3/
942 apt install python3-venv libpython3-dev python-catkin-tools
943 sudo apt install python3-venv libpython3-dev python-catkin-tools
944 sudo apt clean
945 sudo apt update
946 sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
947 sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
948 sudo apt clean && sudo apt update
949 python3.5 -m venv venv3.5_ros
950 source venv3.5_ros/bin/activate
951 pip3 install wheel
952 pip3 install -U rosdep rosinstall_generator wstool rosinstall
953 rosinstall_generator --deps --tar --rosdistro=kinetic ros_base >
954 rosinstall_generator --deps --tar --rosdistro=kinetic ros_base > ros_base.rosinstall
955 wstool init src -j8 ros_base.rosinstall
956 catkin build -DCATKIN_ENABLE_TESTING=0 -DCMAKE_BUILD_TYPE=Release -DPYTHON_VERSION=3.5
957 cd
958 cat .bashrc
959 vim .bashrc
960 nano .bashrc
961 source .bash
962 ls -al
963 cd ..
964 cd ros_kinetic_py3/
965 cd mros_ws/src/
966 git clone [email protected]:rosin-project/cheops.git
967 cd mros_ws/src/mros1_reasoner/mros1_reasoner/scripts/
968 python owl_reasoner.py
969 mmons-lang3-3.3.2.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/xml-apis-1.4.01.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/sesame-rio-datatypes-2.7.16.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/commons-csv-1.0.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/guice-multibindings-4.0.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/pellet-query-2.4.0-SNAPSHOT.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/pellet-jena-2.4.0-SNAPSHOT.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/pellet-cli-2.4.0-SNAPSHOT.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/commons-codec-1.6.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/pellet-explanation-2.4.0-SNAPSHOT.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/xz-1.5.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/sesame-rio-ntriples-2.7.16.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/stringtemplate-3.2.1.jar:/home/chcorbato/.local/share/virtualenvs/owlready2/lib/python3.5/site-packages/owlready2/pellet/jena-core-2.13.0.jar pellet.Pellet realize --infer-prop-values --infer-data-prop-values --ignore-imports /tmp/tmpuf3wjjzc
970 Traceback (most recent call last):
971 python owl_reasoner.py
972 Bindings Statuses:
973 python owl_reasoner.py
974 git merge owlready2
975 git push
976 python mros1_reasoner.py
977 python owl_reasoner.py
978 git fetch
979 git checkout master
980 git pull master
981 git pull
982 git checkout reasoner_integration
983 git rebase master
984 git rebase --continue
985 python mros1_reasoner.py
986 cd ros_kinetic_py3/
987 ls -al
988 catkin clean -y
989 clear
990 ls -al
991 clear
992 source venv3.5_ros/bin/activate
993 env | less
994 env | grep -i ros less
995 env | grep -i ros | less
996 catkin build -DCATKIN_ENABLE_TESTING=0 -DCMAKE_BUILD_TYPE=Release -DPYTHON_VERSION=3.5
997 pip3 install empy
998 catkin build -DCATKIN_ENABLE_TESTING=0 -DCMAKE_BUILD_TYPE=Release -DPYTHON_VERSION=3.5
999 source devel/setup.bash
1000 python
1001 roscore
1002 pip3 install defusedxml netifaces
1003 roscore
1004 pip3 install owlready2
1005 cd ..
1006 mkdir -p ros_py3_ws/src
1007 rm -rf ros_py3_ws/
1008 ls -al
1009 cd mros_ws/
1010 ls -al
1011 catkin clean
1012 catkin clean -y
1013 ls -al
1014 catkin config
1015 catkin config --extend $HOME/ros_kinetic_py3
1016 catkin config --extend $HOME/ros_kinetic_py3/devel
1017 clear
1018 catkin config
1019 ls -al
1020 catkin ls
1021 ls -al
1022 ls -al src/
1023 touch src/rosin_diagnosis_experiments/CATKIN_IGNORE
1024 catkin ls
1025 catkin
1026 catkin b
1027 catkin clean -y
1028 catkin config --help
1029 catkin config --no-extend
1030 clear
1031 ls -al
1032 clear
1033 ls -al
1034 cd ..
1035 mkdir -p abb_mros/src
1036 cd abb_mros/
1037 catkin init
1038 catkin config --extend $HOME/ros_kinetic_py3/devel
1039 catkin b
1040 mc
1041 catkin b
1042 cd src/
1043 ls -al
1044 cd mros1_reasoner/
1045 ls -al
1046 git status
1047 gitk --all
1048 ls -al
1049 cd mros1_reasoner/
1050 ls -al
1051 nano -w Cm
1052 nano -w CMakeLists.txt
1053 nano -w package.xml
1054 cler
1055 clear
1056 ls -al
1057 cd ..
1058 ls -al
1059 cd ..
1060 cd cheops/
1061 ls -al
1062 git status
1063 git branch -av
1064 gitk --all
1065 git branch -av
1066 git checkout graph_manipulation
1067 gitk --all
1068 git checkout master
1069 git ft
1070 git fetch
1071 git status
1072 git checkout graph_manipulation
1073 git reset --hard origin/graph_manipulation
1074 clear
1075 gitk
1076 cd ..
1077 ls -al
1078 clear
1079 catkin clean -y
1080 catkin b
1081 source devel/setup.bash
1082 python
1083 clear
1084 cd
1085 source venv3.5_ros/bin/activate
1086 ls
1087 cd ros_kinetic_py3/
1088 ls
1089 source venv3.5_ros/bin/activate
1090 cd ../abb_mros/
1091 source devel/setup.bash
1092 roslaunch mros1_reasoner run.launch
1093 cd src/mros1_reasoner/
1094 python owl_reasoner.py
1095 cd mros1_reasoner/scripts/
1096 python owl_reasoner.py
1097 roslaunch mros1_reasoner run.launch
1098 python owl_reasoner.py
1099 roslaunch mros1_reasoner run.launch
1100 ifconfig
1101 source /opt/ros/kinetic/setup.bash
1102 rosrun rqt_graph rqt_graph
1103 env | grep -i ros | sort
1104 rosnode list
1105 roswtf
1106 clear
1107 env | grep -i ros | sort
1108 export ROS_MASTER_URI=http://192.168.131.1:11311
Mixing Python and OWLin owlready2:
move_base
to the low_power
configmove_base
params max_vel
and max_accel
Seems that reconfiguration is launched only once per experiment.
For instnce, I'm running
./run_single_sim.sh -i 1 -g 1 -n f3_v3_r3 -r true -p 2.0 -e 0.8 -s 0.4
There's a reconfiguration due to safety at the beginning, but even if the nfr_energy
is not meet at the end of the experiment, there's no reconfiguration launched
@chcorbato is this expected?
transfer ownership of the repository so it is maintained later in the CoR github organization
@marioney , can you check this:
I am getting the following error:
/home/darko/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/wstool/config_yaml.py:74: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yamldata = yaml.load(stream)
ERROR in config: Invalid multiproject yaml format in [https://github.com/rosin-project/mros1_reasoner/blob/mvp/mros1_reasoner/mros1_reasoner.rosinstall]: mapping values are not allowed here
in "<file>", line 115, column 73
Furthermore, the link to rosinstall is also wrong in this command:
wstool init src https://raw.githubusercontent.com/rosin-project/mros1_reasoner/mvp/mros1_reasoner.rosinstall
The Pellet reasoner called with owlready2 produces and output that is annoying when debugging (see below)
I could not figure out how to remove it from the output. Owlready2 documents do not explain how to handle that
I tried this to temporarily remove it form the stdout
, but it did not work.
Any ideas are welcome @gavanderhoorn @ipa-hsd @ipa-nhg @marioney
* Owlready2 * Running Pellet...
java -Xmx2000M -cp /home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jena-arq-2.10.0.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/antlr-3.2.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jena-iri-0.9.5.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/pellet-2.3.1.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/httpclient-4.2.3.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/antlr-runtime-3.2.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/owlapi-distribution-3.4.3-bin.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jgrapht-jdk1.5.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/xercesImpl-2.10.0.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/slf4j-log4j12-1.6.4.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/xml-apis-1.4.01.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jcl-over-slf4j-1.6.4.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/slf4j-api-1.6.4.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jena-tdb-0.10.0.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/jena-core-2.10.0.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/commons-codec-1.6.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/aterm-java-1.6.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/httpcore-4.2.2.jar:/home/chcorbato/rospy3_melodic/venv3.6_ros/lib/python3.6/site-packages/owlready2/pellet/log4j-1.2.16.jar pellet.Pellet realize --loader Jena --input-format N-Triples --infer-prop-values --infer-data-prop-values --ignore-imports /tmp/tmp6__87twd
* Owlready2 * Pellet took 1.3000226020812988 seconds
* Owlready * (NB: only changes on entities loaded in Python are shown, other changes are done but not listed)
This is error is usually related to to fd.fd_qa_tradeoff=[]
because no value has been assigned by any SWRL rule, for example when the only QA we are considering is energy
This seems related to missing dependencies related to owl reasoning #14
Maybe just install Protege is a workaround.
mros1_reasoner
in 353c3be
Command executed:
./run_single_sim.sh -i 2 -g 2 -n standard -r true -p 1.3
INFO] [1590138841.922033]: >> Finished MAPE-K ** EXECUTION **
== RECONFIGURATION UNKNOWN ==
We are calling the reasoner synchronously because of this strong limitation.
The time can be checked observing the rosout.info
by the mros1_reasoner
node:
In this run with NO ADAPTATION needed it takes over 1 sec
[INFO] [1590080065.797720]: Entered timer_cb for metacontrol reasoning
[INFO] [1590080065.799938]: >> Started MAPE-K ** Analysis (ontological reasoning) **
...
[INFO] [1590080066.991114]: >> Finished ontological reasoning)
...
[INFO] [1590080066.995500]: >> Finished MAPE-K ** ANALYSIS **
[INFO] [1590080066.997103]: >> Started MAPE-K ** PLAN adaptation **
-- NO ADAPTATION NEEDED --
[INFO] [1590080066.998722]: Exited timer_cb for metacontrol reasoning
With ADAPTATION needed but crashed (edit issue to add the trace of a successful adaptation):
[INFO] [1590080067.798098]: Entered timer_cb for metacontrol reasoning
[INFO] [1590080067.803917]: >> Started MAPE-K ** Analysis (ontological reasoning) **
...
[INFO] [1590080068.819368]: >> Finished ontological reasoning)
...
[INFO] [1590080068.822836]: >> Finished MAPE-K ** ANALYSIS **
[INFO] [1590080068.824089]: >> Started MAPE-K ** PLAN adaptation **
...
[INFO] [1590080068.825849]: >> Finished MAPE-K ** Plan adaptation **
[INFO] [1590080068.827475]: >> Started MAPE-K ** EXECUTION **
[WARN] [1590080068.829207]: New Configuration requested: fd_navigate_safe
^C[reasoner-2] killing on exit
It seems to be an error in printing the log
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/mario/ros/rospy3_melodic/src/ros_comm/rospy/src/rospy/timer.py", line 234, in run
self._callback(TimerEvent(last_expected, last_real, current_expected, current_real, last_duration))
File "/home/mario/ros/reasoner_metacontrol_ws/src/mros1_reasoner/mros1_reasoner/scripts/mros1_reasoner.py", line 264, in timer_cb
fd = selectFD(objectives_internal_error[0])
File "/home/mario/ros/reasoner_metacontrol_ws/src/mros1_reasoner/mros1_reasoner/scripts/mros1_reasoner.py", line 126, in selectFD
fd = obtainBestFunctionDesign(o)
File "/home/mario/ros/reasoner_metacontrol_ws/src/mros1_reasoner/mros1_reasoner/scripts/mros1_reasoner.py", line 60, in obtainBestFunctionDesign
rospy.loginfo("== FunctionDesigns available for obj: ", [fd.name for fd in fds])
File "/home/mario/ros/rospy3_melodic/src/ros_comm/rospy/src/rospy/core.py", line 190, in loginfo
_base_logger(msg, args, kwargs, level='info')
File "/home/mario/ros/rospy3_melodic/src/ros_comm/rospy/src/rospy/core.py", line 183, in _base_logger
logfunc(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1308, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/mario/ros/rospy3_melodic/src/ros_comm/rosgraph/src/rosgraph/roslogging.py", line 245, in emit
record_message = _defaultFormatter.format(record)
File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
record.message = record.getMessage()
File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
After this the reasoner basically stops working
param names:
\nfr_energy
\nfr_safety
(required for the implementation to solve #4 )
Example rule S1a:
fg_status(?fg, "INTERNAL_ERROR"^^xsd:string), FunctionGrounding(?fg), solvesO(?fg, ?o), Objective(?o) -> o_status(?o, "INTERNAL_ERROR"^^xsd:string)
However, the rules with a logical value for the atom seem to be working.
e.g. rule S3:
Binding(?b) ^ hasBindings(?fg, ?b) ^ b_status(?b, false) -> fg_status(?fg, "INTERNAL_ERROR")
TEST:
=====
- branch: navigation
- mc_mdl_tomasys - branch: master
- mc_mdl_abb - branch: navigation
ontology file: abb_dualarm_mm_complete.owl
Commands:
---------
roslaunch mros1_reasoner run.launch
roslaunch cheops_mock_diagnostics mock_metacontrol_monitoring_input.launch
rosservice call /mock_camera/is_in_error "data: true"
EXPECTED RESULT:
=================
FG Statuses:
fg_build_2arms None
fg_locate_tag None
fg_detect_tag INTERNAL_ERROR
Objectives Statuses:
o_build_pyramid EXTERNAL_ERROR
o_tag_localization EXTERNAL_ERROR
o_detect_tag INTERNAL_ERROR
RESULT:
=======
FG Statuses:
fg_build_2arms None
fg_locate_tag None
fg_detect_tag INTERNAL_ERROR
Objectives Statuses:
o_build_pyramid None
o_tag_localization None
o_detect_tag None
The readme currently states:
Since
mros1_reasoner
depends oncheops_system_state_msgs
, you will need workspace overlaying to runmros1_reasoner
. You can do the following:source abb_cheops_ws/cheops/devel/setup.bash cd abb_metacontrol_ws catkin b
this is not a good idea, as this would overlay a Python 2 workspace on top of a Python 3 workspace.
Suggestion: copy the cheops_system_state_msgs
package (and just that package) into the Python 3 workspace (ie: abb_metacontrol_ws
), so it now exists in both the Python 2 as well as the Python 3 workspaces.
That is completely fine and supported.
In essence the Python 2 and Python 3 workspaces are completely separate ROS installations. They may even be run on different machines (but they just happen to run on the same machine).
What about the navigation goal?
It is hold by the action server, which originally is the move_base, but we kill it
SOLUTION: intermediary action server in the metacontrol that is the action server that the user/app_logic sees, and to which is sends the nav_goal
The the metacontroller manages that this goal is a metacontrol objective and is responsible to send it again to new configurations
This is related to the current architecture of the mros_reasoner
(see discussions 1 and 2), that is:
I propose to keep the highest value received on each timer_cb
cycle for reasoning
@marioney @gavanderhoorn what do you think? We need a quick fix now for these experiments to provide useful results for the paper, but also a proper solution maybe later, rethinking the execution model of the metacontroller.
(in 0885143)
This requires a proper fix in mros1_reasoner.py
and maybe rosgraph_manipulator.py
[INFO] [1588331252.970999]: Rosgraph Manipulator Action Server received goal desired_configuration_name: "fg_fd_navigate_safe"
[INFO] [1588331252.974950]: Unknown configuration request desired_configuration_name: "fg_fd_navigate_safe"
Something did not go well, probably inconsistency in the ontology.
When this error is triggered I'm saving the ontology in ~/.ros/error.owl
, so I will inspect it with Protege to check what happened.
run_single_sim.sh -i 1 -g 1 -n f1_v3_r1 -r true
...
[ERROR] [1590235376.721149]: Reasoning error:
...
FG Statuses:
fg_nav_fast None [('obs_energy_1', '0.20000000298'), ('obs_energy_2', '1.89199912548'), ('obs_energy_3', '1.41609191895'), ('obs_energy_4', '1.42725098133'), ('obs_energy_5', '1.43280863762'), ('obs_energy_6', '1.43841362'), ('obs_energy_7', '1.45673406124'), ('obs_energy_8', '1.45814871788'), ('obs_energy_9', '1.45667350292'), ('obs_energy_10', '1.45740365982'), ('obs_energy_11', '1.45468640327'), ('obs_energy_12', '1.45513892174'), ('obs_energy_13', '1.45447206497'), ('obs_energy_14', '1.45391464233'), ('obs_energy_15', '1.45491302013'), ('obs_energy_16', '1.4551589489'), ('obs_energy_17', '1.45762276649'), ('obs_energy_18', '1.45493543148'), ('obs_energy_19', '1.45621967316'), ('obs_energy_20', '1.45462548733'), ('obs_energy_21', '1.45513737202'), ('obs_energy_22', '1.45356249809'), ('obs_energy_23', '1.4541246891'), ('obs_energy_24', '1.45473957062'), ('obs_energy_25', '1.45236492157'), ('obs_energy_26', '1.68376469612'), ('obs_energy_27', '1.68711805344')]
Also:
From @gavanderhoorn (thanks!) in #6
I would perhaps just try to use rospypi/simple.
Create a
venv
, just as you've done earlier, run the two install commands shown in the readme -- make sure to install additional packages if/when needed.Now install whatever else you need for the reasoner.
roslaunch
is probably not needed. The.launch
file on starts a single node, which you could start as a regular program inside a terminal with thevenv
active.
This is an interesting idea to simplify the release and deployment of mros_reasoner
Using the RosModel model files of the system as input, a python script could automatically generate the .owl file for the metacontrol.
Such script requires similar resources to the mros1_reasoner.py
(the metacontrol), that is why I placed a skeleton for such a script in this repository:
https://github.com/rosin-project/mros1_reasoner/blob/rosmodel2owl/mros1_reasoner/scripts/rosmodel2owl.py
The skeleton contains comments on how to create the owl elements from the RosModel
@ipa-hsd can you help me create this script today? I saw your code to parse RosModel and looks great, but it is beyond my current skills.
@ipa-nhg can help clarify.
Officially I have meetings till 16.00, but hopefully I'll be available again earlier, for 14.00
Create a singularity image with ROS Melodic version with Python3 to avoid creating a virtual environment.
The metacontrol MAPE-K elements need to sync on what is the desired configuration at each time:
ros_graph_parser
(and rosgraph_monitor
? ) use it to know what .rossystem to compare with the one extracted from the rosgraph => not needed now, see belowmros1_reasoner
needs to initialize what is the initial configuration, so it can assign the current QA values and configuration diagnostics from monitoring to it desired_configuration
rosgraph_manipulator.py
receives it to select which configuration to deployMvpReconfiguration
action goal received from mros1_reasoner
I propose to use a ROS global parameter to sync this value and also to initialize it.
What do you think @ipa-nhg @ipa-hsd @marioney
Testing with ddbb21d
== Checking FDs for Objective with NFRs type: energy and value: 0.15
WARNING FD has no expected value for this QA
The QAs values are received asynchronously:
https://github.com/rosin-project/mros1_reasoner/blob/0a8022676b597f59fb8b6880f3d05955628f8643/mros1_reasoner/scripts/mros1_reasoner.py#L128
but the reasoner to decide if an adaptation is needed is executed sync
https://github.com/rosin-project/mros1_reasoner/blob/0a8022676b597f59fb8b6880f3d05955628f8643/mros1_reasoner/scripts/mros1_reasoner.py#L193
As a result, I think that we are not considering some QA values for reconfiguration.
We need to confirm if this is a problem and then decide what to do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.