-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rostopic pub completion wrong for dynamic arrays of type duration/time (was: publishing time or duration arrays with rostopic fails) #252
Comments
Please provide a reproducible command which fails for you. The above command seems to be incomplete or formatted incorrectly. |
Oh github interpreted the "-" as list. Now it should be correct According to the last line of the error message, rostopic seems to think duration (also same for time, when I remove the duration array) is a "custom" type message ValueError("message type is missing package name: %s"%str(message_type)) ValueError: message type is missing package name: duration Here is the full message specification: #Integer #Unsigned Integer #Float #Bool #String #Time #Duration #Integer #Unsigned Integer #Float #Bool #String #Time #Duration testsubmessage t_nbi_sub testsubmessage bool tbi_tm_bool When I comment the following lines: Everything works fine with the message type. The auto completion can be used to publish messages. If those arrays are in, even if I do not change the values of the auto completion, when the arrays are in, I get the error which I posted. |
Please consider updating your original post next time instead of duplicating a lot of stuff. That makes a ticket less readable. Also try creating the smallest possible example in the future - that makes it much easier to reproduce an issue. I was able to reproduce the issue with a simple message containing only:
Compilation passed but the following rostopic command failed:
The same for time. |
… when used as array (ros/ros_comm#252)
… when used as array (ros/ros_comm#252)
The pull request will fix the issue that you can currently not use Time and duration is some kind of hybrid builtin type. You can easily work around the problem by specifying the type in your message with the fuil message types:
You could use the same type for the non-array fields as well. But when filling the value with rostopic be aware that you need to explicitly mention the
|
Can you please verify that both the patched version of genpy (ros/genpy#14) and the workaround mentioned in the previous comment work for you? |
Well, it works when I remove the "data" field from the duration array from the auto-completion of rostopic pub ... #Duration ...
The data field is only generated by auto completion for undefined arrays for me at the moment. When I delete "data", it works. When I change the message to There is no "data" field in auto-complete and everything works just fine. So now there is only a bug in auto completion of rostopic, which seems to expect "std_msgs/Time" instead of "time" for undefined arrays |
What do you mean with "undefined arrays"? Arrays with dynamic size? |
Ehm yep exactly. |
fix issue with Time/Duration message fields when used as array (ros/ros_comm#252)
…y_if_available use TopicStatistics only if available
Currently stumbled upon this, I tried to send every built in message type in one message and those also in arrays. But it only works in rostopic when I remove the time and duration arrays from my message. Currently I do not have a cpp or python program, cause I only want to get the char array from that message with wireshark for developing rosc, so I can't say if anything else than rostopic is affected.
Command (it's the one suggested by autocomplete, just changed some values), it also does the same error with the unchanged suggestion. (ROS Version Groovy, Kubuntu 13.04)
rostopic pub /test rosc_linux_test/testbuiltin "tbi_int8: 2
tbi_int16: 3
tbi_int32: 40
tbi_int64: 50
tbi_uint8: 60
tbi_uint16: 70
tbi_uint32: 80
tbi_uint64: 90
tbi_float32: 30.40
tbi_float64: 120.20
tbi_bool: true
tbi_string: 'testing'
tbi_time: {secs: 1212, nsecs: 1212}
tbi_duration: {secs: 121, nsecs: 1}
tbi_int8_A: [1]
tbi_int16_A: [1, 2]
tbi_int32_A: [3,4]
tbi_int64_A: [8,9]
tbi_uint8_A: '45454'
tbi_uint16_A: [5]
tbi_uint32_A: [234, 234234]
tbi_uint64_A: [234234]
tbi_float32_A: [3.344, 2.344]
tbi_float64_A: [10815]
tbi_bool_A: [false]
tbi_string_A: ['narf']
tbi_time_A:
tbi_duration_A:
t_nbi_sub: {tbi_tm_bool: false, tbi_tm_int8: 1}
t_nbi_sub_A:
Traceback (most recent call last):
File "/opt/ros/groovy/bin/rostopic", line 35, in
rostopic.rostopicmain()
File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/init.py", line 1654, in rostopicmain
_rostopic_cmd_pub(argv)
File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/init.py", line 1330, in _rostopic_cmd_pub
argv_publish(pub, msg_class, pub_args, rate, options.once, options.verbose)
File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/init.py", line 1354, in argv_publish
publish_message(pub, msg_class, pub_args, rate, once, verbose=verbose)
File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/init.py", line 1224, in publish_message
genpy.message.fill_message_args(msg, pub_args, keys=keys)
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 513, in fill_message_args
_fill_message_args(msg, msg_args[0], keys, '')
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 461, in _fill_message_args
_fill_val(msg, f, v, keys, prefix)
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 425, in _fill_val
list_msg_class = get_message_class(base_type)
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 570, in get_message_class
cls = _get_message_or_service_class('msg', message_type, reload_on_error=reload_on_error)
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 532, in _get_message_or_service_class
raise ValueError("message type is missing package name: %s"%str(message_type))
ValueError: message type is missing package name: duration
The text was updated successfully, but these errors were encountered: