Command line: rostopic pub - why is required specify a topic type?
I'm unsure why i must specify a rostopic type, while invoke a rostopic pub
command.
rostopic pub /topic type [args...]
I think, that a message type can be deduced by internal call a rostopic info
on a rostopic name.
So, after all you can improve your rosbash file to deduct the topic type
# rosbash
778 pub)
779 if [[ $COMP_CWORD == 2 ]]; then
780 opts=`rostopic list 2> /dev/null`
781 COMPREPLY=($(compgen -W "$opts" -- ${arg}))
782 elif [[ $COMP_CWORD == 3 ]]; then
783 opts=`_msg_opts ${COMP_WORDS[$COMP_CWORD]}`
784 COMPREPLY=($(compgen -W "$opts" -- ${arg}))
changing the line 783 to:
opts=`rostopic info ${COMP_WORDS[$COMP_CWORD-1]} | head -n 1 | awk '{print $2}'`
or after mig advice:
opts=`rostopic info ${COMP_WORDS[$COMP_CWORD-1]} 2> /dev/null | head -n 1 | awk '{print $2}'`
if [ -z $opts ]; then
opts=`_msg_opts ${COMP_WORDS[$COMP_CWORD]}`
fi
Please correct my misunderstanding about a rostopic pub.