Rosbag Python API: why do messages from a rosbag have mangled __class__?
I find that messages loaded from a rosbag via the Python API, have a weird __class__ attribute:
import rosbag
from sensor_msgs.msg import PointCloud2
# Round-trip a PointCloud2 message to a rosbag and back
bag = rosbag.Bag('test.bag', 'w')
try:
scan = PointCloud2()
print("__class__should be: \n{}".format(scan.__class__))
bag.write('scan', msg)
finally:
bag.close()
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['scan']):
print("But it comes out as: \n{}".format(msg.__class__))
bag.close()
The output:
__class__should be:
<class 'sensor_msgs.msg._PointCloud2.PointCloud2'>
But it comes out as:
<class 'tmpf1u1_e._sensor_msgs__PointCloud2'>
Is this a bug, or a feature?
ROS Indigo, Ubuntu 14, Python 2.7