Skip to content

Commit

Permalink
Merge pull request #896 from DLR-RM/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
JohannesErnst authored Aug 12, 2024
2 parents ea89dbe + 536d6f3 commit 59987cd
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.1.3
current_version = 2.1.4

[bumpversion:glob:**/pyproject.toml]
search = version = "{current_version}" # Handled by bump2version
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Changelog
Information about :ref:`RAFCON` changes in each release will be published here. More
details can be found in the `GIT commit log <https://github.com/DLR-RM/RAFCON/commits/master>`__.

2.1.4
""""""
- Bug fixes:
- Fixed bug where data port would not reset properly
- Fixed bug when relocating an existing data flow

- Miscellaneous:
- Added proper deletion of gvm variables on shutdown

2.1.3
""""""
- Bug fixes:
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
cff-version: "1.2.0"
message: "If you use this software, please cite it using these metadata."
title: RAFCON
version: 2.1.3 # Handled by bump2version
date-released: 2024-04-19
version: 2.1.4 # Handled by bump2version
date-released: 2024-08-12
license: EPL-1.0
doi: "10.5281/zenodo.1493058"
authors:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.3
2.1.4
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rafcon"
version = "2.1.3" # Handled by bump2version
version = "2.1.4" # Handled by bump2version
description = "Develop your robotic tasks with hierarchical state machines using an intuitive graphical user interface"
keywords = ["state machine", "robotic", "FSM", "development", "GUI", "visual programming"]
readme = "README.rst"
Expand Down
2 changes: 1 addition & 1 deletion source/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"jsonconversion<1.0.0,>=0.2.13",
]
name = "rafcon-core"
version = "2.1.3" # Handled by bump2version
version = "2.1.4" # Handled by bump2version
description = "Develop your robotic tasks with hierarchical state machines"
keywords = [
"state machine",
Expand Down
11 changes: 11 additions & 0 deletions source/rafcon/core/global_variable_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,17 @@ def get_all_keys_starting_with(self, start_key):
if g_key and start_key in g_key:
output_list.append(g_key)
return output_list

def destroy_all_variables(self):
""" Deletes all global variables in a loop and then clears access keys and
type dictionary. Is called on shutdown.
"""
for key in list(self.__global_variable_dictionary):
self.delete_variable(key)
self.reset()

logger.debug("All global variables were deleted!")

#########################################################################
# Properties for all class fields that must be observed by gtkmvc3
Expand Down
6 changes: 6 additions & 0 deletions source/rafcon/core/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,13 @@ def main(optional_args=None):
time.sleep(1)

logger.info("State machine execution finished!")

plugins.run_hook("post_destruction")

# Properly destroy all global variables
gvm = core_singletons.global_variable_manager
gvm.destroy_all_variables()

logging.shutdown()

if user_input.memory_profiling:
Expand Down
14 changes: 14 additions & 0 deletions source/rafcon/core/states/container_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,20 @@ def check_data_flow_id(self, data_flow_id):
while data_flow_id in self._data_flows.keys():
data_flow_id = generate_data_flow_id()
return data_flow_id

def get_data_flow_id(self, from_child_state_id, to_child_state_id):
""" Return the data flow id based on the unique child state identifiers (6 letters) and the current selected hierarchy state
:param from_child_state_id: The child state from which the data flow originates
:param from_child_state_id: The child state to which the data flow goes
:return: The requested data_flow_id
:raises exceptions.AttributeError: If data flow does not exist
"""
for data_flow_key in self.data_flows:
data_flow = self.data_flows[data_flow_key]
if data_flow.from_state == from_child_state_id and data_flow.to_state == to_child_state_id:
return data_flow.data_flow_id
raise AttributeError("The requested data flow from '%s' to '%s' does not exist!" % (from_child_state_id, to_child_state_id))

@lock_state_machine
@Observable.observed
Expand Down
22 changes: 21 additions & 1 deletion source/rafcon/gui/mygaphas/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,28 @@ def on_button_release(self, event):
modify_target = self._end_handle is self._connection_v.to_handle()
self._handle_temporary_connection(self._current_sink, None, of_target=modify_target)

if not self._current_sink: # Reset connection to original status, as it was not released above a port
if not self._current_sink or not self._connection_v.from_port: # Reset connection to original status if new connection is not defined properly
self._reset_connection()
elif not self._current_sink.port: # Try to create a port if it was released above a state
self.view.canvas.update_now()
if self.motion_handle:
self.motion_handle.stop_move()
# Create new connection
from_port_model = self._connection_v.from_port.model
to_port_model = self._current_sink.item.model
if gap_helper.create_new_connection(from_port_model, to_port_model):
# Remove placeholder from canvas
if self._connection_v:
self._connection_v.remove_connection_from_ports()
self.view.canvas.remove(self._connection_v)
# Delete old connection
data_flow_container_state = self._connection_v.from_port.model.parent.state.parent
from_state_id = self._connection_v.model.core_element.from_state
to_state_id = self._connection_v.model.core_element.to_state
data_flow_id = data_flow_container_state.get_data_flow_id(from_state_id, to_state_id)
data_flow_container_state.remove_data_flow(data_flow_id)
else:
self._reset_connection()
else: # Modify the source/target of the connection
connection_core_element = self._connection_v.model.core_element
try:
Expand Down
2 changes: 1 addition & 1 deletion source/rafcon/gui/mygaphas/utils/gap_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def is_descendant(parent, descendant):
if isinstance(from_port_m, ScopedVariableModel):
data_port_type = True

if add_data_port and (not isinstance(from_state_m.state, ExecutionState) or from_state_m.state.core_element_id != to_state_m.state.core_element_id):
if add_data_port:
try:
if isinstance(to_state_m.state, LibraryState):
logger.error("Data port couldn't be added automatically to: {0}".format(to_state_m.state.name))
Expand Down
4 changes: 4 additions & 0 deletions source/rafcon/gui/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ def stop_gtk():
def post_gui_destruction():
plugins.run_hook("post_destruction")

# Properly destroy all global variables
gvm = core_singletons.global_variable_manager
gvm.destroy_all_variables()

if global_gui_config.get_config_value('AUTO_RECOVERY_LOCK_ENABLED'):
import rafcon.gui.models.auto_backup
rafcon.gui.models.auto_backup.remove_rafcon_instance_lock_file()
Expand Down

0 comments on commit 59987cd

Please sign in to comment.