smach introspection server fails in electric
I am using smach in electric with the introspection server and the smach_viewer.py.
In electric the smach_viewer.py does not work for me (it just shows the machine but does not update in which state the machine is) and the script running the introspection server periodically shows the following exception:
Exception in thread server_name:status_publisher: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 505, in run self.__target(*self.__args, **self.__kwargs) File "/opt/ros/electric/stacks/executive_smach/smach_ros/src/smach_ros/introspection.py", line 160, in _status_pub_loop self._publish_status('HEARTBEAT') File "/opt/ros/electric/stacks/executive_smach/smach_ros/src/smach_ros/introspection.py", line 225, in _publish_status self._status_pub.publish(state_msg) File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/topics.py", line 695, in publish self.impl.publish(data) File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/topics.py", line 872, in publish serialize_message(b, self.seq, message) File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/msg.py", line 151, in serialize_message msg.serialize(b) File "/opt/ros/electric/stacks/executive_smach/smach_msgs/src/smach_msgs/msg/_SmachContainerStatus.py", line 120, in serialize buff.write(struct.pack('<I%ss'%length, length, _x.encode())) UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
Without the introspection sever or when running smach from diamondback the exception does not show up and everything works as expected. Does anyone have a clue what the problem is?
I used the script "examples/user_data2.py" from the smach_tutorials package and added the introspection server as follows:
--- user_data2.py 2011-08-31 09:41:46.108424577 +0200 +++ user_data_sis.py 2011-08-31 10:13:34.652678420 +0200 @@ -59,7 +59,11 @@ # Execute SMACH plan + sis = smach_ros.IntrospectionServer('server_name', sm, '/SM_ROOT') + sis.start() outcome = sm.execute() + rospy.spin() + sis.stop() if __name__ == '__main__':
Thanks for your help!