Code Monkey home page Code Monkey logo

metacontrol_sim's People

Contributors

chcorbato avatar ipa-nhg avatar marioney avatar rezenders avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

metacontrol_sim's Issues

Adapt rosgraph_manipulator to reconfigure using launch files generated by RosModel

This is what we discussed today.
Currently the reconfiguration uses a single launch file and a launch argument to select amongst predefined param configs for move base.
See:

launch_config("metacontrol_nav", "move_base.launch", configuration)

What we need is to launch the launch files autogenerated from the .rossystem files of each configuration.

These files have the name and they are in a package both with the name of the configuration, which can be retrieved from the goal field desired_configuration_name
see: metacontrol_msgs/action/MvpReconfiguration.action

These lines also need to be changed:

# TODO hardcoded configuration names
#
# FD NAME | LAUNCHFILE | ARG "profile"
# -------------------------------------------------------------------
# fd_navigate_safe | move_base.launch | safe
# fd_navigate_standard | move_base.launch | standard
# fd_navigate_fast | move_base.launch | fast
#
def execute_cb(self, goal):
rospy.loginfo ('Rosgraph Manipulator Action Server received goal %s' % str(goal))
self._result.result = 1
if (goal.desired_configuration_name == "fd_navigate_safe"):
self.executeRequest("safe")
elif (goal.desired_configuration_name == "fd_navigate_standard"):
self.executeRequest("standard")
elif (goal.desired_configuration_name == "fd_navigate_fast"):
self.executeRequest("fast")

Create publisher for Safety values

Publish

P = Closest distance to an object in the direction of motion
Pr = Closest distance to an object in the direction of motion - inflation_radius

Information should come from the laser scanner

can't find rosgraph_manipulator_config.yaml

With commit ed75d10 the following error occurs:

RLException: error loading <rosparam> tag: 
	file does not exist [/home/gus/metacontrol_ws/src/metacontrol_sim/yaml/rosgraph_manipulator_config.yaml]
XML is <rosparam ns="rosgraph_manipulator" command="load" file="$(find metacontrol_sim)/yaml/rosgraph_manipulator_config.yaml"/>
The traceback for the exception was written to the log file

This is due metacontrol_sim/yaml/rosgraph_manipulator_config.yaml being removed.

I think the solution is to replace in rosgraph_nodes.launch.xml the line:

<rosparam ns="rosgraph_manipulator" command="load" file="$(find metacontrol_sim)/yaml/rosgraph_manipulator_config.yaml"/>

With:

<rosparam ns="rosgraph_manipulator" command="load" file="$(find mc_rosgraph_manipulator)/config/rosgraph_manipulator_config.yaml">

If this is right I can open a PR

[NiceToHave] Create a simplified version of the simulation

I tested the simulation and it works, great job @marioney ๐ŸŽ‰๐ŸŽ‰
The only problem I have is that the real time rate of gazebo is super slow (obviously the problem is my laptop, I usually use my workstation but these days I don't have access to it). Is it ok for you if I create a simplified version of the simulation? Probably just remove the controllers of the yumi will be ok.


Short test protocol:

Installation: https://github.com/rosin-project/metacontrol_sim/blob/1adaafb28d5a92acca70e175955c35e1204418f3/README.md#setup-using-wstool

Command: roslaunch metacontrol_sim ridgeback_yumi_world.launch gui:=true

Test:
Terminal A:

rostopic pub /ridgeback_velocity_controller/cmd_vel geometry_msgs/Twist "linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 1.0" -r 10

Terminal B:
rostopic echo /ridgeback_velocity_controller/odom

The robot didn't move on gazebo but probably it is related to my computer...

Create basic experimental setup to run and obtain data

Just 2 workstations (goals) - try with the factory map (desired), but if problematic use the map we have.

Should follow the definition in rosin-project/metacontrol_nav#4

Needs:

  • Data logging tool #25
  • Create factory environment
  • Define Goal positions - a set of 3 values
  • Define Initial positions - a set of 3 values
  • Create map - only one is going to be used
  • Define launch configuration: - a set of 3 configurations (Fast / Standard / Safe)
  • Create control script for the experiments: #29

No FD found to solve Objective o_navigateA

This happens in 35cd0dc when using the updated launchfile:

$ roslaunch metacontrol_sim metacontrol_sim_reasoner.launch
[...]
[INFO] [1600862917.455973, 7.662000]: QA value received!        TYPE: safety    VALUE: 0.490094699729

FGs:
fg_f3_v3_r1     objective:  kb.o_navigateA      status:  None   FD:  kb.f3_v3_r1        QAvalues:  [('safety', 0.490094699729), ('energy', 0.415905276934)]

OBJECTIVE       |  STATUS       |  NFRs
[WARN] [1600862917.457630, 7.663000]: QA value received for             TYPE: safety    VALUE: 0.702318014465
o_navigateA     |   INTERNAL_ERROR      |   [('energy', 0.5), ('safety', 0.8)]
[WARN] [1600862917.458305, 7.663000]: Objectives in status ERROR: ['o_navigateA']
[INFO] [1600862917.460224, 7.663000]: QA value received!        TYPE: safety    VALUE: 0.702318014465
[WARN] [1600862917.461828, 7.663000]: QA value received for             TYPE: safety    VALUE: 0.79356236787
[INFO] [1600862917.466717, 7.664000]:   >> Finished MAPE-K ** ANALYSIS **
[INFO] [1600862917.468758, 7.666000]:   >> Started MAPE-K ** PLAN adaptation **
[INFO] [1600862917.470665, 7.666000]: => Reasoner searches FD for objective: o_navigateA
[INFO] [1600862917.471677, 7.666000]: QA value received!        TYPE: safety    VALUE: 0.79356236787
== FunctionDesigns available for obj: %s ['f1_v1_r1', 'f1_v1_r2', 'f1_v1_r3', 'f1_v2_r1', 'f1_v2_r2', 'f1_v2_r3', 'f1_v3_r1', 'f1_v3_r2', 'f1_v3_r3', 'f2_v1_r1', 'f2_v1_r2', 'f2_v1_r3', 'f2_v2_r1', 'f2_v2_r2', 'f2_v2_r3', 'f2_v3_r1', 'f2_v3_r2', 'f2_v3_r3', 'f3_v1_r1', 'f3_v1_r2', 'f3_v1_r3', 'f3_v2_r1', 'f3_v2_r2', 'f3_v2_r3', 'f3_v3_r1', 'f3_v3_r2', 'f3_v3_r3']
Objective NFR ENERGY: %s [kb.nfr_energy, kb.nfr_safety]
== Checking FDs for Objective with NFRs type: %s and value %s  energy 0.5
No FDs meetf NFRs
*** OPERATOR NEEDED, NO SOLUTION FOUND ***
[ERROR] [1600862917.475400, 7.668000]: No FD found to solve Objective o_navigateA
[...]

Maybe it is due to the particular scenario used in this launchfile, can you please check @marioney

Test setup for metacontrol (from #31)

(issue created from #31 (comment))
To test the metacontroller I need to be able to launch the simulation:

  • for only 1 goal
  • selecting start and goal poses
  • Perturbation: I need to add a perturbation, choosing which one. Whatever is easier:
    • Add unknown obstacles
    • Increase energy consumption

README setup instructions are confusing

Because there are two sections: "Setup using wstool" and "Manually setup", I though I could simply follow one of them, so I did with wstool.
But you actually need to do BOTH.

I propose to have a single "Installation and setup section", and introduce both sets of instructions with a sentence in normal text, not as a header.

SafetyObserverCodeGeneration

These are the topics to which the observer needs to subsbscirbe:

topics = [("/odom", Odometry), ("/imu/data", Imu), ("/d_obstacle", Float32)]
The code to the observer is here

Data logging tool (continuation from #25)

Do we need a header timestamp in all our messages for data logging?

  • List all publishers we have created that we need to log (from #25 (comment))
  • Add header in .msg if needed
  • Make sure messages published have a correct timestamp initialized

add kinect model to ridgeback

In order to manage component failure, and reconfiguration, a Kinect model needs to be added to the ridgeback.

@chcorbato should we have a different field of view / range or use the same as the laser?

Since we're using fake_localization it only needs to be configured for navigation

ERROR No p gain specified for pid

When launching the simulation after following all the instructions and fixing the error with the xacro file (see pull request, branch carlos_test), I get the following error,

[ INFO] [1586868553.118651086]: gazebo_ros_control plugin is waiting for model URDF in parameter [robot_description] on the ROS param server.
[ERROR] [1586868553.343810232]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/yumi_joint_1_r
[...]

Create observer for safety

The model of safety is taken from this reference.

Safety observer is defined here.

Run-time safety is calculated as follows:
S= {
1, if P > d_break;
P_r/d_break, otherwise; โ€ฆ. (Eq1)
}
where:

  • P - a distance from a current location of the robot to the closest obstacle in the robot direction.
  • P_r = P - inflation_radius
  • d_break is the breaking distance of the robot before hitting an obstacle;

Furthermore:

  • P is computed from the laser scans;
  • d_break = v^2*r /(2 ร— a_robot) โ€ฆ (Eq2) where:
    * v - the current speed of the robot;
    * a_robot - the acceleration of the robot;
    * r - Radius of the robot ;

Could not start XXXX Oberserver

This happens very frequently, especially with the EnergyObserver.

CONTEXT

 ./run_single_sim.sh -i 2 -g 2 -n standard -r true -p 1.3

OUTPUT

[INFO] [1590215602.961954, 0.000000]: Controller frequency: 1.0
energy
EnergyQualityObserver
[INFO] [1590215603.004127, 0.000000]: Waiting for service...
[INFO] [1590215603.011966, 0.000000]: Waiting for service...
Could not start EnergyQualityObserver
The load observer service call is completed!
safety
SafetyQualityObserver
[INFO] [1590215603.149441, 0.000000]: Waiting for service...
Could not start SafetyQualityObserver
The load observer service call is completed!

GetModelProperties Obstacle Error

When running ./run_single_sim.sh -p 1 -g 2 -n "f1_v1_r1" -o 2 -r "true" -p 1.2 in the experiments repo, the following Error appears. This do not affect the normal execution of the mission.

[ERROR] [1596639458.195704258, 3.140000000]: GetModelProperties: model [unknown_obstacle1] does not exist
[ERROR] [1596639458.380327582, 3.270000000]: GetModelProperties: model [unknown_obstacle2] does not exist

ObstcacleIssue

Sometimes no QA values published in diagnostics and updated in the reasoner

This happens in 35cd0dc when using the updated launchfile:

$ roslaunch metacontrol_sim metacontrol_sim_reasoner.launch
[...]
FGs:
fg_f3_v3_r1     objective:  kb.o_navigateA      status:  None   FD:  kb.f3_v3_r1        QAvalues:  []
[...]

When echoing /diagnostics:

$ rostopic echo /diagnostics 
WARNING: no messages received and simulated time is active.
Is /clock being published?

It seems to be the same issue than in meta-control/mc_mros_reasoner#89

Centralize in KB all info needed by nodes of the metacontrol MAPE-K loop

Currently, there are some ad-hoc code to provide each of the nodes in the metacontrol MAPE-K loop the information about configuration. We need to have a general solution to sync this information, which includes:

  • existing configurations (aka FDs in tomasys, aka rossystem files in ROS model), that is the KB
  • the current objective and associated NFR (obj+NFRs), and
  • the current configuration deployed - see meta-control/mc_mros_reasoner#28

Let's analyze this per metacontrol node in the MAPE-K loop (checkboxes indicate the design stated next to it has been implemented):

Monitor: rosgraph_monitor

ROSGraph monitor

It monitors that the configuration of nodes/components is the desired_configuration

  • use a component model: currently it uses the initial rossystem model at deployment and the current rossystem generated by ros_graph_parser
  • TODO (not for paper): update dynamically at runtime the desired_rossystem with the new configuration deployed by metacontrol

Objectives observers

They detect the status of the running objectives (are they in error because the task management reports so?)

  • TODO: required for many scenarios (move_base cannot plan route in navigation, tag not detected in Cheops)
  • We could monitor action goal feedback, if we associate objective <-> ROS action goal
  • This could be "merged" with QA Observers

QA Observers:

  • TODO (not for paper): They need to know for which objective they are reporting QA values, either by knowing the objective or by knowing the configuration that is achieving those values.
    Currently: only one objective and 1 configuration assumed, mros1_reasoner does the association QAvalue-Objective
  • Deployment time: they are automatically generated using RosModel tooling (see @ipa-nhg please add your pull request on autom creating observer models) and a template.
  • Dynamically at runtime:
    • for a given obj+NFRs they do not need to change.
    • TODO (not for paper): for dynamic objestives+NFRs they need to adapt, e.g. metacontrol could deploy dynamically new

NOTE: observers need to be activated (see code below). This needs to be "automated". mros1_reasoner could do that, contributing to address the deployment and the runtime TODOs

<!-- Node to activate the observer -->
<node name="activate_observer_node" pkg="metacontrol_sim" type="activate_observer.py" output="screen">
</node>

IMPLEMENTATION NODE for Monitoring:
Currently the monitoring interface M-A is via ROS diagnostics messages
This is causing some problems and does not provide good semantics

  • TODO (not paper, but IMP): implement a specific metacontrol monitoring interface in a new ROS message type

Analyse, Plan and KB - mros1_reasoner

Execute - rosgraph_manipulator.py

# TODO hardcoded configuration names
#
# FD NAME | LAUNCHFILE | ARG "profile"
# -------------------------------------------------------------------
# fd_navigate_safe | move_base.launch | safe
# fd_navigate_standard | move_base.launch | standard
# fd_navigate_fast | move_base.launch | fast
#
def execute_cb(self, goal):
rospy.loginfo ('Rosgraph Manipulator Action Server received goal %s' % str(goal))
self._result.result = 1
if (goal.desired_configuration_name == "fd_navigate_safe"):
self.executeRequest("safe")
elif (goal.desired_configuration_name == "fd_navigate_standard"):
self.executeRequest("standard")
elif (goal.desired_configuration_name == "fd_navigate_fast"):
self.executeRequest("fast")
else:
self._result.result = -1
self._as.set_aborted(self._result)
rospy.loginfo ('Unknown configuration request %s' % goal, log_level=rospy.ERROR)
return
self._as.set_succeeded(self._result)
return

  • It requires the Knowledge of configurations to execute the adaptations:
    • For the moment Metacontrol implementation considers configurations/FDs as atomic adaptation elements, so it only needs to know how to start and kill configurations.
      • Currently kill&launch model with launchfiles
        • launchfiles used are autom generated from models
        • rosgraph_manipulator.py uses a YAML file with the configurations name
          • TODO: autom sync configurations with KB, so as not to have that info twice. Options:
            • automatically generate the YAML file
            • use the KB (ontology). Options
              • move Execute to mros1_reasoner to use the KB
              • rosgraph_manipulator.py also accesses the ontology.
                • using Owlready2 requires to move this to metacontrol ws with python3. We could simply load the same owl file. Problem: can be out of sync if we use dyn info at runtime
                • using distributed KB in ROS, e.g. ARMOR
      • TODO: consider more complex reconfigurations models than kill&launch: some nodes need to be put in a safe state before killing, some states could need to be saved, etc

rosgraph_manipulator cannot execute reconfiguration when launched in the same terminal

I have tested d92e96e and mros1_reasoner gets stuch waiting for the result of the reconfiguration action.
I guess something goes wrong with rosgraph_manipulator
I have tested it launching MVP_ commenting the following line:

<include file="$(find metacontrol_sim)/launch/includes/rosgraph_nodes.launch.xml" />

and then launching the metacontrol nodes in rosgraph_nodes.launch.xml in separate terminals and then it works! see #14

Create code for Objective Error observer

Observer for Objective error: needed for scenarios 3 in yellow table

  • Should check if there's an error when the route is not available.
    - Path length 0
  • Check move_base/result topic
  • Should check if the robot is blocked (not moving after X seconds)

Objective should publish: "true" if there's an error
"false" if the system is running OK.

Also create another another observer on the rosgraph_observer to send it to the reasoner

https://docs.google.com/document/d/1BaOxo7_WQ2fUUUWIyw5pE_K_q6sErQJXge5VeFjyhgQ/edit#bookmark=id.4rg7xmp249au

Missing dependency: ridgeback_gazebo

In this package in the MVP branch, the dependency ridgeback_gazebo is missing in package.xml.

This results in a working simulation, except that the robot cannot move

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.