From 4b5f2f65760568e9cc5f7c823cd2a477f1a8e0ec Mon Sep 17 00:00:00 2001 From: giulero Date: Mon, 11 Dec 2023 10:25:11 +0100 Subject: [PATCH] Add joint validation in Model class --- src/adam/model/model.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/adam/model/model.py b/src/adam/model/model.py index 9c1d5afe..fe5ef70d 100644 --- a/src/adam/model/model.py +++ b/src/adam/model/model.py @@ -38,6 +38,13 @@ def build(factory: ModelFactory, joints_name_list: List[str]) -> "Model": links = factory.get_links() frames = factory.get_frames() + # check if the joints in the list are in the model + for joint_str in joints_name_list: + if joint_str not in [joint.name for joint in joints]: + raise ValueError( + f"{joint_str} is not in the robot model. Check the joints_name_list" + ) + # set idx to the actuated joints for [idx, joint_str] in enumerate(joints_name_list): for joint in joints: