Skip to content

Commit 2f5adb5

Browse files
authored
Add policy as Artefacts param (#15)
1 parent e2608a2 commit 2f5adb5

8 files changed

Lines changed: 204 additions & 12 deletions

File tree

artefacts.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ jobs:
3434

3535
scenarios:
3636
settings:
37-
- name: report_based_waypoint_mission_test
38-
run: "uv run dataflow --test-waypoint-poses --policy stumbling"
39-
4037
- name: pose_based_waypoint_mission_test
41-
run: "uv run dataflow --test-waypoint-poses --policy complete"
38+
params:
39+
policy:
40+
- stumbling
41+
- baseline
42+
run: "uv run dataflow --test-waypoint-poses"
4243

dataflow/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies = [
1313
"teleop",
1414
"dora-rs-cli>=0.3.13",
1515
"typer>=0.20.0",
16+
"artefacts-toolkit>=0.7.1",
1617
]
1718

1819
[project.scripts]

dataflow/src/dataflow/dataflow.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import os
2-
import typer
2+
from pathlib import Path
3+
from typing import Optional
4+
35
import dora
6+
import typer
7+
from artefacts_toolkit.config import get_artefacts_params
48
from dora.builder import DataflowBuilder
59
from typing_extensions import Annotated
6-
from typing import Optional
7-
from pathlib import Path
810

911
workspace_path = Path(__file__).parent.parent.parent.parent
1012
nodes_path = workspace_path / "nodes"
@@ -75,7 +77,7 @@ def run_dataflow(
7577
help=(
7678
"Policy folder name inside 'policies' or absolute path. "
7779
f"Available: {', '.join(available_policy_folders) if available_policy_folders else 'none detected'}. "
78-
"Default: GO2_POLICY_PATH env or 'complete'."
80+
"Default: GO2_POLICY_PATH env or 'baseline'."
7981
)
8082
),
8183
] = None,
@@ -104,7 +106,14 @@ def run_dataflow(
104106
if not policy:
105107
policy = os.getenv("GO2_POLICY_PATH")
106108
if not policy:
107-
policy = "complete"
109+
policy = "baseline"
110+
111+
# Use the policy set with Artefacts parameters if available
112+
try:
113+
policy = get_artefacts_params().get("policy", policy)
114+
except Exception:
115+
# Not executing within Artefacts context
116+
pass
108117

109118
if policy in available_policy_folders:
110119
policy = policies_folder / policy
@@ -151,10 +160,13 @@ def run_dataflow(
151160
policy_controller.add_input("command_2d", "navigator/command_2d")
152161

153162
# Add the tester node
163+
junit_xml_path = (
164+
output_path / ".." / "tests_junit.xml"
165+
) # Save junit in the root outputs folder
154166
tester = dataflow.add_node(
155167
id="tester",
156168
path="pytest",
157-
args=f"{nodes_path / 'tester/tester' / test} -s --junit-xml={str(output_path / 'tests_junit.xml')}",
169+
args=f"{nodes_path / 'tester/tester' / test} -s --junit-xml={str(junit_xml_path)}",
158170
)
159171
tester.add_input("waypoints", "simulation/waypoints")
160172
tester.add_input("scene_info", "simulation/scene_info")

nodes/simulation/simulation/follow_camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, target_prim_path: str = "/World/Go2/Head_lower"):
1818
orientation=rot_utils.euler_angles_to_quats(
1919
np.array([0, 0, 0]), degrees=True
2020
),
21-
resolution=(1080 // 2, 720 // 2),
21+
resolution=(1080, 720),
2222
)
2323
self.camera.set_focal_length(1.8) # Same as the default perspective camera
2424
self.camera_location = np.array([0.0, 5.0, 2.0])

nodes/tester/tester/test_waypoints_poses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_receives_scene_info_on_startup(node):
1919

2020

2121
@pytest.mark.parametrize("difficulty", [0.1, 0.7, 1.1])
22-
@pytest.mark.clock_timeout(15)
22+
@pytest.mark.clock_timeout(30)
2323
def test_completes_waypoint_mission_with_variable_height_steps(node, difficulty: float):
2424
"""Test that the waypoint mission completes successfully.
2525

uv.lock

Lines changed: 178 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)