GithubHelp home page GithubHelp logo

dlr-rm / rafcon Goto Github PK

View Code? Open in Web Editor NEW
180.0 180.0 34.0 111.48 MB

RAFCON (RMC advanced flow control) uses hierarchical state machines, featuring concurrent state execution, to represent robot programs. It ships with a graphical user interface supporting the creation of state machines and contains IDE like debugging mechanisms. Alternatively, state machines can programmatically be generated using RAFCON's API.

Home Page: https://dlr-rm.github.io/RAFCON/

License: Eclipse Public License 1.0

Python 96.09% Shell 0.07% SCSS 3.82% Makefile 0.03%
graphical-programming robotics state-machine

rafcon's People

Contributors

abnsy avatar csuerig avatar e4e avatar elio-nakhle avatar flolay avatar franzlst avatar j2m2 avatar johannesernst avatar kant avatar rbelder avatar sebastian-brunner avatar sebastianriedel avatar stoertebeker23 avatar vahidm1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rafcon's Issues

Basic turtle demo and ros

trying to run the demo, i have experienced the following two items related to python, I believe:

changed the init_ros_node script line 12, from

except Exception , e:
to
except Exception as e:
and gives no errors here, now.

the following error appears:
ERROR - core.states.execution_state: ExecutionState with name 'init_ros_node' and id 'INIT_ROS_NODE' had an internal error: ImportError: dynamic module does not define module export function (PyInit__tf2)
Traceback (most recent call last):
File "script.py (20)", line 2, in
File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/init.py", line 28, in
from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/init.py", line 38, in
from tf2_py import *
File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/init.py", line 38, in
from ._tf2 import *
ImportError: dynamic module does not define module export function (PyInit__tf2)

can you help!

Align on Dropping Support for Python2

Gaphas would like to use Python 3 to its full potential, and we don’t intend to maintain Python 2 compatibility indefinitely. CPython is dropping support for legacy Python on January 1, 2020. I would like to have Gaphas drop support for Python 2 before that date if possible.

Are there any plans to drop Python 2 support in RAFCON?

Some question about the built-in data and variable in RAFCON

I have read the tutorials. But some questions still confuse me.

  1. Are local variable of previous state immediately destroyed after entering the next state.(Not concurrency state)

  2. I have some custom data struct. How do I pass it to the next state using data flow? If I edit the DataType in Data Linkage to my custom data. RAFCON will report some error message like this,
    image

  3. Can I control the state machine to run or stop by code instead of the GUI?

sourceview style are not installed correctly

When installing rafcon in ubuntu, the sourceview styles are not installed correctly.

Temporary fix:

