diff --git a/tests/rai_sim/conftest.py b/tests/rai_sim/conftest.py index 4eb05b0b..de6059a5 100644 --- a/tests/rai_sim/conftest.py +++ b/tests/rai_sim/conftest.py @@ -52,9 +52,23 @@ def sample_o3dexros2_config(tmp_path: Path) -> Path: yaml_content = """ binary_path: /path/to/binary robotic_stack_command: "ros2 launch robotic_stack.launch.py" - required_services: [] - required_topics: [] - required_actions: [] + required_binary_ros2_stack: + services: + - /spawn_entity + - /delete_entity + topics: + - /color_image5 + - /depth_image5 + - /color_camera_info5 + actions: [] + required_robotic_ros2_stack: + services: + - /grounding_dino_classify + - /grounded_sam_segment + - /manipulator_move_to + topics: [] + actions: + - /execute_trajectory """ file_path = tmp_path / "test_o3dexros2_config.yaml" file_path.write_text(yaml_content) diff --git a/tests/rai_sim/test_o3de_bridge.py b/tests/rai_sim/test_o3de_bridge.py index e0e63a61..f82ee003 100644 --- a/tests/rai_sim/test_o3de_bridge.py +++ b/tests/rai_sim/test_o3de_bridge.py @@ -45,6 +45,20 @@ def test_load_config(sample_base_yaml_config: Path, sample_o3dexros2_config: Pat assert isinstance(config, O3DExROS2SimulationConfig) assert config.binary_path == Path("/path/to/binary") assert config.robotic_stack_command == "ros2 launch robotic_stack.launch.py" + assert config.required_binary_ros2_stack == { + "services": ["/spawn_entity", "/delete_entity"], + "topics": ["/color_image5", "/depth_image5", "/color_camera_info5"], + "actions": [], + } + assert config.required_robotic_ros2_stack == { + "services": [ + "/grounding_dino_classify", + "/grounded_sam_segment", + "/manipulator_move_to", + ], + "topics": [], + "actions": ["/execute_trajectory"], + } assert isinstance(config.entities, list) assert all(isinstance(e, Entity) for e in config.entities) @@ -83,9 +97,8 @@ def setUp(self): binary_path=Path("/path/to/binary"), robotic_stack_command="ros2 launch robot.launch.py", entities=[self.test_entity], - required_actions=[], - required_services=[], - required_topics=[], + required_binary_ros2_stack={"services": [], "topics": [], "actions": []}, + required_robotic_ros2_stack={"services": [], "topics": [], "actions": []}, ) def test_init(self): @@ -102,9 +115,7 @@ def test_launch_robotic_stack(self, mock_popen): mock_process.poll.return_value = None mock_process.pid = 54321 mock_popen.return_value = mock_process - - command = "ros2 launch robot.launch.py" - self.bridge._launch_robotic_stack(command) + self.bridge._launch_robotic_stack(self.test_config) mock_popen.assert_called_once_with(["ros2", "launch", "robot.launch.py"]) self.assertEqual(self.bridge.current_robotic_stack_process, mock_process) @@ -116,8 +127,7 @@ def test_launch_binary(self, mock_popen): mock_process.pid = 54322 mock_popen.return_value = mock_process - command = Path("/path/to/binary") - self.bridge._launch_binary(command) + self.bridge._launch_binary(self.test_config) mock_popen.assert_called_once_with(["/path/to/binary"]) self.assertEqual(self.bridge.current_sim_process, mock_process)