Skip to content

Commit

Permalink
feat: add record-clock option
Browse files Browse the repository at this point in the history
Signed-off-by: atsushi421 <[email protected]>
  • Loading branch information
atsushi421 committed Oct 12, 2023
1 parent d60eebd commit 29abd23
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ros2caret/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import subprocess

from typing import Optional

Expand Down Expand Up @@ -149,6 +150,9 @@ def add_arguments(self, parser, cli_name):
parser.add_argument(
'--immediate', dest='immediate', action='store_true',
help='record immediately. ')
parser.add_argument(
'-c', '--record-clock', dest='record_clock', action='store_true',
help='launch the node where the /clock topic is stored to use ROS time. ')

def main(self, *, args):
if args.light_mode:
Expand Down Expand Up @@ -217,9 +221,15 @@ def _run():
def _fini():
node.stop_progress()
node.end()
if clock_recorder:
clock_recorder.terminate()
print('stopping & destroying tracing session')
lttng.lttng_fini(session_name=args.session_name)

if args.record_clock:
clock_recorder = subprocess.Popen('ros2 run caret_trace clock_recorder', shell=True)
else:
clock_recorder = None
execute_and_handle_sigint(_run, _fini)

return 0

0 comments on commit 29abd23

Please sign in to comment.