Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion protomotions/simulator/newton/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def _setup_robot(self) -> None:
self.robot_view = ArticulationView(
self.model,
pattern="robot",
include_joints=self._newton_dof_names.keys(),
include_joints=list(self._newton_dof_names.keys()),
include_links=self._body_names,
)

Expand Down
29 changes: 29 additions & 0 deletions protomotions/tests/test_newton_python3_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import ast
from pathlib import Path


NEWTON_SIMULATOR = (
Path(__file__).resolve().parents[1] / "simulator" / "newton" / "simulator.py"
)


def test_newton_articulation_view_receives_joint_name_sequence():
tree = ast.parse(NEWTON_SIMULATOR.read_text(), filename=str(NEWTON_SIMULATOR))
include_joints_values = [
keyword.value
for node in ast.walk(tree)
if isinstance(node, ast.Call)
and isinstance(node.func, ast.Name)
and node.func.id == "ArticulationView"
for keyword in node.keywords
if keyword.arg == "include_joints"
]

assert len(include_joints_values) == 1
value = include_joints_values[0]
assert isinstance(value, ast.Call)
assert isinstance(value.func, ast.Name)
assert value.func.id == "list"
7 changes: 7 additions & 0 deletions protomotions/train_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ def create_parser():

# Parse arguments first (argparse is safe, doesn't import torch)
import argparse # noqa: E402
import faulthandler # noqa: E402

faulthandler.enable()

from protomotions.utils.cli_utils import parse_bool # noqa: E402

parser = create_parser()
Expand All @@ -304,6 +308,9 @@ def create_parser():
# Now safe to import everything else including torch
from pathlib import Path # noqa: E402
import logging # noqa: E402

logging.basicConfig(level=logging.INFO, format="%(levelname)s:%(name)s: %(message)s")

from protomotions.utils.hydra_replacement import get_class # noqa: E402
import importlib.util # noqa: E402
import shutil # noqa: E402
Expand Down