I have a rostopic names `/scanpoints` of type `datatypes/scan_point_2018`.
This is the custom datatype. The `scan_point_2018` is defined in some path `/path/..../scan_point_2018.hpp`.
I need to write a subscriber for this topic and I tried the following code:
#!/usr/bin/env python import rospy from std_msgs.msg import String
def callback(data):
rospy.loginfo("%s Header: %d" % (data.header))
def listener():
rospy.init_node('scan_listener', anonymous=True)
rospy.Subscriber("/scanpoints", String, callback)
rospy.spin()
if __name__ == '__main__':
listener()
As expected it through error:
[ERROR] [1526286071.031024461]:
Client [/scan_listener_6042_1526286069827] wants topic /scan_listener to have datatype/md5sum [std_msgs/String/992ce8a1687cec8c8bd883ec73ca41d1],but our version has [datatypes/scan_point_2018/9af20afc1058845793165634a89c8aa7]. Dropping connection.
I need to know how to call this custom datatype in my code? Do I need to include path of the file scan_point_2018.hpp or any other suggestions please!
↧