Skip to content

Commit 4b5f2f6

Browse files
committed
Add joint validation in Model class
1 parent 469f054 commit 4b5f2f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/adam/model/model.py

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def build(factory: ModelFactory, joints_name_list: List[str]) -> "Model":
3838
links = factory.get_links()
3939
frames = factory.get_frames()
4040

41+
# check if the joints in the list are in the model
42+
for joint_str in joints_name_list:
43+
if joint_str not in [joint.name for joint in joints]:
44+
raise ValueError(
45+
f"{joint_str} is not in the robot model. Check the joints_name_list"
46+
)
47+
4148
# set idx to the actuated joints
4249
for [idx, joint_str] in enumerate(joints_name_list):
4350
for joint in joints:

0 commit comments

Comments
 (0)