cd ~/.local/share/gtksourceview-3.0/styles
cp rafcon/* .

Furthermore, you should set the rafcon-dark style in the preferences (File -> Preferences -> GUI Config -> SOURCE_EDITOR_STYLE), as this style complies with our design.

Choosing the correct style per default will be fixed in the next release.

Configurations GUI

Till now the configurations (core, gui, network) has to be modified in ~/.config/rafcon. A GUI would speedup the configuration modification.

Originally created by @sebastian-brunner ([email protected]) at 2016-02-22 13:37:57+00:00 (moved from RMC internal repository)

Group/Ungroup states

The Feature would improve usability by speeding up state-machine development and intuitive usage of multi-selection. Many can be processed by cut/paste into a newly generated HierarchyState. So the Issue depends on Issue #48.

Feature should firstable work for

  • group multiple States + ScopedVariables + Transitions and DataFlows between those States and ScopedVariables which are selected by being cut & paste to a hierachical state with the same parent (mainly covered by #48)
  • ungroup a selected State (ContainerState) by cut & paste it's child States + ScopedVariables + Transitions and DataFlows between of those States to to the selected State's parent (except if the State is a root-state)
  • support of group and ungroup by the modification history

Additionally the following elements could be of interest for grouping action:

  • ingoing DataFlows into selected States or ScopedVariables (insert InputDataPort and 1 External DataFlow from original origin State/DataPort to this InputDataPort and 1 Internal DataFlow from this InputDataPort)
  • outgoing DataFlows selected States or ScopedVariables (insert OutputDataPort and 1 Internal DataFlow from this OutputDataPort to selected State/ScopedVariable and 1 External DataFlow from this OutputDataPort to original target DataPort)
  • outgoing Transitions from selected States (insert Outcome and 1 Internal Transition to this Outcome and 1 External Transition to old target State/Outcome)

Additional for ungrouping action and simular to the grouping action the linkage to siblings states may be preserved (in any case the DataPorts or Outcomes have to have at least one ingoing and one outgoing connection):

  • ingoing DataFlows
  • outgoing DataFlows
  • ingoing Transitions
  • outgoing Transitions

Finally the internal linkage and the grouped meta-data has to be preserved (and insert scale method call (may static method) to graphical viewer):

  • for ungroup (scale the meta data smaller (relative))
  • for group (scale the meta data bigger (relative))

Originally created by @Rbelder at 2016-02-17 15:02:21+00:00 (moved from RMC internal repository)

How to set default value of custom data type?

I create a custom data type like this:

import json

class Point:
  def __init__(self,px=0,py=0):
    self.x = px
    self.y = py

  def toJSON(self):
    return json.dumps(self,default=lambda o:o.__dict__,sort_keys=True,indent=4)

State source:

def execute(self, inputs, outputs, gvm):
    point = inputs['point']
    self.logger.info("[{}, {}]".format(point.x,point.y))
    return 0

Input Ports:
image

Console output:
image

The default value will be directly mapped to point.x.
When I set "[1,0]" as default value the output is "INFO - test: [[1,0], 0]". The same for others.

States editor tab-label tooltip-text barely used and not functional

The issue is made to get some opinions what to do with this barely used feature of a State-Editor-Page which is not functional, at the moment. The reason why it is not functional seems to be the background color.

At the moment, the tab-label length is shorten to 10 letters. With the destroy- and pin-button the tab header is already big enough but also could be bigger because the tabs (pages) are automatically hided by the StatesEditorController.

The tool-tip-text at the moment would show the full name of the state.

It also could show additional information like

  • state-machine id or name
  • the full path
  • the state_id

and so on.

If there is no interest of functional feature of this kind we could remove it at all.

Originally created by @Rbelder at 2016-02-15 15:20:08+00:00 (moved from RMC internal repository)

Size of GUI cannot be changed

Under certain (unknown) circumstances, the size and position of the GUI window cannot be changed.

The problem can be fixed by deleting the runtime_config.yaml, which is of course no solution for the issue.

@Rbelder provided his runtime config with which the issue occured:

LAST_PATH_OPEN_SAVE: /home/Rbelder/Desktop/cvafda
WINDOW_POS: !!python/tuple
- 0
- 0
WINDOW_SIZE: !!python/tuple
- 1920
- 1200

After deleting the runtime config, it was recreated and looked like this:

WINDOW_POS: !!python/tuple
- 60
- 150
WINDOW_SIZE: !!python/tuple
- 1642
- 981

I tried setting the values of the problematic config in my runtime config, but I couldn't reproduce the error.

Originally created by @franzlst ([email protected]) at 2016-02-12 08:23:56+00:00 (moved from RMC internal repository)

Copy-cut/paste for multi-selection

The Feature would improve usability by speeding up state-machine development and intuitive usage of multi-selection. Is needed for issue #49.

The issue is a duplication of mantis issue https://rmintra01.robotic.dlr.de/mantis/view.php?id=2179.

Feature should firstable work for:

  • multiple States
  • + ScopedVariables
  • + Transitions and DataFlows between those States and ScopedVariables

Originally created by @Rbelder at 2016-02-17 14:26:49+00:00 (moved from RMC internal repository)

Tests need to work on custom config files

Currently, the tests use the config files from ~/.config/rafcon. The files are backed before and restored after the tests, but the default directory is always used.

This is problematic, when tests are run in parallel. There are multiple situations, in which this occurs:

  • Tests are run for different interpreters at the same time (currently not done)
  • On Jenkins
    • several pushes shortly after each other on one branch
    • several pushes shortly after each other on different branches
    • pull requests (tests are run for pr-head and pr-merge at the same time)
      Some tests modify the GUI files and depend on their content. If other tests modify the content, conflicts can occur.

RAFCON has the option to specify the location of the config file. This path should be set uniquely for each test run!

Update Gaphas graphical editor on external meta data changes

At the moment the GaphasEditor could not handle external change of meta-data. An observation of state_meta_signals and use of meta_signal.emit() was introduce in commit 0b7017e780777d93ef0c4308e2a62f98325b2324 to handle Undo- Redo-MetaAction but could not trigger the respective right updates.

Originally created by @Rbelder at 2016-01-28 10:14:03+00:00 (moved from RMC internal repository)

Wrong interpretation of MAX_VISIBLE_LIBRARY_HIERARCHY

For the statemachine: unit_test_state_machines/deep_libraries/library_middle2

It has 33 States (library state instances count as two states, one for the library wrapper and one for the state_copy).

If MAX_VISIBLE_LIBRARY_HIERARCHY is set to 3 than all 33 Models for the states are loaded, which is correct. 3 levels of hierarchies are shown if a show-flag is enabled, which is also correct.

If MAX_VISIBLE_LIBRARY_HIERARCHY is set to 2 also all 33 Models for the states are loaded as well, which is wrong! Only 2 levels of hierarchies are shown if a show-flag is enabled, which is actually correct. Thus, a lot of models are created, but not shown using the show flag.

For bigger state machines, this drastically increases the loading time by a factor of FOUR!
E.g. for the unit_test_state_machines/deep_libraries/sm with deepest libraries!

For our LRU state machines, this is even worse!

How to use RAFCON for ROS2?

I created a execution state in root state.
execution state code:

import rclpy
from rclpy.node import Node

from std_msgs.msg import String

class MinimalSubscriber(Node):

    def __init__(self):
        super().__init__('minimal_subscriber')
        self.subscription = self.create_subscription(
            String,
            'topic',
            self.listener_callback,
            10)
        self.subscription  # prevent unused variable warning

    def listener_callback(self, msg):
        self.get_logger().info('I heard: "%s"' % msg.data)

def execute(self, inputs, outputs, gvm):
    rclpy.init(args=args)

    minimal_subscriber = MinimalSubscriber()

    rclpy.spin(minimal_subscriber)

    # Destroy the node explicitly
    # (optional - otherwise it will be done automatically
    # when the garbage collector destroys the node object)
    minimal_subscriber.destroy_node()
    rclpy.shutdown()
    return "success"

An error occurred while I clicked the apply button:

13:21:29 ERROR - gui.controllers.state_editor.source_editor: The script was saved, but cannot be compiled: SyntaxError: invalid syntax (__init__.py, line 62)

System: Debian 4.9.210
ROS2: eloquent

StateMachineTreeController selection or core actions cause several debug or warning messages

The StateMachineTreeController needs some fixing.

Major problems seems to root from the following missing checks or logical failures:

  • avoid at any case to pick elements of the internal tree if those are not there
  • check if missing or obsolete internal tree-elements are in the state-machine-core-elements
  • check models in handed selection if those are on the core

Originally created by @Rbelder at 2016-02-18 11:27:53+00:00 (moved from RMC internal repository)

Use better names RAFCON_LIB_PATH and RAFCON_LIBRARY_PATH

The RAFCON specific env variables RAFCON_LIB_PATH and RAFCON_LIBRARY_PATH sound similar but have very different meaning:

RAFCON_LIB_PATH: location, where the the share/libraries of RAFCON reside
RAFCON_LIBRARY_PATH: list of file system locations, which RAFCON includes as libraries during startup

We should choose better names.

Session restore test cannot be run in parallel

The test_restore_session test sometimes produces error when run in parallel to other tests.

Here is a build (on our internal Jenkins) that fails due to this: https://rmc-jenkins.robotic.dlr.de/jenkins/job/common/job/rafcon/view/change-requests/job/PR-707-merge/4/consoleFull

Error output:

09:24:47 tests/gui/widget/test_restore_session.py::test_restore_session FAILED    [ 92%]
09:24:47 
09:24:47 =================================== FAILURES ===================================
09:24:47 _____________________________ test_restore_session _____________________________
09:24:47 
09:24:47 caplog = <_pytest.logging.LogCaptureFixture object at 0x7fd71d31f790>
09:24:47 
09:24:47     @pytest.mark.timeout(20)
09:24:47     def test_restore_session(caplog):
09:24:47         from rafcon.core.storage import storage
09:24:47     
09:24:47         change_in_gui_config = {'AUTO_BACKUP_ENABLED': False, 'HISTORY_ENABLED': False,
09:24:47                                 'SESSION_RESTORE_ENABLED': True}
09:24:47     
09:24:47         # first run
09:24:47         libraries = {"ros": join(testing_utils.EXAMPLES_PATH, "libraries", "ros_libraries"),
09:24:47                      "turtle_libraries": join(testing_utils.EXAMPLES_PATH, "libraries", "turtle_libraries"),
09:24:47                      "generic": join(testing_utils.LIBRARY_SM_PATH, "generic")}
09:24:47         testing_utils.run_gui(gui_config=change_in_gui_config, libraries=libraries)
09:24:47         try:
09:24:47             open_state_machines = {'list_of_hash_path_tab_page_number_tuple': [], 'selected_sm_page_number': None}
09:24:47             trigger_gui_signals_first_run(open_state_machines)
09:24:47         finally:
09:24:47             testing_utils.close_gui(force_quit=False)
09:24:47             testing_utils.shutdown_environment(caplog=caplog, expected_warnings=0, expected_errors=0)
09:24:47     
09:24:47         # second run
09:24:47         libraries = {"ros": join(testing_utils.EXAMPLES_PATH, "libraries", "ros_libraries"),
09:24:47                      "turtle_libraries": join(testing_utils.EXAMPLES_PATH, "libraries", "turtle_libraries"),
09:24:47                      "generic": join(testing_utils.LIBRARY_SM_PATH, "generic")}
09:24:47         testing_utils.run_gui(gui_config=change_in_gui_config, libraries=libraries)
09:24:47     
09:24:47         try:
09:24:47             final_open_state_machines = {'list_of_hash_path_tab_page_number_tuple': [], 'selected_sm_page_number': None}
09:24:47             trigger_gui_signals_second_run(final_open_state_machines)
09:24:47         except:
09:24:47             raise
09:24:47         finally:
09:24:47             testing_utils.close_gui()
09:24:47     
09:24:47         print(open_state_machines)
09:24:47         print(final_open_state_machines)
09:24:47     
09:24:47         # test selection, page number and path
09:24:47         # TODO find if there is a proper hash value test
09:24:47         # TODO find out why core and gui hashes are changing !!! not even fully deterministic !!!
09:24:47         # TODO find out why dirty flag is once wrong when AUTO_BACKUP is enabled in parallel
09:24:47         #      (is connected to direct storing while opening)
09:24:47         assert open_state_machines['selected_sm_page_number'] == final_open_state_machines['selected_sm_page_number']
09:24:47     
09:24:47         final_tuple_list = final_open_state_machines['list_of_hash_path_tab_page_number_tuple']
09:24:47     
09:24:47         assert open_state_machines['selection_state_machine'] == final_open_state_machines['selection_state_machine']
09:24:47     
09:24:47         order_of_pages_to_be_dirty = [False, True, False, False, True, False, True]
09:24:47         for index, sm_tuple in enumerate(open_state_machines['list_of_hash_path_tab_page_number_tuple']):
09:24:47             assert index == sm_tuple[PAGE_NUMBER_INDEX]
09:24:47             if not final_tuple_list[index][CORE_HASH_INDEX] == sm_tuple[CORE_HASH_INDEX]:
09:24:47                 print("CORE hashes page {4} are not equal: {0} != {1}, path: {2} {3}" \
09:24:47                       "".format(final_tuple_list[index][CORE_HASH_INDEX], sm_tuple[CORE_HASH_INDEX],
09:24:47                                 sm_tuple[PATH_INDEX], sm_tuple[MARKED_DIRTY_INDEX], sm_tuple[PAGE_NUMBER_INDEX]))
09:24:47                 if sm_tuple[PATH_INDEX]:
09:24:47                     sm_file_path = join(sm_tuple[PATH_INDEX], storage.STATEMACHINE_FILE)
09:24:47                     if exists(sm_tuple[PATH_INDEX]) and exists(sm_file_path):
09:24:47                         print("sm_file_path: ", sm_file_path)
09:24:47                         print(storage.load_data_file(join(sm_tuple[PATH_INDEX], storage.STATEMACHINE_FILE)))
09:24:47                     else:
09:24:47                         print("does not exist sm_file_path ", sm_file_path)
09:24:47                 else:
09:24:47                     print("state machine was NOT stored")
09:24:47             assert final_tuple_list[index][CORE_HASH_INDEX] == sm_tuple[CORE_HASH_INDEX]
09:24:47 >           assert final_tuple_list[index][PATH_INDEX] == sm_tuple[PATH_INDEX]
09:24:47 E           AssertionError: assert '/home_local/...urtle_demo_sm' == '/home_local/j...urtle_demo_sm'
09:24:47 E             - /home_local/jenkins/common_rafcon_PR-707-head/tests/../share/examples/tutorials/basic_turtle_demo_sm
09:24:47 E             ?                                          ^ ^^
09:24:47 E             + /home_local/jenkins/common_rafcon_PR-707-merge/tests/../share/examples/tutorials/basic_turtle_demo_sm
09:24:47 E             ?                                          ^ ^^^
09:24:47 
09:24:47 tests/gui/widget/test_restore_session.py:326: AssertionError
09:24:47 ----------------------------- Captured stdout call -----------------------------

For this build, the pr-head and pr-merge build were running in parallel.

Maybe this can be fixed by fixing #13.

Contributing guidelines not easily accessible

GitHub displays lots of helpful prompts for new contributors, but clicking on them is likely to confuse users because they just point to the CONTRIBUTING symlink. Perhaps a compiled version of this file could be put there instead to improve the new contributor experience?
Screenshot from 2020-02-07 17-23-27
Screenshot from 2020-02-07 17-22-37
Screenshot from 2020-02-07 17-42-52

Drag'n'Drop to Cut/Copy and Paste into other or same HierarchyState

This is may a minor feature but useful as it is frequently used in Matlab-Simulink.

Short-Cuts also could be chosen similar to Matlab-Simulink (maybe instate of strg-key the alt-key). Therefore we have to hold the the alt-key free for this feature.

  • copy/paste -> Drag'n'Drop with left-mouse-click and alt-key holded
  • cut/paste -> Drag'n'Drop with middle-mouse-click and alt-key holded (not used in Matlab but can be helpful to move states from hierarchical level to another)

Originally created by @Rbelder at 2016-02-17 15:41:01+00:00 (moved from RMC internal repository)

GTK theme does not exist

File "/usr/local/lib/python2.7/site-packages/rafcon/gui/config.py", line 57, in init
self.configure_gtk()
File "/usr/local/lib/python2.7/site-packages/rafcon/gui/config.py", line 82, in configure_gtk
raise ValueError("GTK theme does not exist")
ValueError: GTK theme does not exist

ls RAFCON/source/rafcon/gui/assets/themes:
MaD dark templates

I put the MaD theme in there to see if that fixed it.
gtk-chtheme works for me to change gtk themes in general.

OSX 10.13.6
Python2.7

Alignment of selected elements

Next to the magnet lines for placing a state, it would be great (as Martin Schuster suggests) to be able to (either horizontally or vertically) align a group of selected states.

Setting of external editor via dialog does not work

The user can use an external editor (such as pycharm or emacs) to modify the python code of ExecutionStates. If no editor is set in the config yet a dialog used to pop up, asking the user which editor should be used. Currently, the dialog does not work.

As a temporary fix, the editor can just be defined in the gui_config.yaml via e.g.

DEFAULT_EXTERNAL_EDITOR: pycharm.sh

thus avoiding the dialog popup.

Run with hidden GUI cause "maximum recursion depth exceeded" error

The issue could also be situated in the gaphas repo but I wanted to keep track here.

The issue occurs in a special run configuration of our tests. The tests as well as the RAFCON GUI can be run in a minimized GUI mode to e.g. hide tests runs or simply start minimized RAFCON GUI instances. The example commands to reproduce are as follows (see the traceback below):

cd /RAFCON_REPO/tests
RAFCON_LIBRARY_PATH= RAFCON_START_MINIMIZED=1 py.test -s gui

It would be good if one of the core developer of gaphas @danyeaw or @amolenaar could look at it, too.

It is a corner case but maybe it becomes at some point a bigger problem. With gtk2 and respective gaphas version we have not had this issue.

log.py                     148 ERROR    Unexpected error
Traceback (most recent call last):
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/utils/log.py", line 143, in wrapper
    return function(*args, **kwargs)
  File "/home_local/in_progress/rafcon/repo/rafcon/tests/gui/widget/test_menu_bar.py", line 329, in trigger_gui_signals
    call_gui_callback(menubar_ctrl.on_refresh_all_activate, None, None, True)
  File "/home_local/in_progress/rafcon/repo/rafcon/tests/testing_utils.py", line 109, in call_gui_callback
    return rafcon.utils.gui_functions.call_gui_callback(*((callback, ) + args), **kwargs)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/utils/gui_functions.py", line 72, in call_gui_callback
    raise_(e_type, e_value, e_traceback)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/utils/gui_functions.py", line 49, in fun
    result = callback(*args)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/menu_bar.py", line 423, in on_refresh_all_activate
    gui_helper_state_machine.refresh_all(force=force)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/helpers/state_machine.py", line 598, in refresh_all
    state_machines_editor_ctrl.refresh_all_state_machines()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/state_machines_editor.py", line 539, in refresh_all_state_machines
    self.refresh_state_machines(list(self.model.state_machine_manager.state_machines.keys()))
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/state_machines_editor.py", line 506, in refresh_state_machines
    was_closed = self.on_close_clicked(None, self.model.state_machines[sm_id], None, force=True)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/state_machines_editor.py", line 412, in on_close_clicked
    remove_state_machine_m()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/state_machines_editor.py", line 367, in remove_state_machine_m
    self.model.state_machine_manager.remove_state_machine(state_machine_id)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/observable.py", line 48, in wrapper
    self._notify_method_after(self, _func.__name__, res, args, kwargs)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/support/wrappers.py", line 84, in _notify_method_after
    args, kwargs)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/model.py", line 754, in notify_method_after_change
    self, prop_name, info)
  File "/home_local/in_progress/rafcon/repo/rafcon/tests/testing_utils.py", line 471, in __patched__notify_observer__
    return Model.__notify_observer__(self, observer, method, *args, **kwargs)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/model.py", line 601, in __notify_observer__
    return method(*args, **kwargs)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/models/state_machine_manager.py", line 108, in model_changed
    sm_m.prepare_destruction()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/models/state_machine.py", line 154, in prepare_destruction
    self.destruction_signal.emit()
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/observable.py", line 97, in emit
    model.notify_signal_emit(name, arg)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/model.py", line 784, in notify_signal_emit
    self, prop_name, info)
  File "/home_local/in_progress/rafcon/repo/rafcon/tests/testing_utils.py", line 457, in __patched__notify_observer__
    return Model.__notify_observer__(self, observer, method, *args, **kwargs)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gtkmvc3/gtkmvco/gtkmvc3/model.py", line 601, in __notify_observer__
    return method(*args, **kwargs)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/controllers/graphical_editor_gaphas.py", line 322, in state_machine_destruction
    self.canvas.get_view_for_model(self.root_state_m).remove()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/items/state.py", line 193, in remove
    child.remove()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/items/state.py", line 193, in remove
    child.remove()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/items/state.py", line 193, in remove
    child.remove()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/items/state.py", line 193, in remove
    child.remove()
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/items/state.py", line 923, in remove
    self.canvas.remove(self)
  File "/home_local/in_progress/rafcon/repo/rafcon/source/rafcon/gui/mygaphas/canvas.py", line 68, in remove
    super(MyCanvas, self).remove(item)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/canvas.py", line 156, in remove
    self._remove(item)
  File "<decorator-gen-12>", line 2, in _remove
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/state.py", line 77, in wrapper
    return func(*args, **kwargs)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/canvas.py", line 136, in _remove
    self._update_views(removed_items=(item,))
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/canvas.py", line 847, in _update_views
    v.request_update(dirty_items, dirty_matrix_items, removed_items)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/view.py", line 739, in request_update
    self._qtree.remove(item)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 196, in remove
    self._bucket.find_bucket(clipped_bounds).remove(item)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 352, in find_bucket
    return self._buckets[index].find_bucket(bounds)
  
.... 

  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 352, in find_bucket
    return self._buckets[index].find_bucket(bounds)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 352, in find_bucket
    return self._buckets[index].find_bucket(bounds)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 352, in find_bucket
    return self._buckets[index].find_bucket(bounds)
  File "/home_local/in_progress/rafcon/foreign_packages/repos/gaphas/gaphas/quadtree.py", line 343, in find_bucket
    if x >= cx:
RuntimeError: maximum recursion depth exceeded in cmp

Successfully loaded plugin but not available.

My plugin path: /home/bot/rafcon_plugins/templates.(download from this repo/master)
The fold like this:
image

While set the RAFCON_PLUGIN_PATH=/home/bot/rafcon_plugins/templates.

An error reported:ERROR - rafcon.utils.plugins: The specified plugin path does not exist: /home/bot/rafcon_plugins/template.

When set RAFCON_PLUGIN_PATH=/home/bot/rafcon_plugins/ the message is:
2020-03-24 16:16:42: INFO - rafcon.utils.plugins: Found plugin 'rafcon_plugins' at /home/bot/rafcon_plugins/
2020-03-24 16:16:42: INFO - rafcon.utils.plugins: Successfully loaded plugin 'rafcon_plugins'

But it does't call hooks.py because I have not seen this message.

And the tutorial said put xxx/plugins/templates into RAFCON_PLUGIN_PATH instead of xxx/plugins.
image

Besides, I found that.

I have a test.

Test code:

import os 

path1 = '/home/bot/rafcon_plugins/templates'
isExist = os.path.exists(path) 
print(isExist) 
  
path2 = '/home/bot/rafcon_plugins/templates/hooks.py'
isExist = os.path.exists(path) 
print(isExist) 

path2 = '/home/bot/rafcon_plugins'
isExist = os.path.exists(path) 
print(isExist) 

Outputs:

False
True
True

Is something wrong with me?

Grid for graphical editor

As Martin Schuster suggests, it would be awesome to have a grid in the graphical editor, which the user can use to align its states both visually and per snapping.

Cryptic folder names of substates

When browsing the filesystem of states the individual substates are saved to directories with the name of the ID of the state. This makes it impossible to identify which directory contains which state at a first glance. Here is an example:

$ tree /internal_path/moro/packages/statemachines/latest/spacebotcup/mission/mission_control/

/internal_path/moro/packages/statemachines/latest/spacebotcup/mission/mission_control/
|-- XXPUOJ
|   |-- BFAFCW
|   |   |-- gui_gtk.json
|   |   |-- gui_gtk.yaml
|   |   |-- meta.json
|   |   |-- meta.yaml
|   |   `-- script.py
|   |-- LMDUEE
|   |   |-- gui_gtk.json
|   |   |-- gui_gtk.yaml
|   |   |-- meta.json
|   |   `-- meta.yaml
|   |-- SZKEWL
|   |   |-- gui_gtk.json
|   |   |-- gui_gtk.yaml
|   |   |-- meta.json
|   |   `-- meta.yaml
|   |-- gui_gtk.json
|   |-- gui_gtk.yaml
|   |-- meta.json
|   `-- meta.yaml
`-- statemachine.yaml

It would be much easier to browse the file system if the names of the states would be prepended to the directory names.

Originally created by @peter-lehner at 2016-02-16 10:08:08+00:00 (moved from RMC internal repository)

python3's "__pycache__" folder chrashes loading of examples (maybe more)

Hi,

I just installed rafcon in a python 3 environment (pip3 install rafcon --user) on a system it has not been running before. Executing ~/.local/bin/rafcon starts the GUI. When opening anything from the library section (examples, libs, etc) I get the following error:

core.storage.storage: Error while loading state data: Data file not found: /home/USER/.local/share/rafcon/examples/libraries/turtle_libraries/clear_field/clear_field_CLEAR_FIELD/__pycache__/meta.json Traceback (most recent call last): File "/home/USER/.local/lib/python3.6/site-packages/rafcon/core/storage/storage.py", line 401, in load_state_recursively state_info = load_data_file(path_core_data) File "/home/USER/.local/lib/python3.6/site-packages/rafcon/core/storage/storage.py", line 495, in load_data_file raise ValueError("Data file not found: {0}".format(path_of_file)) ValueError: Data file not found: /home/USER/.local/share/rafcon/examples/libraries/turtle_libraries/clear_field/clear_field_CLEAR_FIELD/__pycache__/meta.json

Seeing these files are not there, I started looking in the mentioned python files, and it seems it's trying to load (parts of) state machines recursively through all folders. Python3 manages to put a cache folder next to python files though (as opposed to python2), which of course has no valid things to load, but the code still tries, and fails.

After cleaning the cache files (running py3clean ~/.local/share/rafcon/) and preventing python from creating caches (insert sys.dont_write_bytecode = True in ~/.local/bin/rafcon) the examples open just fine.

I feel preventing the caches is the wrong way though. Maybe there is another solution?

Note: Reproducing this issue, I noticed, that when I remove the added line in ~/.local/bin/rafcon the problem does not reoccur before I reinstall rafcon.

(btw: This is ubuntu18.04 running in win10's WSL, wish there was an easy way to set it up running it under windows (that i can also explain to non-developers), but had no luck with gtk / cairo so far)

ImportErrors when installing running RAFCON

@ct2034 wrote:
/usr/lib/python2.7/site-packages/rafcon

i then got: ImportError: No module named gtkgl
which I solved by installing: python-gtkglext1

now i get:

2018-10-02 18:01:42:  WARNING - rafcon.gui.views.utils.editor:  Python module 'gtksourceview2' not found!
Traceback (most recent call last):
  File "/usr/local/bin/rafcon", line 9, in <module>
    load_entry_point('rafcon==0.12.24', 'gui_scripts', 'rafcon')()
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/start.py", line 323, in main
    setup_gui()
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/start.py", line 179, in setup_gui
    from rafcon.gui.controllers.main_window import MainWindowController
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/controllers/main_window.py", line 43, in <module>
    from rafcon.gui.controllers.states_editor import StatesEditorController
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/controllers/states_editor.py", line 28, in <module>
    from rafcon.gui.controllers.state_editor.state_editor import StateEditorController
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/controllers/state_editor/state_editor.py", line 33, in <module>
    from rafcon.gui.controllers.state_editor.source_editor import SourceEditorController
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/controllers/state_editor/source_editor.py", line 41, in <module>
    from rafcon.gui.views.state_editor.source_editor import SourceEditorView
  File "/usr/local/lib/python2.7/dist-packages/rafcon/gui/views/state_editor/source_editor.py", line 18, in <module>
    from rafcon.gui.views.utils.editor import EditorView, gtksourceview2
ImportError: cannot import name gtksourceview2

Originally posted by @ct2034 in #4 (comment)

Suggestion: Do not store semantic data if not available

When a state machine is saved, for each state a semantic_data.json file is created. Even, if there is no semantic data (which is probably the case in over 95% of the times).

These empty ({}) files are then usually versioned and need to be loaded with the state machine.

Therefore, I would suggest to only create this file, if a state contains semantic data.

Is there anything against this @SebastianGB?

Unused methods and attributes in StateMachineStatus

The class StateMachineStatus has the attributes _dependency_tree and _thread_histories and the methods set_thread_history and dependency_tree, all of which are not used.

Are they intended for something or can they be removed?

If they can be removed, is the class needed at all? Otherwise, the status attribute in StatemachineExecutionEngine could be replaced by the pure StateMachineExecutionStatus enumeration.

Originally created by @franzlst ([email protected]) at 2016-02-02 12:13:42+00:00 (moved from RMC internal repository)

Cryptic error message during state machine loading

When opening a state machine in which an empty folder resides or leftovers of a merge conflict are located the following error message occurs during loading.

Traceback (most recent call last):
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/storage/storage.py", line 397, in load_state_recursively
    state_info = load_data_file(path_core_data)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/storage/storage.py", line 478, in load_data_file
    return storage_utils.load_objects_from_json(path_of_file)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/utils/storage_utils.py", line 126, in load_objects_from_json
    result = json.load(f, cls=JSONObjectDecoder, substitute_modules=substitute_modules)
  File "/usr/lib64/python2.7/json/__init__.py", line 291, in load
    **kw)
  File "/usr/lib64/python2.7/json/__init__.py", line 352, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "/volume/software/common/packages/python-jsonconversion/0.2.9/src/jsonconversion/decoder.py", line 64, in _dict_to_qualified_object
    return cls.from_dict(dictionary)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/states/library_state.py", line 375, in from_dict
    output_data_port_runtime_values, use_runtime_value_output_data_ports)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/states/library_state.py", line 98, in __init__
    lib_version, state_copy = library_manager.get_library_state_copy_instance(self.lib_os_path)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/library_manager.py", line 397, in get_library_state_copy_instance
    state_machine = storage.load_state_machine_from_path(lib_os_path)
  File "/volume/software/common/packages/rafcon_execution_hooks_plugin/0.2.0/lib/python2.7/execution_hooks/hooks.py", line 45, in load_state_machine_from_path_with_hooks
    state_machine = old_load_state_machine_from_path(*args, **kwargs)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/utils/timer.py", line 13, in func_wrapper
    return_value = func(*args, **kwargs)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/core/storage/storage.py", line 301, in load_state_machine_from_path
    state_machine_dict = storage_utils.load_objects_from_json(state_machine_file_path)
  File "/volume/software/common/packages/rafcon/0.13.5/source/rafcon/utils/storage_utils.py", line 126, in load_objects_from_json
    result = json.load(f, cls=JSONObjectDecoder, substitute_modules=substitute_modules)
  File "/usr/lib64/python2.7/json/__init__.py", line 291, in load
    **kw)
  File "/usr/lib64/python2.7/json/__init__.py", line 352, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 3 column 1 (char 47)
10:37:44 ERROR - gui.helpers.state_machine: Error while trying to open state machine: 'NoneType' object has no attribute 'name'
10:37:44 ERROR - gui.controllers.library_tree: Could not open library: 'NoneType' object has no attribute 'file_system_path'

We should provide a nicer error message in order to help the user to find the problem.

Release?

I'm wondering if you are still intending to release RAFCON?

Plans to Upgrade to PyGObject and Python3?

I recently merged support for Python 3 in gaphas, and I am finalizing the upgrade to PyGObject now with gaphor/gaphas#20. Do you have any plans to upgrade RAFCON as well? The countdown is on.

It would be great to test the upgraded version of gaphas with RAFCON before releasing a new version, and I would like to coordinate with you to make sure everything goes smoothly. I feel like I am also just a bit dangerous having gone through the upgrade now, so I would be happy to share the tips I learned as well.

Tmp-Path should be user and process ID save and use a lock mechanism

Since the temporary path of RAFCON was already user save and has been made not user save again this issue should avoid making it worse again.

  • In the tmp-path the user has to be included to support multiple user activity on one machine.
  • In the tmp-path the process ID has to be included to support multiple instance of RAFCON run by one user.
  • A lock file should mark used and crashed instances of RAFCON. If a RAFCON-Instance is shutdown correctly the lock is removed.

This will enable to find data remaining from old runs, may to recover crashed RAFCON instances or parts of its data and to clean up the rafcon tmp-path without cleaning data of active RACFON-Instances. The actual tmp-paths do not support to detect process IDs.

Originally created by @Rbelder at 2016-02-22 17:43:35+00:00 (moved from RMC internal repository)

State machines with library states cannot be opened if show flag is set to True

Steps to reproduce:

  • create state machine
  • add arbitrary library state and set start transition
  • set show flag to true
  • save state machine
  • close state machine
  • try to reopen

The following stacktrace occurs:

Traceback (most recent call last):
  File "/home/suer_ch/USERSTORE/repositories/gtkmvc3/gtkmvco/gtkmvc3/controller.py", line 176, in _idle_register_view
    self.register_view(view)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/gui/controllers/graphical_editor_gaphas.py", line 109, in register_view
    self.setup_canvas()
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/gui/controllers/graphical_editor_gaphas.py", line 731, in setup_canvas
    self.add_state_view_for_model(self.root_state_m, rel_pos=gui_helper_meta_data.STATE_DEFAULT_REL_POS)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/core/decorators.py", line 53, in func_wrapper
    return_value = func(*args, **kwargs)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/gui/controllers/graphical_editor_gaphas.py", line 823, in add_state_view_for_model
    self.add_state_view_for_model(child_state_m, state_v, child_rel_pos, child_size, hierarchy_level + 1)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/core/decorators.py", line 53, in func_wrapper
    return_value = func(*args, **kwargs)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/gui/controllers/graphical_editor_gaphas.py", line 808, in add_state_view_for_model
    gui_helper_meta_data.scale_library_content(state_m)
  File "/home/suer_ch/USERSTORE/repositories/rafcon/source/rafcon/gui/helpers/meta_data.py", line 447, in scale_library_content
    models_dict[state_element_key] = {elem.core_element.core_element_id: elem for elem in state_element_list}

Error when switching from python2 to python3

Stacktrace:

2019-03-09 11:03:09:    ERROR - rafcon.gui.runtime_config:  Could not read from config /home/basti/.config/rafcon/runtime_config.yaml, using temporary default configuration. Error: while constructing a mapping
  in "/home/basti/.config/rafcon/runtime_config.yaml", line 18, column 13
found unhashable key
  in "/home/basti/.config/rafcon/runtime_config.yaml", line 18, column 15

The specified line contains: !!python/object/new:future.types.newstr.newstr
So there is something screwed up with string types from future.

Steps to reproduce:

  • open rafcon with python 2.7
  • open a state machine
  • close
  • open rafcon with python 3.x
  • error occurs directly when restoring session

Annoying warnings visualized in RAFCON console

Warnings like:

2019-05-07 10:20:25:  WARNING - py.warnings:  /home/brun_sb/.local/lib/python2.7/site-packages/gi/overrides/Gtk.py:1629: Warning: g_object_notify: assertion 'G_IS_OBJECT (object)' failed
  return _Gtk_main(*args, **kwargs)

are now also shown in the rafcon console, which is quite annoying.

This is probably related to the warnings module, we introduced in March.

And they are even shown several times. Shouldn't they be only shown once?

The DATA PORT is missing the “Scoped Variables” tab

My rafcon is v0.14.2 and my computer system is debian 9.

While I following the tutorials, I cannot find the Scoped Variables tab. I see this tab in DATA PORT in the picture on your homepage. Hope to get answers. Thanks!

Suggestions for the modification history

  • Reverse order: Oldest element on top, newest on bottom of list
  • Change columns to:
    Nr. (if at all) | Action (replace underscores by space) | Parameter (of the action called) | Affected (or so, the element on which the action was called on). Alternatively, the "Affected" could be the first column after Nr.
  • Change log texts:
    • "There is no more TrailHistory element to Redo" => "There is no more action that can be redone"
    • "pop: TGSMKB" => remove
    • "Multiple undo and redo to reach modification history element of version 4 -> undo-redo-list is: [(4, 'redo')]" => "Going to history status # 4" (or similar)
  • Apply history status if an entry in the history is clicked on
  • Do not jump to top of history if last element is reached with "Ctrl+Z" or button "Undo"

Originally created by @franzlst ([email protected]) at 2016-02-17 15:31:02+00:00 (moved from RMC internal repository)

GUI refactoring no longer supports textual notebook tabs

The gui_config.yaml allows to either use icons or textual labels for notebook tabs. The option is called USE_ICONS_AS_TAB_LABELS. The changes of the pull request #44 no longer supports textual tabs. Instead, RAFCON crashes on start. This needs to be fixed.

Steps to reproduce: Set USE_ICONS_AS_TAB_LABELS to False and start RAFCON

Originally created by @franzlst ([email protected]) at 2016-02-24 14:22:42+00:00 (moved from RMC internal repository)

DEBUG CONSOLE panel not showing any output

  • system is Ubuntu 16 LTS mini install with xfce desktop minimal (Linux 4.4.0-171-generic #200-Ubuntu SMP x86_64 GNU/Linux)
  • rafcon 0.14.1 (installed from pip)

when I start rafcon the DEBUG CONSOLE panel shows

DEBUG CONSOLE

INFO - gui.controllers.main_window: Ready

when I run some state machine, no new logger prints / python errors / anything get added to the console
when I click any of the ☑️ checkboxes (verbose, debug, info, ...) the one and only line INFO - gui.controllers.main_window: Ready also disappears and the output stays just blank with a cursor.

The shell I run the rafcon command in shows logger print just fine 🤷‍♀️
but I noticed errors like:
(rafcon:4164): Gtk-WARNING **: Allocating size to main_window 0x37324d0 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
(rafcon:3834): Pango-CRITICAL **: pango <whatever assertion> != NULL' failed

How can I fix logger prints / errors getting displayed in DEBUG CONSOLE?

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.