MBsysPy.mbsyspy.mbs_data module¶
Main class for Multibody systems.
Summary¶
Define the class MbsData based on the MbsData structure of MBsysC. This class has the functions required to manipulate the Data (set the number of user constraints, set the independent or dependent variables…).
-
class
MBsysPy.mbsyspy.mbs_data.
MbsData
(name, user_path=None, symbolic_path=None, prj_functions_c=None, prj_lib_path=None)¶ Bases:
object
Class containing geometrical and dynamical information of robotran Mbs.
- Variables
body_id (dict) – Dictionary containing the names of the bodies as keys and their ids as values.
DonePart (int) – Flag that indicates if the coordinate partitioning module has been executed (default: 0=not done; 1=done).
DoneEquil (int) – Flag that indicates if the equilibrium module has been executed (default: 0=not done; 1=done).
DoneModal (int) – Flag that indicates if the modal module has been executed (default: 0=not done; 1=done).
dpt (numpy.ndarray) – Numpy array containing the coordinates of all anchor points in body fixed frame: [X_i,Y_i,Z_i] = dpt[1:4,i]
extforce_id (dict) – Dictionary containing the names of the extforces as keys and their ids as values.
Fl (numpy.ndarray) – Numpy array containing the current values of the forces on each link.
frc (numpy.ndarray) – Numpy array containing the components of the resultant external forces (in the body fixed frame) applied to the center of mass of each body.
g (numpy.ndarray) – The 3 gravity components in the inertial frame: g[1:4]=[g_x, g_y, g_z]
In (numpy.ndarray) – Numpy array containing the inertia tensor component of each body (in the body fixed frame, relative to the center of mass). For body k: In[1:10, k]=[I_11,I_12,I_13,I_21,I_22,I_23,I_31,I_32,I_33]
joint_id (dict) – Dictionary containing the names of the joints as keys and their ids as values.
l (numpy.ndarray) – Numpy array containing the center of mass coordinates in the body fixed frame. For body k: l[1:4, k]=[gc_x, gc_y, gc_z]
lambda_ (numpy.ndarray) – Numpy array containing the values of the Lagrange Multipliers related to the constraints. The sequence is the same sequence as the constraint definition.
link_id (dict) – Dictionary containing the names of the links as keys and their ids as values.
lrod (numpy.ndarray) – Numpy array containing the length of each rod.
m (numpy.ndarray) – Numpy array containing the mass of each body.
mbs_filename (str) – Path to mbs file including the file with the extension (.mbs).
mbs_name (str) – Filename of the mbs file (excluding path and “.mbs” extension).
nbody (int) – Number of bodies in the system. The fictitious bodies are not taken into account.
Ncons (int) – Number of algebraic constraints.
nhu (int) – Number of independent constraints.
njoint (int) – Number of joints in the system.
Nlink (int) – Number of forces acting between two points of the system.
Nloopc (int) – Number of loop constraints.
npt (int) – Number of anchor points.
nqa (int) – Number of actuated articulations.
nqc (int) – Number of driven articulations, it includes qlocked and qdriven.
nqdriven (int) – Number of driven articulations.
nqlocked (int) – Number of locked articulations.
nqu (int) – Number of independent articulations.
nqv (int) – Number of dependent articulations.
nqrot (int) – Number of rotational joint (R1, R2 or R3)
flag_stop (int) – Stop the simulation. For dirdyn, equil, invdyn and solvekin only.
flag_optim_symb_sin_cos (int) – allow the optimized computation of the sine/cosine w.r.t. the symbolic files. Needs specific symbolic files, i.e. Rtime flag to ON. For advanced use of Robotran Only ! default is 0.
NRerr (float) – Maximal error on constraint allowed in Newton-Raphson algorithm, default 1.0e-9.
MAX_NR_ITER (int) – Maximal number of iterations for NR procedure, default 100, default is 100.
n_rod (int) – Number of rod constraints defined on the system.
Nsensor (int) – Number of kinematic sensors.
Nuserc (int) – Number of user constraints.
Nux (int) – Number of user variable.
Nxfrc (int) – Number of points where an external force is applied into a body.
points_id (dict) – Dictionary containing the ids of the anchor points of each bodies. The first key is the body name and the second key is the anchor point name. The retrieve value is the id of the requested anchor point. Example: my_id = mbs_data.points_id[“body_1”][“point_0”]
process (int) –
- Flag that indicates which module is currently running:
1: partitioning
2: equilibrium
3: direct dynamic
4: modal
5: inverse kinematic
6: inverse dynamic
At loading the process is set to 1.
flag_stop – Stop the simulation. For dirdyn, equil, invdyn and solvekin only.
flag_safety_checks (int) – Flag to activate safety checks everywhere in mbsysc core. Faster computation if this flag is put to 0. default = 1.
zero_division_thrs (float) – Value from which a warning is raised if a division by zero (or close to) occurs. default 1.0e-9.
project_path (str) – Path to the mbs project folder.
q (numpy.ndarray) – Numpy array containing the current values of the generalized coordinates.
q0 (numpy.ndarray) – Numpy array containing the initial values of the generalized coordinates.
qa (numpy.ndarray of int) – Numpy array of integers containing the indices of actuated articulations (only for inverse dynamic). Those articulations are controlled by an actuator.
Qa (numpy.ndarray) – Numpy array containing the value of actuation forces.
qc (numpy.ndarray of int) – Numpy array of integers containing the indices of driven (locked and driven) articulations.
Qc (numpy.ndarray) – Numpy array containing the value of joint force introduced in driven joints to respect the user function. The driven forces/torques are saved in the entries given by index vector ‘qc’.
qd (numpy.ndarray) – Numpy array containing the current values of the generalized velocities.
qd0 (numpy.ndarray) – Numpy array containing the initial values of the generalized velocities.
qdd (numpy.ndarray) – Numpy array containing the current values of the generalized accelerations.
qdd0 (numpy.ndarray) – Numpy array containing the initial values of the generalized accelerations.
q_sin (numpy.ndarray) – Array with the sine values of the generalized coordinates, if rotational (if translational, contains ‘-2.0’), size = 1 x njoint
q_cos (numpy.ndarray) – Array with the cosine values of the generalized coordinates, if rotational (if translational, contains ‘-2.0’), size = 1 x njoint
qdriven (numpy.ndarray of int) – Numpy array of integers containing the indices of driven articulations. Those articulations are controlled by a user function: q[qdriven]=f(tsim)
qrot (numpy.ndarray of int) – Numpy array of integers containing the indices of the rotational articulations
qlocked (numpy.ndarray of int) – Numpy array of integers containing the indices of locked articulations. Those articulations have a constant position defined by the user: q[qlocked]=cte
Qq (numpy.ndarray) – Numpy array containing the values of the joint forces.
qu (numpy.ndarray of int) – Numpy array of integers containing the indices of the independent articulations.
qv (numpy.ndarray of int) – Numpy array of integers containing the indices of the dependent articulations.
sensor_id (dict) – Dictionary containing the names of the sensors as keys and their ids as values.
sensors (list of MbsSensor) – List containing one instance of MbsSensor (without defined id). User can append as many as needed sensor in the list. Sensors defined in this list can be used by the user for various computation.
SWr (numpy.ndarray) –
Numpy array containing the Swr vector for each external forces. for force k, Swr[k,1:10] = [Fx, Fy, Fz, Mx, My, Mz, dxF] with
Force components (expressed in the inertial frame) : Fx,Fy,Fz
Pure torque components (expressed in the inertial frame) : Mx,My,Mz
Application point local coordinates vector (expressed in the body fixed frame): dxF[1:4]
t0 (scalar) – Initial time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/invyn option at start of time simulation.
tf (scalar) – Final time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/invyn option at start of time simulation.
trq (numpy.ndarray) – Numpy array containing the components of the resultant external torques (pure torque and couple produced by forces displacement in the body fixed frame) applied to each body.
tsim (scalar) – The time value.
user_model (dict) – Dictionary containing the names of the user models as keys and a second dictionary with their parameters as values. The second dictionary contains the names of the parameters as keys and their values as values
ux (numpy.ndarray) – Numpy array containing the values of the user variables.
ux0 (numpy.ndarray) – Numpy array containing the initial values of the user variables.
uxd (numpy.ndarray) – Numpy array containing the values of the time derivative of the user variables.
xfidpt (numpy.ndarray of int) – Numpy array of integers containing the indices of the points defined as force application points.
Z (numpy.ndarray) – Numpy array containing the current values of the distances between of the points of a link.
Zd (numpy.ndarray) – Numpy array containing the current values of the speed (spreading) between of the points of a link.
opt_load_c (int) –
MBsysPy specific flag indicating if the project user and/or symbolic function are python modules or c-libraries:
0: Symbolic and user functions are Python modules.
1: Symbolic functions are loaded from a C library while and user functions are Python modules.
2: Symbolic and user functions are loaded from C libraries.
Examples
Here are some basic usages.
>>> mbs_data = MBsysPy.MbsData("../dataR/ExampleProject.mbs") >>> mbs_data.user_model["MyUserModel"]["MyScalar"] = 3.0 >>> mbs_msg(mbs_data.user_model["MyUserModel"]["MyScalar"]) 3.0 >>> # Get a copy of the scalar >>> a = mbs_data.user_model["MyUserModel"]["MyScalar"] >>> a = 2 >>> mbs_msg(mbs_data.user_model["MyUserModel"]["MyScalar"]) 3.0 >>> print(mbs_data.user_model["MyUserModel"]["MyVector"]) array([1.0, 3.0]) >>> mbs_data.user_model["MyUserModel"]["MyVector"] = [1.0, 2.0] >>> print(mbs_data.user_model["MyUserModel"]["MyVector"]) array([1.0, 2.0]) >>> b = mbs_data.user_model["MyUserModel"]["MyVector"] >>> b[1] = 10.0 >>> print(mbs_data.user_model["MyUserModel"]["MyVector"]) array([1.0, 10.0]) >>> b = np.array([2.0, 4.0]) >>> print(mbs_data.user_model["MyUserModel"]["MyVector"]) array([1.0, 10.0])
The usage of C-structures is a bit more complex. This is mainly used in the case of using a external C-library doing computation on the structure. Such structures must be allocated by the user, either in the c function user_load_post() (requires ‘prj_functions_c=”SU”’) or in python script.
it is assumed that the user model [‘um’][‘struct’] is dedicated to structure named ‘my_struc’.
>>> import ctypes >>> class MyStruct(ctypes.Structure): ... _fields_ = [("x", ctypes.c_int), ... ("y", ctypes.c_int)] ... >>> my_struct_ptr = ctypes.pointer(MyStruct(10, 20)) >>> mbs_data.user_model['um']['struct'] = my_struct_ptr ... # If using C library for user function, the structure is ready to use. ... # To retrieve the structure object (and not the pointer to it) and contents ... # for further modifications see next lines. >>> my_struct = MyStruct.from_address(mbs_data.user_model['um']['struct']) >>> my_struct.x = 127
In this example, a pointer to MyStruct instance was created. However the python object of the structure is retrieved, allowing easy fields access.
- Attributes
DoneEquil
Access to DoneEquil attribute (read-write).
DoneModal
Access to DoneModal attribute (read-only).
DonePart
Access to DonePart attribute (read-only).
Fl
Access to Fl attribute, only value in the vector can be written.
In
Access to In attribute, only value in the matrix can be written.
Jac_user
Access to Jac_user attribute, only value in the matrix can be written.
MAX_NR_ITER
Access to MAX_NR_ITER attribute (read-write).
NRerr
Access to NRerr attribute (read-write).
Ncons
Access to Ncons attribute (read-only).
Nlink
Access to Nlink attribute (read-only).
Nlink3D
Access to Nlink3D attribute (read-only).
Nloopc
Access to Nloopc attribute (read-only).
Nsensor
Access to Nsensor attribute (read-only).
Nuser_model
Access to Nuser_model attribute (read-only).
Nuserc
Access to Nuserc attribute (read-only).
Nux
Access to Nux attribute (read-only).
Nxfrc
Access to Nxfrc attribute (read-only).
Qa
Access to Qa attribute, only value in the vector can be written.
Qc
Access to Qc attribute, only value in the vector can be written.
Qq
Access to Qq attribute, only value in the vector can be written.
SWr
Access to SWr attribute, only value in the matrix can be written.
Z
Access to Z attribute, only value in the vector can be written.
Zd
Access to Zd attribute, only value in the vector can be written.
build_path
Access to build_path attribute (read-only).
dpt
Access to dpt attribute, only value in the matrix can be written.
flag_optim_symb_sin_cos
Access to flag_optim_symb_sin_cos attribute (read-write).
flag_safety_checks
Access to flag_safety_checks attribute (read-write).
flag_stop
Access to flag_stop attribute (read-write).
frc
Access to frc attribute, only value in the matrix can be written.
g
Access to g attribute, only value in the vector can be written.
hu
Access to hu attribute, values should not be modified.
jdqd_user
Access to jdqd_user attribute, only value in the vector can be written.
l
Access to l attribute, only value in the matrix can be written.
l3DWr
Access to l3DWr attribute, only value in the matrix can be written.
lambda_
Access to lambda_ attribute, only value in the vector can be written.
lrod
Access to lrod attribute, only value in the vector can be written.
m
Access to m attribute, only value in the vector can be written.
mbs_filename
Access to mbs_filename attribute (read-only).
mbs_name
Access to mbs_name attribute (read-only).
n_rod
Access to n_rod attribute (read-only).
nbody
Access to nbody attribute (read-only).
nhu
Access to nhu attribute (read-only).
njoint
Access to njoint attribute (read-only).
npt
Access to npt attribute (read-only).
nqa
Access to nqa attribute (read-only).
nqc
Access to nqc attribute (read-only).
nqdriven
Access to nqdriven attribute (read-only).
nqlocked
Access to nqlocked attribute (read-only).
nqrot
Access to nqrot attribute (read-only).
nqu
Access to nqu attribute (read-only).
nqv
Access to nqv attribute (read-only).
process
Access to process attribute (read-write).
project_path
Access to project_path attribute (read-only).
q
Access to q attribute, only value in the vector can be written.
q0
Access to q0 attribute, only value in the vector can be written.
q_cos
Access to q_cos attribute, values should not be modified.
q_sin
Access to q_sin attribute, values should not be modified.
qa
Access to qa attribute, values should not be modified.
qc
Access to qc attribute, values should not be modified.
qd
Access to qd attribute, only value in the vector can be written.
qd0
Access to qd0 attribute, only value in the vector can be written.
qdd
Access to qdd attribute, only value in the vector can be written.
qdd0
Access to qdd0 attribute, only value in the vector can be written.
qdriven
Access to qdriven attribute, values should not be modified.
qlocked
Access to qlocked attribute, values should not be modified.
qrot
Access to qrot attribute, values should not be modified.
qu
Access to qu attribute, values should not be modified.
qv
Access to qv attribute, values should not be modified.
t0
Access to t0 attribute (read-write).
tf
Access to tf attribute (read-write).
trq
Access to trq attribute, only value in the matrix can be written.
tsim
Access to tsim attribute (read-write).
udd
Access to udd attribute, only value in the vector can be written.
ux
Access to ux attribute, only value in the vector can be written.
ux0
Access to ux0 attribute, only value in the vector can be written.
uxd
Access to uxd attribute, only value in the vector can be written.
xfidpt
Access to xfidpt attribute, values should not be modified.
zero_division_thrs
Access to zero_division_thrs attribute (read-write).
Methods
define_output_vector
(self, label, size)Initialize the memory for a vector as output.
empty_qa
(self)Remove all joints from the actuated partition.
exe_dirdyn
(self, **kwargs)Run a dirdyn module with a specified set of options.
exe_equil
(self, **kwargs)Run a equil module with a specified set of options.
exe_invdyn
(self, **kwargs)Run a invdyn module with a specified set of options.
exe_modal
(self, **kwargs)Run a modal module with a specified set of options.
exe_part
(self, **kwargs)Run a partitioning module with the specified set of options.
exe_solvekin
(self, **kwargs)Run a solvekin module with a specified set of options.
load_state
(self[, baseFileName, …])Load a state to MbsData instance from files for specific time.
Print the joint configuration.
reset
(self[, verbose])Reset mbs_data fields to its inital value.
set_nb_userc
(self, nb)Set the number of user constraints.
set_output
(self, value, label)Save a value during time integration.
set_output_value
(self, value, val_index, label)Send a value at a specific location of an output vector.
set_output_vector
(self, vec, label)Send an entire vector as output.
set_qa
(self, indices)Set the specified joints as actuated.
set_qdriven
(self, indices)Set the specified joints as driven.
set_qu
(self, indices)Set the specified joints as independent.
set_qv
(self, indices)Set the specified joints as dependent.
unset_qa
(self, indices)Remove the specified joints from the actuated joints.
-
property
DoneEquil
¶ Access to DoneEquil attribute (read-write).
-
property
DoneModal
¶ Access to DoneModal attribute (read-only).
-
property
DonePart
¶ Access to DonePart attribute (read-only).
-
property
Fl
¶ Access to Fl attribute, only value in the vector can be written.
-
property
In
¶ Access to In attribute, only value in the matrix can be written.
-
property
Jac_user
¶ Access to Jac_user attribute, only value in the matrix can be written.
-
property
MAX_NR_ITER
¶ Access to MAX_NR_ITER attribute (read-write).
-
property
NRerr
¶ Access to NRerr attribute (read-write).
-
property
Ncons
¶ Access to Ncons attribute (read-only).
-
property
Nlink
¶ Access to Nlink attribute (read-only).
-
property
Nlink3D
¶ Access to Nlink3D attribute (read-only).
-
property
Nloopc
¶ Access to Nloopc attribute (read-only).
-
property
Nsensor
¶ Access to Nsensor attribute (read-only).
-
property
Nuser_model
¶ Access to Nuser_model attribute (read-only).
-
property
Nuserc
¶ Access to Nuserc attribute (read-only).
-
property
Nux
¶ Access to Nux attribute (read-only).
-
property
Nxfrc
¶ Access to Nxfrc attribute (read-only).
-
property
Qa
¶ Access to Qa attribute, only value in the vector can be written.
-
property
Qc
¶ Access to Qc attribute, only value in the vector can be written.
-
property
Qq
¶ Access to Qq attribute, only value in the vector can be written.
-
property
SWr
¶ Access to SWr attribute, only value in the matrix can be written.
-
property
Z
¶ Access to Z attribute, only value in the vector can be written.
-
property
Zd
¶ Access to Zd attribute, only value in the vector can be written.
-
__init__
(self, name, user_path=None, symbolic_path=None, prj_functions_c=None, prj_lib_path=None)¶ Load a specific *.mbs file into a MbsData class instance.
- Parameters
name (str) – The path to the .mbs file to load, including the file extension.
user_path (str, optional) – The path to the folder containing the user functions if the default project structure are not used.
symbolic_path (str, optional) – The path to the folder containing the symbolic functions if the default project structure are not used.
prj_functions_c (None or str, optional) – Option to load some of the project functions from the project C library. Accepted values are:
None : All project function are defined in python
“symbolic_only” or “S” : Symbolic function comes from C library
“symbolic_and_user” or “SU” : Symbolic and user functions come from C library
default is None
prj_lib_path (None or str, optional) – Required if ‘prj_functions_c’ is not None - In Linux, it gives the location of the folder containing the
“symbolicR/” and, or “userfctR/” folders. Each one of the subfolder have to contain the corresponding library (ie: libProject_symbolic.so).
In Windows, it gives the location of the folder containing the project libraries (Project_symbolic.dll and/or Project_userfct.dll).
In MacOs the expected behavior is the same as Linux. It must be tested.
default is None
- Returns
out – A loaded mbs file in a MbsData instance.
- Return type
MBsysPy.MbsData
-
property
build_path
¶ Access to build_path attribute (read-only).
-
define_output_vector
(self, label, size)¶ Initialize the memory for a vector as output.
This function must be called in the user init function dedicated to an analysis module. The value are defined during the computation thank to the function ‘set_output_vector()’ or ‘set_output_value()’
- Parameters
label (str) – The name of the output. It is used as part of the filename and as identifier when filling the values in the output.
size (int) – The size of the output vector, which correspond to the maximum value to be saved at each time step.
Notes
In case of error, ‘MbsData.flag_stop’ is set to 1 and the return value of the function is -2 or less. Reset the ‘MbsData.flag_stop’ to 0 if you want to start again a new Robotran module instance. A returned value of “-1” means that the output are currently disable.
- Returns
status – Status of the operation, negative if an error occurred.
- Return type
int
-
property
dpt
¶ Access to dpt attribute, only value in the matrix can be written.
-
empty_qa
(self)¶ Remove all joints from the actuated partition.
-
exe_dirdyn
(self, **kwargs)¶ Run a dirdyn module with a specified set of options.
Also run a partitioning module if needed. Partioning options are set to default values expect rowperm = 1
- Parameters
kwargs – Options to user for the analysis (see ‘set_options’ in MbsDirdyn).
- Returns
results – This object contains the results of the dirdyn analysis.
- Return type
MbsResults instance
-
exe_equil
(self, **kwargs)¶ Run a equil module with a specified set of options.
Also run a partitioning module if needed. Partioning options are set to default values expect rowperm = 1
- Parameters
kwargs – Options to user for the analysis (see ‘set_options’ in MbsEquil).
- Returns
results – This object contains the results of the dirdyn analysis.
- Return type
MbsResults instance
-
exe_invdyn
(self, **kwargs)¶ Run a invdyn module with a specified set of options.
Also run a partitioning module if needed. Partioning options are set to default values expect rowperm = 1
- Parameters
kwargs – Options to user for the analysis (see ‘set_options’ in MbsInvdyn).
- Returns
results – This object contains the results of the invdyn analysis.
- Return type
MbsResults instance
-
exe_modal
(self, **kwargs)¶ Run a modal module with a specified set of options.
Also run a partitioning module if needed. Partioning options are set to default values expect rowperm = 1
Note: A modal analysis should only be run on a equilibrium configuration.
- Parameters
kwargs – Options to user for the analysis (see ‘set_options’ in MbsModal).
- Returns
results – This object contains the results of the dirdyn analysis.
- Return type
MbsResults instance
-
exe_part
(self, **kwargs)¶ Run a partitioning module with the specified set of options.
- Parameters
kwargs – Options of the partitioning module (see ‘set_options’ in MbsPart).
-
exe_solvekin
(self, **kwargs)¶ Run a solvekin module with a specified set of options.
Also run a partitioning module if needed. Partioning options are set to default values expect rowperm = 1
- Parameters
kwargs – Options to user for the analysis (see ‘set_options’ in MbsSolvekin).
- Returns
results – This object contains the results of the solvekin analysis.
- Return type
MbsResults instance
-
property
flag_optim_symb_sin_cos
¶ Access to flag_optim_symb_sin_cos attribute (read-write).
-
property
flag_safety_checks
¶ Access to flag_safety_checks attribute (read-write).
-
property
flag_stop
¶ Access to flag_stop attribute (read-write).
-
property
frc
¶ Access to frc attribute, only value in the matrix can be written.
-
property
g
¶ Access to g attribute, only value in the vector can be written.
-
property
hu
¶ Access to hu attribute, values should not be modified.
-
property
jdqd_user
¶ Access to jdqd_user attribute, only value in the vector can be written.
-
property
l
¶ Access to l attribute, only value in the matrix can be written.
-
property
l3DWr
¶ Access to l3DWr attribute, only value in the matrix can be written.
-
property
lambda_
¶ Access to lambda_ attribute, only value in the vector can be written.
-
load_state
(self, baseFileName='dirdyn', result_path='resultsR', time=- 1, files_to_load=['all'])¶ Load a state to MbsData instance from files for specific time.
If the time specified is not found in the file, the last time step lower than the specification is taken. The fieds tsim, q, qd, qdd, ux, uxd (and q0, qd0, qdd0, ux0) are set.
If a file is not found a warning is generated and the value in memory are kept back.
- Parameters
baseFileName (str) – The path and resfilename containing the state to load. The suffix _q, _qd, _ux.res will be added. default is “dirdyn”
result_path (str) – The relative path of the result folder from the project folder. default is “resultsR”
time (float) – The time corresponding to the state to load. defaut is “-1” (last state of the files).
files_to_load (list of str) –
- List of the results files to load among:
‘all’: load all results files
‘q’: load the generalized coordinates
‘qd’: load the generalized velocities
‘qdd’: load the generalized acceleration
‘user’: load the user state variables
‘userd’: load the derivative of the user state variables.
default is “[‘all’]”.
-
property
lrod
¶ Access to lrod attribute, only value in the vector can be written.
-
property
m
¶ Access to m attribute, only value in the vector can be written.
-
property
mbs_filename
¶ Access to mbs_filename attribute (read-only).
-
property
mbs_name
¶ Access to mbs_name attribute (read-only).
-
property
n_rod
¶ Access to n_rod attribute (read-only).
-
property
nbody
¶ Access to nbody attribute (read-only).
-
property
nhu
¶ Access to nhu attribute (read-only).
-
property
njoint
¶ Access to njoint attribute (read-only).
-
property
npt
¶ Access to npt attribute (read-only).
-
property
nqa
¶ Access to nqa attribute (read-only).
-
property
nqc
¶ Access to nqc attribute (read-only).
-
property
nqdriven
¶ Access to nqdriven attribute (read-only).
-
property
nqlocked
¶ Access to nqlocked attribute (read-only).
-
property
nqrot
¶ Access to nqrot attribute (read-only).
-
property
nqu
¶ Access to nqu attribute (read-only).
-
property
nqv
¶ Access to nqv attribute (read-only).
-
print_joint_configuration
(self)¶ Print the joint configuration.
Print qu, qv, qc, qdriven, qlocked, qa.
- Returns
- Return type
None.
-
property
process
¶ Access to process attribute (read-write).
-
property
project_path
¶ Access to project_path attribute (read-only).
-
property
q
¶ Access to q attribute, only value in the vector can be written.
-
property
q0
¶ Access to q0 attribute, only value in the vector can be written.
-
property
q_cos
¶ Access to q_cos attribute, values should not be modified.
-
property
q_sin
¶ Access to q_sin attribute, values should not be modified.
-
property
qa
¶ Access to qa attribute, values should not be modified.
-
property
qc
¶ Access to qc attribute, values should not be modified.
-
property
qd
¶ Access to qd attribute, only value in the vector can be written.
-
property
qd0
¶ Access to qd0 attribute, only value in the vector can be written.
-
property
qdd
¶ Access to qdd attribute, only value in the vector can be written.
-
property
qdd0
¶ Access to qdd0 attribute, only value in the vector can be written.
-
property
qdriven
¶ Access to qdriven attribute, values should not be modified.
-
property
qlocked
¶ Access to qlocked attribute, values should not be modified.
-
property
qrot
¶ Access to qrot attribute, values should not be modified.
-
property
qu
¶ Access to qu attribute, values should not be modified.
-
property
qv
¶ Access to qv attribute, values should not be modified.
-
reset
(self, verbose=False)¶ Reset mbs_data fields to its inital value.
The following fields are reset according to the values storied in the field in parentheses:
MbsData.q (MbsData.q0)
MbsData.qd (MbsData.qd0)
MbsData.qdd (MbsData.qdd0)
MbsData.ux (MbsData.ux0)
MbsData.Qq (filled with 0)
MbsData.Qa (filled with 0)
MbsData.Qc (filled with 0)
MbsData.tsim (MbsData.t0)
- Parameters
verbose (bool, optional) – Set to ‘True’ to mbs_msg resetting validation message. default is False
-
set_nb_userc
(self, nb)¶ Set the number of user constraints.
- Parameters
nb (int) – The number of user constraints.
-
set_output
(self, value, label)¶ Save a value during time integration.
- Parameters
value (float) – Value to be saved.
label (str) – The name of the output, also used as part as the output filename.
Notes
In case of error, ‘MbsData.flag_stop’ is set to 1 and the return value of the function is -2 or less. Reset the ‘MbsData.flag_stop’ to 0 if you want to start again a new Robotran module instance. A returned value of “-1” means that the output are currently disable.
- Returns
status – Status of the operation, negative if an error occurred.
- Return type
int
-
set_output_value
(self, value, val_index, label)¶ Send a value at a specific location of an output vector.
- Parameters
value (float) – Value to be saved.
val_index (int) – index in the output vector where the value must be saved. This index must be at least 1 and maximum equal to the size specified with the function ‘define_output_vector()’.
label (str) – The name of the output. It must have been defined with the function
‘define_output_vector()’.
Notes
In case of error, ‘MbsData.flag_stop’ is set to 1 and the return value of the function is -2 or less. Reset the ‘MbsData.flag_stop’ to 0 if you want to start again a new Robotran module instance. A returned value of “-1” means that the output are currently disable.
- Returns
status – Status of the operation, negative if an error occurred.
- Return type
int
-
set_output_vector
(self, vec, label)¶ Send an entire vector as output.
The size of ‘vec’ must be equal to the size defined in the function ‘define_output_vector()’.
- Parameters
vec (list or numpy.ndarray) – Value to be saved as a list or a numpy array.
label (str) – The name of the output. It must have been defined with the function
‘define_output_vector()’.
Notes
In case of error, ‘MbsData.flag_stop’ is set to 1 and the return value of the function is -2 or less. Reset the ‘MbsData.flag_stop’ to 0 if you want to start again a new Robotran module instance. A returned value of “-1” means that the output are currently disable.
- Returns
status – Status of the operation, negative if an error occurred.
- Return type
int
-
set_qa
(self, indices)¶ Set the specified joints as actuated.
Actuated joints are only used by equilibrium analysis (in some cases) and inverse dynamics. Actuated joint are also member of one of the other partition (independent or dependent).
- Parameters
indices (int, list or numpy.ndarray of int) – The ids of the joints to set as actuated.
-
set_qdriven
(self, indices)¶ Set the specified joints as driven.
- Parameters
indices (int, list or numpy.ndarray of int) – The ids of the joints to set as driven.
-
set_qu
(self, indices)¶ Set the specified joints as independent.
- Parameters
indices (int, list or numpy.ndarray of int) – The ids of the joints to set as independent.
-
set_qv
(self, indices)¶ Set the specified joints as dependent.
- Parameters
indices (int, list or numpy.ndarray of int) – The ids of the joints to set as dependent.
-
property
t0
¶ Access to t0 attribute (read-write).
-
property
tf
¶ Access to tf attribute (read-write).
-
property
trq
¶ Access to trq attribute, only value in the matrix can be written.
-
property
tsim
¶ Access to tsim attribute (read-write).
-
property
udd
¶ Access to udd attribute, only value in the vector can be written.
-
unset_qa
(self, indices)¶ Remove the specified joints from the actuated joints.
- Parameters
indices (int, list or numpy.ndarray of int) – The ids of the joints to be removed from the actuated list.
-
property
ux
¶ Access to ux attribute, only value in the vector can be written.
-
property
ux0
¶ Access to ux0 attribute, only value in the vector can be written.
-
property
uxd
¶ Access to uxd attribute, only value in the vector can be written.
-
property
xfidpt
¶ Access to xfidpt attribute, values should not be modified.
-
property
zero_division_thrs
¶ Access to zero_division_thrs attribute (read-write).