赞
踩
录制声呐数据包和启动结束各个模块大同小异,不多赘述了,核心代码位于control_center.py。
- # start record data...
- elif recvmsg[0:4] == self.start_rec_bag_msg[0:4]:
- if not self.record_state:
- self.record_state = True
- cur_time = time.time()
- cur_time = str(cur_time).replace('.','_')
- self.record_cmd = 'cd ~/yolov5_humble_fls_tcp/record_data && source ~/yolov5_humble_fls_tcp/install/setup.bash && ros2 bag record -o ' + cur_time + ' ' + self.sonar_image_topic
- self.record_subprocess = subprocess.Popen(self.record_cmd, shell=True, executable="/bin/bash")
- else:
- print("bag data is recording...")
-
- # finish record data...
- elif recvmsg[0:4] == self.finish_rec_bag_msg[0:4]:
- if self.record_state:
- self.record_cmd = shlex.split(self.record_cmd)
- record_index = self.record_cmd.index('record')
- for proc in psutil.process_iter():
- if "record" in proc.name() and set(self.record_cmd[record_index+1:]).issubset(proc.cmdline()):
- proc.send_signal(subprocess.signal.SIGINT)
- self.record_subprocess.send_signal(subprocess.signal.SIGINT)
数据包储存于/yolov5_humble_fls_tcp/record_data目录下,以开始录制的时间戳为文件名。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。