Skip to content

Commit 7554e6b

Browse files
committed
Fix cached property import
1 parent c8eba78 commit 7554e6b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

roboticstoolbox/robot/ETS.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
from collections import UserList
9-
from functools import lru_cache, cached_property
109
from numpy import (
1110
pi,
1211
where,
@@ -44,9 +43,19 @@
4443
from spatialmath.base import getvector
4544
from spatialmath import SE3
4645
from typing import Union, overload, List, Set
46+
from sys import version_info
4747

4848
ArrayLike = Union[list, ndarray, tuple, set]
4949

50+
py_ver = version_info
51+
52+
if version_info >= (3, 9):
53+
from functools import cached_property
54+
55+
c_property = cached_property
56+
else:
57+
c_property = property
58+
5059

5160
class BaseETS(UserList):
5261
def __init__(self, *args):
@@ -238,7 +247,7 @@ def jindex_set(self) -> Set[int]: #
238247
"""
239248
return set([self[j].jindex for j in self.joint_idx()]) # type: ignore
240249

241-
@cached_property
250+
@c_property
242251
def jindices(self) -> ndarray:
243252
"""
244253
Get an array of joint indices
@@ -255,7 +264,7 @@ def jindices(self) -> ndarray:
255264
"""
256265
return array([self[j].jindex for j in self.joints()]) # type: ignore
257266

258-
@cached_property
267+
@c_property
259268
def qlim(self):
260269
r"""
261270
Joint limits

0 commit comments

Comments
 (0)