Update workstation UI, ROS task control and device integration

This commit is contained in:
cheng
2026-10-20 15:46:13 +08:00
parent 2b74c50ba8
commit e5b06df6da
141 changed files with 91520 additions and 748 deletions
+22
View File
@@ -0,0 +1,22 @@
import os
import subprocess
from pathlib import Path
from unittest import TestCase
class RosDomainTest(TestCase):
def policy(self, **changes):
env={k:v for k,v in os.environ.items() if k not in ('REAL_ROS_DOMAIN_ID','REAL_ROS_LOCALHOST_ONLY')}
env.update(changes)
root=Path(__file__).resolve().parents[2]
return subprocess.run(['bash','-c','source "$1"; ros_domain_force_real || exit $?; printf "%s %s" "$ROS_DOMAIN_ID" "$ROS_LOCALHOST_ONLY"','bash',str(root/'scripts/lib/ros_domain.sh')],env=env,capture_output=True,text=True,timeout=3)
def test_inherited_global_and_simulation_domains_are_not_adopted(self):
for inherited in ('0','77','123'):
value=self.policy(ROS_DOMAIN_ID=inherited,ROS_LOCALHOST_ONLY='0')
self.assertEqual(value.returncode,0,value.stderr)
self.assertEqual(value.stdout,'42 1')
def test_explicit_override_and_invalid_values(self):
value=self.policy(REAL_ROS_DOMAIN_ID='231',REAL_ROS_LOCALHOST_ONLY='0')
self.assertEqual(value.stdout,'231 0')
for domain in ('-1','233','abc','77'):
self.assertNotEqual(self.policy(REAL_ROS_DOMAIN_ID=domain).returncode,0)