Skip to content

Commit

Permalink
expose rate-control-topic and rate-control-max-delay args to command …
Browse files Browse the repository at this point in the history
…line tool
  • Loading branch information
Jihoon Lee committed Mar 9, 2017
1 parent e014400 commit d1d1711
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/rosbag/src/rosbag/rosbag_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def play_cmd(argv):
parser.add_option("--pause-topics", dest="pause_topics", default=[], callback=handle_pause_topics, action="callback", help="topics to pause on during playback")
parser.add_option("--bags", help="bags files to play back from")
parser.add_option("--wait-for-subscribers", dest="wait_for_subscribers", default=False, action="store_true", help="wait for at least one subscriber on each topic before publishing")
parser.add_option("--rate-control-topic", dest="rate_control_topic", default='', type='str', help="watch the given topic, and if the last publish was more than <rate-control-max-delay> ago, wait until the topic publishes again to continue playback")
parser.add_option("--rate-control-max-delay", dest="rate_control_max_delay", default=1.0, type='float', help="maximum time difference from <rate-control-topic> before pausing")

(options, args) = parser.parse_args(argv)

Expand Down Expand Up @@ -269,6 +271,12 @@ def play_cmd(argv):
if options.topics or options.pause_topics:
cmd.extend(['--bags'])

if options.rate_control_topic:
cmd.extend(['--rate-control-topic', str(options.rate_control_topic)])

if options.rate_control_max_delay:
cmd.extend(['--rate-control-max-delay', str(options.rate_control_max_delay)])

cmd.extend(args)

old_handler = signal.signal(
Expand Down

0 comments on commit d1d1711

Please sign in to comment.