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:
But it comes out as:
Is this a bug, or a feature?
ROS Indigo, Ubuntu 14, Python 2.7
↧