Skip to content

Commit

Permalink
Merge pull request #106 from 130s/release-2.5.2
Browse files Browse the repository at this point in the history
2.5.2
  • Loading branch information
130s authored Jun 13, 2023
2 parents 0a62d3e + 2858dd3 commit be10033
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 12 deletions.
3 changes: 3 additions & 0 deletions executive_smach/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package executive_smach
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.5.2 (2023-06-13)
------------------

2.5.1 (2023-02-15)
------------------

Expand Down
2 changes: 1 addition & 1 deletion executive_smach/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>executive_smach</name>
<version>2.5.1</version>
<version>2.5.2</version>
<description>
This metapackage depends on the SMACH library and ROS SMACH integration
packages.
Expand Down
6 changes: 6 additions & 0 deletions smach/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package smach
^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.5.2 (2023-06-13)
------------------
* Fix outcome_map disambiguation for Concurrence `#80 <https://github.com/ros/executive_smach/issues/80>`_
* Fix is_running behaviour in case of exception in the state `#50 <https://github.com/ros/executive_smach/issues/50>`_
* Executing an empty Concurrence container hangs forever `#51 <https://github.com/ros/executive_smach/issues/51>`_

2.5.1 (2023-02-15)
------------------
* Fix: state machines cannot be pickled `#86 <https://github.com/ros/executive_smach/issues/86>`
Expand Down
2 changes: 1 addition & 1 deletion smach/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>smach</name>
<version>2.5.1</version>
<version>2.5.2</version>
<description>
SMACH is a task-level architecture for rapidly creating complex robot
behavior. At its core, SMACH is a ROS-independent Python library to build
Expand Down
4 changes: 4 additions & 0 deletions smach/src/smach/concurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def execute(self, parent_ud = smach.UserData()):
"""Overridden execute method.
This starts all the threads.
"""
# Check if any states added
if len(self._states) == 0:
raise smach.InvalidStateError("No states was added to concurrence")

# Clear the ready event
self._ready_event.clear()

Expand Down
18 changes: 10 additions & 8 deletions smach/src/smach/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,18 @@ def execute(self, parent_ud = smach.UserData()):
# Initialize container outcome
container_outcome = None

# Step through state machine
while container_outcome is None and self._is_running and not smach.is_shutdown():
# Update the state machine
container_outcome = self._update_once()
try:
# Step through state machine
while container_outcome is None and self._is_running and not smach.is_shutdown():
# Update the state machine
container_outcome = self._update_once()

# Copy output keys
self._copy_output_keys(self.userdata, parent_ud)
# Copy output keys
self._copy_output_keys(self.userdata, parent_ud)

# We're no longer running
self._is_running = False
finally:
# We're no longer running
self._is_running = False

return container_outcome

Expand Down
3 changes: 3 additions & 0 deletions smach_msgs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package smach_msgs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.5.2 (2023-06-13)
------------------

2.5.1 (2023-02-15)
------------------

Expand Down
2 changes: 1 addition & 1 deletion smach_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>smach_msgs</name>
<version>2.5.1</version>
<version>2.5.2</version>
<description>
this package contains a set of messages that are used by the introspection
interfaces for smach.
Expand Down
5 changes: 5 additions & 0 deletions smach_ros/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog for package smach_ros
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.5.2 (2023-06-13)
------------------
* Fix is_running behaviour in case of exception in the state `#50 <https://github.com/ros/executive_smach/issues/50>`_
* Executing an empty Concurrence container hangs forever `#51 <https://github.com/ros/executive_smach/issues/51>`_

2.5.1 (2023-02-15)
------------------
* Fix: response_slots when action goal is lost `#64 <https://github.com/ros/executive_smach/issues/64>`
Expand Down
2 changes: 1 addition & 1 deletion smach_ros/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>smach_ros</name>
<version>2.5.1</version>
<version>2.5.2</version>
<description>
The smach_ros package contains extensions for the SMACH library to
integrate it tightly with ROS. For example, SMACH-ROS can call
Expand Down
7 changes: 7 additions & 0 deletions smach_ros/test/concurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ def test_outcome_cb(self):
assert cc.userdata.a == 'A'
assert cc.userdata.b == 'A'

def test_empty_concurrence(self):
"""Test behavior of a container with no states"""
cc = Concurrence(['done'], default_outcome='done')

with self.assertRaises(InvalidStateError):
cc.execute()

def main():
rospy.init_node('concurrence_test',log_level=rospy.DEBUG)
rostest.rosrun('smach', 'concurrence_test', TestStateMachine)
Expand Down
25 changes: 25 additions & 0 deletions smach_ros/test/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,31 @@ def test_sequence(self):

assert outcome == 'done'

def test_exception(self):
class DoneState(State):
def __init__(self):
State.__init__(self,outcomes=['done'])
def execute(self,ud=None):
return 'done'

class ErrorState(State):
"""State falls with exception"""
def __init__(self):
State.__init__(self, ['done'])
def execute(self, ud):
raise Exception('Test exception')

sq = Sequence(['done'], connector_outcome='done')
with sq:
Sequence.add('OK', DoneState())
Sequence.add('ERROR', ErrorState())
Sequence.add('IGNORED', Setter())

with self.assertRaises(InvalidUserCodeError):
sq.execute()

assert sq.is_running() == False
assert 'a' not in sq.userdata # test IGNORED state wasn't called

def main():
rospy.init_node('sequence_test',log_level=rospy.DEBUG)
Expand Down
17 changes: 17 additions & 0 deletions smach_ros/test/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ def test_alt_api(self):

assert outcome == 'succeeded'

def test_exception(self):
class ErrorState(State):
"""State falls with exception"""
def __init__(self):
State.__init__(self, ['done'])
def execute(self, ud):
raise Exception('Test exception')

sm = StateMachine(['done'])
with sm:
StateMachine.add('ERROR', ErrorState())

with self.assertRaises(InvalidUserCodeError):
sm.execute()

assert sm.is_running() == False # test running flag lowered

def main():
rospy.init_node('state_machine_test',log_level=rospy.DEBUG)
rostest.rosrun('smach', 'state_machine_test', TestStateMachine)
Expand Down

0 comments on commit be10033

Please sign in to comment.