Skip to content
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 fix #2329

Open
wants to merge 3 commits into
base: melodic-devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tools/rostopic/src/rostopic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ def _rostopic_cmd_pub(argv):
# stdin/file input has a rate by default
if rate is None and not options.latch and not options.once:
rate = 10.
stdin_publish(pub, msg_class, rate, options.once, options.file, options.verbose)
stdin_publish(pub, msg_class, rate, options.once, options.file, options.verbose, substitute_keywords=options.substitute_keywords)
else:
argv_publish(pub, msg_class, pub_args, rate, options.once, options.verbose, substitute_keywords=options.substitute_keywords)

Expand Down Expand Up @@ -1939,7 +1939,7 @@ def param_publish(pub, msg_class, param_name, rate, verbose):
if rospy.is_shutdown():
break

def stdin_publish(pub, msg_class, rate, once, filename, verbose):
def stdin_publish(pub, msg_class, rate, once, filename, verbose, substitute_keywords):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def stdin_publish(pub, msg_class, rate, once, filename, verbose, substitute_keywords):
def stdin_publish(pub, msg_class, rate, once, filename, verbose, substitute_keywords=False):

As this is a library downstream code could be using, the old API must be retained.

"""
:param filename: name of file to read from instead of stdin, or ``None``, ``str``
"""
Expand Down Expand Up @@ -1974,7 +1974,8 @@ def stdin_publish(pub, msg_class, rate, once, filename, verbose):
# None, repeatedly publish it
if exactly_one_message and rate is not None:
print("Got one message and a rate, publishing repeatedly")
publish_message(pub, msg_class, pub_args, rate=rate, once=once, verbose=verbose)
publish_message(pub, msg_class, pub_args, rate=rate, once=once, verbose=verbose,
substitute_keywords=substitute_keywords)
# we use 'bool(r) or once' for the once value, which
# controls whether or not publish_message blocks and
# latches until exit. We want to block if the user
Expand All @@ -1983,7 +1984,8 @@ def stdin_publish(pub, msg_class, rate, once, filename, verbose):
# but, for now, this is the best re-use of the
# underlying methods.
else:
publish_message(pub, msg_class, pub_args, None, bool(r) or once, verbose=verbose)
publish_message(pub, msg_class, pub_args, None, bool(r) or once, verbose=verbose,
substitute_keywords=substitute_keywords)
except ValueError as e:
sys.stderr.write("%s\n"%str(e))
break
Expand Down