From 37e2c61b85fa6fc34412bfb55b539a72839e10d4 Mon Sep 17 00:00:00 2001
From: Carlos Mastalli <carlos.mastalli@gmail.com>
Date: Sun, 28 Jan 2024 01:00:42 +0000
Subject: [PATCH] [robots] Store urdf path in robot

---
 python/example_robot_data/robots_loader.py | 2 ++
 unittest/test_load.py                      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/python/example_robot_data/robots_loader.py b/python/example_robot_data/robots_loader.py
index 2fe0f32..3f8ce30 100644
--- a/python/example_robot_data/robots_loader.py
+++ b/python/example_robot_data/robots_loader.py
@@ -143,6 +143,8 @@ class RobotLoader(object):
         else:
             self.srdf_path = None
             self.robot.q0 = pin.neutral(self.robot.model)
+        root = getModelPath(self.path)
+        self.robot.urdf = join(root, self.path, self.urdf_subpath, self.urdf_filename)
 
         if self.free_flyer:
             self.addFreeFlyerJointLimits()
diff --git a/unittest/test_load.py b/unittest/test_load.py
index a7fb877..f1373f9 100755
--- a/unittest/test_load.py
+++ b/unittest/test_load.py
@@ -17,6 +17,7 @@ class RobotTestCase(unittest.TestCase):
         self.assertEqual(robot.model.nq, expected_nq)
         self.assertEqual(robot.model.nv, expected_nv)
         self.assertTrue(hasattr(robot, "q0"))
+        self.assertTrue(hasattr(robot, "urdf"))
         if pybullet:
             self.check_pybullet(urdf, one_kg_bodies)
 
-- 
GitLab