Preserve installed operator workspace before consolidation

Local preservation snapshot, not a new deployment or simulation acceptance.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-08 09:59:51 +03:00
parent 97614742bb
commit d0e5f90952
368 changed files with 129172 additions and 1856 deletions
+47
View File
@@ -0,0 +1,47 @@
"""Own only upstream Nav2 processes; stop the group when any node exits."""
import argparse
import signal
import subprocess
import time
from pathlib import Path
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--parameters', type=Path, required=True)
args = parser.parse_args()
processes = []
stopped = False
def stop(signum, frame):
nonlocal stopped
stopped = True
signal.signal(signal.SIGTERM, stop)
signal.signal(signal.SIGINT, stop)
try:
for package, executable in (('nav2_planner', 'planner_server'),
('nav2_controller', 'controller_server'),
('nav2_behaviors', 'behavior_server')):
binary = '/opt/ndc_nav2/install/' + package + '/lib/' + package + '/' + executable
processes.append(subprocess.Popen(
[binary, '--ros-args', '--params-file', str(args.parameters), '-r',
'/cmd_vel:=/nav2/'+('behavior' if package=='nav2_behaviors' else 'controller')+'_cmd_vel']))
while not stopped and all(p.poll() is None for p in processes):
time.sleep(.05)
if not stopped:
raise RuntimeError('A required Nav2 node exited')
finally:
for process in processes:
if process.poll() is None:
process.terminate()
for process in processes:
try:
process.wait(timeout=3)
except subprocess.TimeoutExpired:
process.kill()
process.wait(timeout=3)
if __name__ == '__main__':
main()