From 0c51ed8d3bb5080dd0376dc6b8574bd69fb54ca4 Mon Sep 17 00:00:00 2001 From: Ishan1923 <148351455+Ishan1923@users.noreply.github.com> Date: Sun, 17 Aug 2025 02:53:03 +0530 Subject: [PATCH 1/3] feat(config): Switch work order files from JSON to YAML --- nexus_demos/README.md | 4 +-- nexus_demos/config/pick_and_place.json | 29 ---------------------- nexus_demos/config/pick_and_place.yaml | 14 +++++++++++ nexus_demos/config/pick_from_conveyor.json | 17 ------------- nexus_demos/config/pick_from_conveyor.yaml | 8 ++++++ nexus_demos/config/place_on_conveyor.json | 17 ------------- nexus_demos/config/place_on_conveyor.yaml | 8 ++++++ 7 files changed, 32 insertions(+), 65 deletions(-) delete mode 100644 nexus_demos/config/pick_and_place.json create mode 100644 nexus_demos/config/pick_and_place.yaml delete mode 100644 nexus_demos/config/pick_from_conveyor.json create mode 100644 nexus_demos/config/pick_from_conveyor.yaml delete mode 100644 nexus_demos/config/place_on_conveyor.json create mode 100644 nexus_demos/config/place_on_conveyor.yaml diff --git a/nexus_demos/README.md b/nexus_demos/README.md index 32e6c343..8f2739b2 100644 --- a/nexus_demos/README.md +++ b/nexus_demos/README.md @@ -54,12 +54,12 @@ ros2 launch nexus_demos workcell.launch.py workcell_id:=workcell_2 ros_domain_id `place_on_conveyor` work order: ```bash -ros2 action send_goal /system_orchestrator/execute_order nexus_orchestrator_msgs/action/ExecuteWorkOrder "{order: {work_order_id: '23', work_order: '$(cat config/place_on_conveyor.json)'}}" +ros2 action send_goal /system_orchestrator/execute_order nexus_orchestrator_msgs/action/ExecuteWorkOrder "{order: {work_order_id: '23', work_order: '$(cat config/place_on_conveyor.yaml)'}}" ``` `pick_from_conveyor` work order: ```bash -ros2 action send_goal /system_orchestrator/execute_order nexus_orchestrator_msgs/action/ExecuteWorkOrder "{order: {work_order_id: '24', work_order: '$(cat config/pick_from_conveyor.json)'}}" +ros2 action send_goal /system_orchestrator/execute_order nexus_orchestrator_msgs/action/ExecuteWorkOrder "{order: {work_order_id: '24', work_order: '$(cat config/pick_from_conveyor.yaml)'}}" ``` ## Debugging diff --git a/nexus_demos/config/pick_and_place.json b/nexus_demos/config/pick_and_place.json deleted file mode 100644 index c00fccf1..00000000 --- a/nexus_demos/config/pick_and_place.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "workInstructionName": "Pick and Place", - "steps": [ - { - "processId": "place_on_conveyor", - "outputItems": [ - { - "guid": "productA", - "metadata": { - "quantity": 1, - "state": "state_1" - } - } - ] - }, - { - "processId": "pick_from_conveyor", - "inputItems": [ - { - "guid": "productA", - "metadata": { - "quantity": 1, - "state": "state_1" - } - } - ] - } - ] -} diff --git a/nexus_demos/config/pick_and_place.yaml b/nexus_demos/config/pick_and_place.yaml new file mode 100644 index 00000000..ae8dc106 --- /dev/null +++ b/nexus_demos/config/pick_and_place.yaml @@ -0,0 +1,14 @@ +workInstructionName: "Pick and Place" +steps: + - processId: "place_on_conveyor" + outputItems: + - guid: "productA" + metadata: + quantity: 1 + state: "state_1" + - processId: "pick_from_conveyor" + inputItems: + - guid: "productA" + metadata: + quantity: 1 + state: "state_1" \ No newline at end of file diff --git a/nexus_demos/config/pick_from_conveyor.json b/nexus_demos/config/pick_from_conveyor.json deleted file mode 100644 index 81f912cf..00000000 --- a/nexus_demos/config/pick_from_conveyor.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "workInstructionName": "Pick from conveyor", - "steps": [ - { - "processId": "pick_from_conveyor", - "inputItems": [ - { - "guid": "productA", - "metadata": { - "quantity": 1, - "state": "state_1" - } - } - ] - } - ] -} diff --git a/nexus_demos/config/pick_from_conveyor.yaml b/nexus_demos/config/pick_from_conveyor.yaml new file mode 100644 index 00000000..ab8cd4e6 --- /dev/null +++ b/nexus_demos/config/pick_from_conveyor.yaml @@ -0,0 +1,8 @@ +workInstructionName: "Pick from conveyor" +steps: + - processId: "pick_from_conveyor" + inputItems: + - guid: "productA" + metadata: + quantity: 1 + state: "state_1" \ No newline at end of file diff --git a/nexus_demos/config/place_on_conveyor.json b/nexus_demos/config/place_on_conveyor.json deleted file mode 100644 index 2fed6635..00000000 --- a/nexus_demos/config/place_on_conveyor.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "workInstructionName": "Place on conveyor", - "steps": [ - { - "processId": "place_on_conveyor", - "outputItems": [ - { - "guid": "productA", - "metadata": { - "quantity": 1, - "state": "state_1" - } - } - ] - } - ] -} diff --git a/nexus_demos/config/place_on_conveyor.yaml b/nexus_demos/config/place_on_conveyor.yaml new file mode 100644 index 00000000..fdcb18c1 --- /dev/null +++ b/nexus_demos/config/place_on_conveyor.yaml @@ -0,0 +1,8 @@ +workInstructionName: "Place on conveyor" +steps: + - processId: "place_on_conveyor" + outputItems: + - guid: "productA" + metadata: + quantity: 1 + state: "state_1" \ No newline at end of file From f5dcad0586c739816dc319d508bc9760dc9b5fbe Mon Sep 17 00:00:00 2001 From: Ishan1923 <148351455+Ishan1923@users.noreply.github.com> Date: Wed, 27 Aug 2025 05:34:31 +0530 Subject: [PATCH 2/3] feat(config): Switch work order files to YAML Updated demo tests, configs, and dependencies to handle YAML format as per review. --- nexus_demos/config/pick_and_place.yaml | 3 ++- nexus_demos/config/pick_from_conveyor.yaml | 3 ++- nexus_demos/config/place_on_conveyor.yaml | 3 ++- nexus_demos/package.xml | 3 +++ nexus_demos/test_invalid_place_on_conveyor.py | 2 +- nexus_demos/test_parallel_duplicated_wo.py | 4 ++-- nexus_demos/test_parallel_pick_and_place_rmf.py.disabled | 2 +- nexus_demos/test_parallel_wo.py | 4 ++-- nexus_demos/test_pick_and_place.py | 2 +- nexus_demos/test_pick_and_place_rmf.py | 2 +- 10 files changed, 17 insertions(+), 11 deletions(-) diff --git a/nexus_demos/config/pick_and_place.yaml b/nexus_demos/config/pick_and_place.yaml index ae8dc106..cce20624 100644 --- a/nexus_demos/config/pick_and_place.yaml +++ b/nexus_demos/config/pick_and_place.yaml @@ -11,4 +11,5 @@ steps: - guid: "productA" metadata: quantity: 1 - state: "state_1" \ No newline at end of file + state: "state_1" + \ No newline at end of file diff --git a/nexus_demos/config/pick_from_conveyor.yaml b/nexus_demos/config/pick_from_conveyor.yaml index ab8cd4e6..30baa289 100644 --- a/nexus_demos/config/pick_from_conveyor.yaml +++ b/nexus_demos/config/pick_from_conveyor.yaml @@ -5,4 +5,5 @@ steps: - guid: "productA" metadata: quantity: 1 - state: "state_1" \ No newline at end of file + state: "state_1" + \ No newline at end of file diff --git a/nexus_demos/config/place_on_conveyor.yaml b/nexus_demos/config/place_on_conveyor.yaml index fdcb18c1..79ae4574 100644 --- a/nexus_demos/config/place_on_conveyor.yaml +++ b/nexus_demos/config/place_on_conveyor.yaml @@ -5,4 +5,5 @@ steps: - guid: "productA" metadata: quantity: 1 - state: "state_1" \ No newline at end of file + state: "state_1" + \ No newline at end of file diff --git a/nexus_demos/package.xml b/nexus_demos/package.xml index 885aa85a..5986a139 100644 --- a/nexus_demos/package.xml +++ b/nexus_demos/package.xml @@ -67,6 +67,9 @@ ament_index_cpp rcpputils + + python3-yaml + ament_cmake diff --git a/nexus_demos/test_invalid_place_on_conveyor.py b/nexus_demos/test_invalid_place_on_conveyor.py index 0391e149..957e8c5a 100644 --- a/nexus_demos/test_invalid_place_on_conveyor.py +++ b/nexus_demos/test_invalid_place_on_conveyor.py @@ -68,7 +68,7 @@ async def test_abort_invalid_place_on_conveyor_wo(self): self.action_client.wait_for_server() goal_msg = ExecuteWorkOrder.Goal() goal_msg.order.work_order_id = "1" - with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.json") as f: + with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.yaml") as f: goal_msg.order.work_order = f.read() feedbacks: list[ExecuteWorkOrder.Feedback] = [] fb_fut = Future() diff --git a/nexus_demos/test_parallel_duplicated_wo.py b/nexus_demos/test_parallel_duplicated_wo.py index 8b3198fc..c85c5478 100644 --- a/nexus_demos/test_parallel_duplicated_wo.py +++ b/nexus_demos/test_parallel_duplicated_wo.py @@ -66,7 +66,7 @@ async def test_reject_jobs_over_max(self): """ goal_msg = ExecuteWorkOrder.Goal() goal_msg.order.work_order_id = "1" - with open(f"{os.path.dirname(__file__)}/config/pick_and_place.json") as f: + with open(f"{os.path.dirname(__file__)}/config/pick_and_place.yaml") as f: goal_msg.order.work_order = f.read() goal_handle = cast( ClientGoalHandle, await self.action_client.send_goal_async(goal_msg) @@ -75,7 +75,7 @@ async def test_reject_jobs_over_max(self): goal_msg_2 = ExecuteWorkOrder.Goal() goal_msg_2.order.work_order_id = "2" - with open(f"{os.path.dirname(__file__)}/config/pick_and_place.json") as f: + with open(f"{os.path.dirname(__file__)}/config/pick_and_place.yaml") as f: goal_msg_2.order.work_order = f.read() goal_handle_2 = cast( ClientGoalHandle, await self.action_client.send_goal_async(goal_msg_2) diff --git a/nexus_demos/test_parallel_pick_and_place_rmf.py.disabled b/nexus_demos/test_parallel_pick_and_place_rmf.py.disabled index 018f0761..dcd0d1bd 100644 --- a/nexus_demos/test_parallel_pick_and_place_rmf.py.disabled +++ b/nexus_demos/test_parallel_pick_and_place_rmf.py.disabled @@ -78,7 +78,7 @@ class ParallelPickAndPlaceRmfTest(NexusTestCase): self.action_client.wait_for_server() goal_msg = ExecuteWorkOrder.Goal() - with open(f"{os.path.dirname(__file__)}/config/pick_and_place.json") as f: + with open(f"{os.path.dirname(__file__)}/config/pick_and_place.yaml") as f: goal_msg.order.work_order = f.read() # First goal diff --git a/nexus_demos/test_parallel_wo.py b/nexus_demos/test_parallel_wo.py index 265c4cfc..6a7ec98b 100644 --- a/nexus_demos/test_parallel_wo.py +++ b/nexus_demos/test_parallel_wo.py @@ -66,7 +66,7 @@ async def test_reject_jobs_over_max(self): """ goal_msg = ExecuteWorkOrder.Goal() goal_msg.order.work_order_id = "1" - with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.json") as f: + with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.yaml") as f: goal_msg.order.work_order = f.read() goal_handle = cast( ClientGoalHandle, await self.action_client.send_goal_async(goal_msg) @@ -75,7 +75,7 @@ async def test_reject_jobs_over_max(self): goal_msg_2 = ExecuteWorkOrder.Goal() goal_msg_2.order.work_order_id = "2" - with open(f"{os.path.dirname(__file__)}/config/pick_from_conveyor.json") as f: + with open(f"{os.path.dirname(__file__)}/config/pick_from_conveyor.yaml") as f: goal_msg_2.order.work_order = f.read() goal_handle_2 = cast( ClientGoalHandle, await self.action_client.send_goal_async(goal_msg_2) diff --git a/nexus_demos/test_pick_and_place.py b/nexus_demos/test_pick_and_place.py index e138c939..5d34c6a6 100644 --- a/nexus_demos/test_pick_and_place.py +++ b/nexus_demos/test_pick_and_place.py @@ -68,7 +68,7 @@ async def test_pick_and_place_wo(self): self.action_client.wait_for_server() goal_msg = ExecuteWorkOrder.Goal() goal_msg.order.work_order_id = "1" - with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.json") as f: + with open(f"{os.path.dirname(__file__)}/config/place_on_conveyor.yaml") as f: goal_msg.order.work_order = f.read() feedbacks: list[ExecuteWorkOrder.Feedback] = [] fb_fut = Future() diff --git a/nexus_demos/test_pick_and_place_rmf.py b/nexus_demos/test_pick_and_place_rmf.py index 403983ff..89ab385a 100644 --- a/nexus_demos/test_pick_and_place_rmf.py +++ b/nexus_demos/test_pick_and_place_rmf.py @@ -75,7 +75,7 @@ async def test_pick_and_place_wo_with_rmf(self): self.action_client.wait_for_server() goal_msg = ExecuteWorkOrder.Goal() goal_msg.order.work_order_id = "1" - with open(f"{os.path.dirname(__file__)}/config/pick_and_place.json") as f: + with open(f"{os.path.dirname(__file__)}/config/pick_and_place.yaml") as f: goal_msg.order.work_order = f.read() feedbacks: list[ExecuteWorkOrder.Feedback] = [] fb_fut = Future() From 16284d0d252f5abc0efc4799ece9f42e8cfe5f69 Mon Sep 17 00:00:00 2001 From: Ishan1923 <148351455+Ishan1923@users.noreply.github.com> Date: Sat, 30 Aug 2025 01:17:31 +0530 Subject: [PATCH 3/3] style: remove stale comment and whitespace in YAML files. --- nexus_demos/config/pick_and_place.yaml | 1 - nexus_demos/config/pick_from_conveyor.yaml | 1 - nexus_demos/config/place_on_conveyor.yaml | 1 - nexus_demos/package.xml | 2 -- 4 files changed, 5 deletions(-) diff --git a/nexus_demos/config/pick_and_place.yaml b/nexus_demos/config/pick_and_place.yaml index cce20624..52123ec1 100644 --- a/nexus_demos/config/pick_and_place.yaml +++ b/nexus_demos/config/pick_and_place.yaml @@ -12,4 +12,3 @@ steps: metadata: quantity: 1 state: "state_1" - \ No newline at end of file diff --git a/nexus_demos/config/pick_from_conveyor.yaml b/nexus_demos/config/pick_from_conveyor.yaml index 30baa289..75d8ca4e 100644 --- a/nexus_demos/config/pick_from_conveyor.yaml +++ b/nexus_demos/config/pick_from_conveyor.yaml @@ -6,4 +6,3 @@ steps: metadata: quantity: 1 state: "state_1" - \ No newline at end of file diff --git a/nexus_demos/config/place_on_conveyor.yaml b/nexus_demos/config/place_on_conveyor.yaml index 79ae4574..6c7ad116 100644 --- a/nexus_demos/config/place_on_conveyor.yaml +++ b/nexus_demos/config/place_on_conveyor.yaml @@ -6,4 +6,3 @@ steps: metadata: quantity: 1 state: "state_1" - \ No newline at end of file diff --git a/nexus_demos/package.xml b/nexus_demos/package.xml index 5986a139..4bfbc4fc 100644 --- a/nexus_demos/package.xml +++ b/nexus_demos/package.xml @@ -66,8 +66,6 @@ ament_cmake_catch2 ament_index_cpp rcpputils - - python3-yaml