Commit e2d924bf authored by Olivier Lantsoght's avatar Olivier Lantsoght
Browse files

[MBsysPy] MbsData.qet_variable types function remove the 0 (invalid variable id) from given list.

parent fdd6c64e
......@@ -2110,8 +2110,9 @@ class MbsData(object):
"""
if isinstance(indices, (list, np.ndarray)):
# local list to avoid self-modification (ie. set all driven joints as independent)
local_indices = list(indices)
# Local list to avoid self-modification (ie. set all driven joints as independent)
# Removing index 0 from list (default value in MbsData::qu and other).
local_indices = list(filter(lambda q_i: q_i != 0, indices))
for index in local_indices:
libutilities.mbs_set_qu(self.mbs_data_ptr, index)
else:
......@@ -2127,8 +2128,9 @@ class MbsData(object):
The ids of the joints to set as dependent.
"""
if isinstance(indices, (list, np.ndarray)):
# local list to avoid self-modification (ie. set all independent to dependent)
local_indices = list(indices)
# Local list to avoid self-modification (ie. set all independent to dependent)
# Removing index 0 from list (default value in MbsData::qu and other).
local_indices = list(filter(lambda q_i: q_i != 0, indices))
for index in local_indices:
libutilities.mbs_set_qv(self.mbs_data_ptr, index)
else:
......@@ -2144,8 +2146,9 @@ class MbsData(object):
The ids of the joints to set as driven.
"""
if isinstance(indices, (list, np.ndarray)):
# local list to avoid self-modification (ie. set all independent to driven)
local_indices = list(indices)
# Local list to avoid self-modification (ie. set all independent to driven)
# Removing index 0 from list (default value in MbsData::qu and other).
local_indices = list(filter(lambda q_i: q_i != 0, indices))
for index in local_indices:
libutilities.mbs_set_qdriven(self.mbs_data_ptr, index)
else:
......@@ -2165,8 +2168,9 @@ class MbsData(object):
The ids of the joints to set as actuated.
"""
if isinstance(indices, (list, np.ndarray)):
# No need of local list
for index in indices:
# Removing index 0 from list (default value in MbsData::qu and other).
local_indices = list(filter(lambda q_i: q_i != 0, indices))
for index in local_indices:
libutilities.mbs_set_qa(self.mbs_data_ptr, index)
else:
libutilities.mbs_set_qa(self.mbs_data_ptr, indices)
......@@ -2182,7 +2186,8 @@ class MbsData(object):
"""
if isinstance(indices, (list, np.ndarray)):
# local list to avoid self-modification (ie. unset all qa)
local_indices = list(indices)
# Removing index 0 from list (default value in MbsData::qu and other).
local_indices = list(filter(lambda q_i: q_i != 0, indices))
for index in local_indices:
libutilities.mbs_unset_qa(self.mbs_data_ptr, index)
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment