It appears that in Electric, rospy enforces that strings in ROS messages be ASCII strings, so the output of the python pickle module can't be encoded.  to fix this we should be able to just change SmachContainerStatus (https://kforge.ros.org/smach/executive_smach/file/d79964e4c22f/smach_msgs/msg/SmachContainerStatus.msg) from:

12 # A pickled user data structure
13 string local_data

to:

12 # A pickled user data structure
13 byte[] local_data

I don't currently have the time to test this, but I'm pretty sure this is the problem.

-j

On Fri, Oct 28, 2011 at 1:40 PM, Tully Foote <tfoote@willowgarage.com> wrote:
Hi Manuel,

There's already an open thread on this at
http://answers.ros.org/question/2032/smach-introspection-server-fails-in-electric

Tully

2011/10/28 Manuel Rodríguez <mrodriguez@robotnik.es>:
> Hi all,
>
> I'm using smach with the introspection server and the smach_viewer.py
> but does not work fine (it just shows the machine but does not update in
> which state the machine is), moreover the script running the introspection
> server periodically shows the following exception:
>>
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
>>     self.run()
>>   File "/usr/lib/python2.6/threading.py", line 484, 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)
>
> Has anyone knows how to solve this trouble?
> Best regards,
> Manuel
>
> _______________________________________________
> ros-users mailing list
> ros-users@code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>



--
Tully Foote
Systems Engineer
Willow Garage, Inc.
tfoote@willowgarage.com
(650) 475-2827
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users