Skip to content

Commit

Permalink
Default to 0, only default to 1 when using --times
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
  • Loading branch information
ivanpauno committed Jun 2, 2021
1 parent bf92afe commit 93cf847
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ros2topic/ros2topic/verb/pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ def add_arguments(self, parser, cli_name):
'-t', '--times', type=nonnegative_int, default=0,
help='Publish this number of times and then exit')
parser.add_argument(
'-w', '--wait-matching-subscriptions', type=nonnegative_int, default=1,
help='Wait until finding the specified number of matching subscriptions')
'-w', '--wait-matching-subscriptions', type=nonnegative_int, default=None,
help=(
'Wait until finding the specified number of matching subscriptions. '
'Defaults to 1 when using "-1"/"--once"/"--times", otherwise defaults to 0.'))
parser.add_argument(
'--keep-alive', metavar='N', type=positive_float, default=0.1,
help='Keep publishing node alive for N seconds after the last msg '
Expand Down Expand Up @@ -149,7 +151,8 @@ def main(args):
1. / args.rate,
args.print,
times,
args.wait_matching_subscriptions,
args.wait_matching_subscriptions
if args.wait_matching_subscriptions is not None else int(times != 0),
qos_profile,
args.keep_alive)

Expand Down

0 comments on commit 93cf847

Please sign in to comment.