-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The method below assumes the names of the dof include "QuatW" to handle quaternions properly in a model. We may need more abstraction if we want to handle other kind of simulators or enforce how ǹame_dofs̀ works.
@staticmethod
def _get_kinematics_based_names(nlp, var_type: str) -> list[str]:
"""
To modify the names of the variables added to the plots if there is quaternions
Parameters
----------
nlp: NonLinearProgram
A reference to the phase
var_type: str
A string that refers to the decision variable such as (q, qdot, qddot, tau, etc...)
Returns
----------
new_name: list[str]
The list of str to display on figures
"""
idx = nlp.phase_mapping.to_first.map_idx if nlp.phase_mapping else range(nlp.model.nb_q)
if nlp.model.nb_quaternions == 0:
new_names = [nlp.model.name_dofs[i] for i in idx]
else:
new_names = []
for i in nlp.phase_mapping.to_first.map_idx:
if nlp.model.name_dofs[i][-4:-1] == "Rot" or nlp.model.name_dofs[i][-6:-1] == "Trans":
new_names += [nlp.model.name_dofs[i]]
else:
if nlp.model.name_dofs[i][-5:] != "QuatW" and nlp.model.name_dofs[i] != "GlenoHumeral_3":
if var_type == "qdot":
new_names += [nlp.model.name_dofs[i][:-5] + "omega" + nlp.model.name_dofs[i][-1]]
elif var_type == "qddot":
new_names += [nlp.model.name_dofs[i][:-5] + "omegadot" + nlp.model.name_dofs[i][-1]]
elif var_type == "qdddot":
new_names += [nlp.model.name_dofs[i][:-5] + "omegaddot" + nlp.model.name_dofs[i][-1]]
elif var_type == "tau" or var_type == "taudot":
new_names += [nlp.model.name_dofs[i]]
return new_namesReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request