-
Notifications
You must be signed in to change notification settings - Fork 71
Description
I've tried to implement a simple SMACH state-machine and visualize it with smach_viewer. According to the terminal output, the state machine itself runs perfectly fine.
When I start smach_viewer, it throws the following error:
[ERROR] [1599821587.164191]: bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame; proxy of <Swig Object of type 'wxFrame *' at 0x55616f7eb050> >> Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/faps/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 844, in _status_msg_update if container.update_status(msg): File "/home/faps/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 185, in update_status self._local_data._data = pickle.loads(msg.local_data) File "/usr/lib/python2.7/pickle.py", line 1388, in loads return Unpickler(file).load() File "/usr/lib/python2.7/pickle.py", line 864, in load dispatch[key](self) File "/usr/lib/python2.7/pickle.py", line 1157, in load_get self.append(self.memo[self.readline()[:-1]]) KeyError: 'AJ9cQA'
I'm using:
- Ubuntu 18.04
- ROS Melodic (catkin_ws configured with Python3!)
My state-machine is implemented as follows:
#!/usr/bin/env python3
import smach
import smach_ros
import rospy
class t1(smach.State):
def __init__(self, outcomes=['successful', 'failed']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
class t2(smach.State):
def __init__(self, outcomes=['successful']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
class t3(smach.State):
def __init__(self, outcomes=['successful']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
if __name__=="__main__":
rospy.init_node('test_state_machine')
sm_top = smach.StateMachine(outcomes=['success'])
with sm_top:
smach.StateMachine.add('T1', t1(),
transitions={'successful': 'T2', 'failed': 'T3'})
smach.StateMachine.add('T2', t2(),
transitions={'successful': 'T1'})
smach.StateMachine.add('T3', t3(),
transitions={'successful': 'success'})
# Create and start the introspection server
sis = smach_ros.IntrospectionServer('introspection_server', sm_top, '/SM_ROOT')
sis.start()
# Execute SMACH plan
outcome = sm_top.execute()
# Wait for ctrl-c to stop the application
rospy.spin()
sis.stop()
Did I miss something or do you have any ideas what could cause the problem?