echo ros自定義message報警
阿新 • • 發佈:2018-12-08
[email protected]:~$ rostopic echo /ultrasonic_type
Traceback (most recent call last):
File “/opt/ros/indigo/bin/rostopic”, line 35, in
rostopic.rostopicmain()
File “/opt/ros/indigo/lib/python2.7/dist-packages/rostopic/init.py”, line 1916, in rostopicmain
_rostopic_cmd_echo(argv)
File “/opt/ros/indigo/lib/python2.7/dist-packages/rostopic/init
_rostopic_echo(topic, callback_echo, bag_file=options.bag)
File “/opt/ros/indigo/lib/python2.7/dist-packages/rostopic/init.py”, line 915, in _rostopic_echo
sub = rospy.Subscriber(real_topic, msg_class, callback_echo.callback, {‘topic’: topic, ‘type_information’: type_information})
File “/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py”, line 533, in init
super(Subscriber, self).init(name, data_class, Registration.SUB)
File “/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py”, line 138, in init
raise ValueError(“data_class [%s] is not a class”%data_class)
ValueError: data_class [<module ‘ultrasonic_test’ from ‘/home/local_ws/devel/lib/python2.7/dist-packages/ultrasonic_test/init
(1)上述報警是先定義了一個message,然後根據該message定義了一個topic,併發布該topic
(2)通過rostopic echo /topic 可以正常輸出
(3)修改message中的資料,再進行編譯正常,沒有報警
(4)通過rostopic echo /topic 則出現傷處報警
處理措施:
重新建立一個msg檔案,msg檔案中的資料格式和上述錯誤報警時的格式一樣,則新生成的msg訊息格式定義的topic則可以正常輸出。