From b4436aa0efc74373add254d0aa0fd1b4cc1a53d0 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 26 Sep 2024 15:50:00 +0200 Subject: [PATCH] Fix export of color in material that is not child of robot tag --- urchin/urdf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/urchin/urdf.py b/urchin/urdf.py index e15b383..80e8a05 100644 --- a/urchin/urdf.py +++ b/urchin/urdf.py @@ -1054,10 +1054,13 @@ def _to_xml(self, parent, path): color.attrib["rgba"] = np.array2string(self.color)[1:-1] node.append(color) - # For non-top-level elements just save the material with a name else: node = ET.Element("material") node.attrib["name"] = self.name + if self.color is not None: + color = ET.Element("color") + color.attrib["rgba"] = np.array2string(self.color)[1:-1] + node.append(color) return node def copy(self, prefix="", scale=None):