From cbf787df119baab2dffcbb30f40b02014405422e Mon Sep 17 00:00:00 2001 From: yuanhaonan Date: Sat, 14 Feb 2026 16:18:42 +0800 Subject: [PATCH] cached property --- embodichain/lab/gym/envs/embodied_env.py | 2 +- embodichain/lab/sim/objects/articulation.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/embodichain/lab/gym/envs/embodied_env.py b/embodichain/lab/gym/envs/embodied_env.py index f58850ec..f89621c7 100644 --- a/embodichain/lab/gym/envs/embodied_env.py +++ b/embodichain/lab/gym/envs/embodied_env.py @@ -575,7 +575,7 @@ def preview_sensor_data( cv2.imshow(window_name, cv2.cvtColor(view, cv2.COLOR_RGB2BGR)) cv2.waitKey(0) cv2.destroyWindow(window_name) - + elif method == "plt": from matplotlib import pyplot as plt diff --git a/embodichain/lab/sim/objects/articulation.py b/embodichain/lab/sim/objects/articulation.py index c5534432..d6ebe2aa 100644 --- a/embodichain/lab/sim/objects/articulation.py +++ b/embodichain/lab/sim/objects/articulation.py @@ -651,7 +651,7 @@ def __str__(self) -> str: parent_str = super().__str__() return parent_str + f" | dof: {self.dof} | num_links: {self.num_links}" - @property + @cached_property def dof(self) -> int: """Get the degree of freedom of the articulation. @@ -660,7 +660,7 @@ def dof(self) -> int: """ return self._data.dof - @property + @cached_property def num_links(self) -> int: """Get the number of links in the articulation. @@ -669,7 +669,7 @@ def num_links(self) -> int: """ return self._data.num_links - @property + @cached_property def link_names(self) -> List[str]: """Get the names of the links in the articulation. @@ -678,7 +678,7 @@ def link_names(self) -> List[str]: """ return self._data.link_names - @property + @cached_property def root_link_name(self) -> str: """Get the name of the root link of the articulation. @@ -687,7 +687,7 @@ def root_link_name(self) -> str: """ return self.entities[0].get_root_link_name() - @property + @cached_property def joint_names(self) -> List[str]: """Get the names of the actived joints in the articulation. @@ -696,7 +696,7 @@ def joint_names(self) -> List[str]: """ return self._entities[0].get_actived_joint_names() - @property + @cached_property def all_joint_names(self) -> List[str]: """Get the names of the joints in the articulation.