Skip to content

Commit

Permalink
Refactor model to use property for link number instead of post init
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulero committed Jan 2, 2025
1 parent 8ddbf04 commit c8adbbc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/adam/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ class Model:
NDoF: int
actuated_joints: list[str]

def __post_init__(self):
"""set the "length of the model as the number of links"""
self.N = len(self.links)
@property
def N(self) -> int:
"""
Returns:
int: the number of links in the model
"""
return len(self.links)

@staticmethod
def build(factory: ModelFactory, joints_name_list: list[str] = None) -> "Model":
Expand Down

0 comments on commit c8adbbc

Please sign in to comment.