Skip to content

Commit 9c88884

Browse files
shuheng-liuCopilot
andauthored
fix: guard type of states names in info.json (#123)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 292085a commit 9c88884

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/opentau/scripts/visualize_dataset.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ def visualize_dataset(
222222
if joint_names is None:
223223
joint_names = dataset.meta.info.get("features", {}).get("observation.state", {}).get("names", [])
224224

225+
# Guard against invalid state names from info.json (ensure it's a list of strings)
226+
if not (isinstance(joint_names, list) and all(isinstance(name, str) for name in joint_names)):
227+
logging.warning(
228+
"Invalid joint_names type in info.json: %s. Expected list of strings. Using numeric indices instead.",
229+
type(joint_names),
230+
)
231+
joint_names = []
232+
225233
if urdf:
226234
rr.log_file_from_path(urdf, static=True)
227235
urdf_tree = rr.urdf.UrdfTree.from_file_path(urdf)

0 commit comments

Comments
 (0)