From 6d56181677fcbf5d93fdc354c993d0d1e82efed3 Mon Sep 17 00:00:00 2001 From: Bob McGrew Date: Wed, 25 Jan 2017 13:39:31 -0800 Subject: [PATCH] Added actuator_names and camera_names as properties. (#27) * Expose actuator names in the MjModel class. * Added camera_names as property. --- mujoco_py/mjcore.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mujoco_py/mjcore.py b/mujoco_py/mjcore.py index e2256286..4b62b21a 100644 --- a/mujoco_py/mjcore.py +++ b/mujoco_py/mjcore.py @@ -137,6 +137,18 @@ def numeric_names(self): return [ctypes.string_at(start_addr + int(inc)) for inc in self.name_numericadr.flatten()] + @property + def actuator_names(self): + start_addr = ctypes.addressof(self.names.contents) + return [ctypes.string_at(start_addr + int(inc)) + for inc in self.name_actuatoradr.flatten()] + + @property + def camera_names(self): + start_addr = ctypes.addressof(self.names.contents) + return [ctypes.string_at(start_addr + int(inc)) + for inc in self.name_camadr.flatten()] + class MjData(MjDataWrapper):