From 29abd23778b1f4c87263d4006fd4136a12517d83 Mon Sep 17 00:00:00 2001 From: atsushi421 Date: Fri, 13 Oct 2023 01:28:40 +0900 Subject: [PATCH] feat: add record-clock option Signed-off-by: atsushi421 --- ros2caret/verb/record.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ros2caret/verb/record.py b/ros2caret/verb/record.py index b70efedf..110c4240 100644 --- a/ros2caret/verb/record.py +++ b/ros2caret/verb/record.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import subprocess from typing import Optional @@ -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: @@ -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