MBsysPy.mbsyspy.mbs_solvekin module

Module to handle solvekin analysis on Multibody model.

Summary

Define the class MbsSolvekin based on the MbsSolvekin structure of MBsysC. This class has the functions required to manipulate the direct dynamic module. This include setting the options, running an (or multiple) analysis and freeing the memory.

class MBsysPy.mbsyspy.mbs_solvekin.MbsSolvekin(mbs, user_path=None, symbolic_path=None)

Bases: MBsysPy.mbsyspy.mbs_invdyn.MbsInvdyn

Class of the invdyn computation module.

See MbsInvdyn class for details.

Attributes
buffer_nb

Access to bufferNb attribute (read-only).

Methods

get_options(self, *args)

Get the specified options for Solvekin module.

run(self, **kwargs)

Run an inverse kinematics analysis.

set_options(self, **kwargs)

Set the specified options for Solvekin module.

set_user_fct_from_file(self, function_name, …)

Load a user function from a file chosen by the user instead of the default one in the userfctR folder.

set_user_fct_from_ptr(self, function_name, …)

Load a user function chosen by the user instead of the default one in the userfctR folder.

__init__(self, mbs, user_path=None, symbolic_path=None)

Create an instance of the MbsSolvekin class for the provided MbsData instance.

See MbsInvdyn.__init__() function for details.

Returns

MbsSolvekin – A MbsSolvekin instance.

Return type

self

property buffer_nb

Access to bufferNb attribute (read-only).

get_options(self, *args)

Get the specified options for Solvekin module.

Parameters

The different options specified in the documentation of set_options

Returns

Return type

The value of the different options specified in the documentation of set_options

run(self, **kwargs)

Run an inverse kinematics analysis.

Options can be setted with set_options. Options can be retrieved with get_options

Results are stored in the field results(if store_results == True)

Returns

self.results – The MbsResults containing the results of the analysis.

Return type

MbsResult

set_options(self, **kwargs)

Set the specified options for Solvekin module.

Parameters
  • motion (int) – Determines how the evolution of q, qd qdd are provided. oneshot (default) : Uses q, qd and qdd at the current time and configuration of the MBS. closeloop : Only for inverse kinematics analysis. Same as oneshot but save the iteration of the close loop process (NR). trajectory : Compute the evolution of between t0 and tf.

  • trajectoryqname (char) – Give the path and filename (with extension) to the file containing the input trajectory in position of the joints. Only required for motion == ‘trajectory’ if some joints are independent. By default, pointer to NULL. Requirement on the file: First column is the time, other are the joints coordinates. Either provide only the independent joint (by increasing index), user_drivenjoint will be called. Either provide all the joint, user_drivenjoint will be neglected.

  • trajectoryqname (char) – Give the path and filename (with extension) to the file containing the input trajectory in velocity of the joints. Only required for motion == ‘trajectory’ if some joints are independent. By default, pointer to NULL. Requirement on the file: First column is the time, other are the joints velocities. Either provide only the independent joint (by increasing index), user_drivenjoint will be called. Either provide all the joint, user_drivenjoint will be neglected.

  • trajectoryqname (char) – Give the path and filename (with extension) to the file containing the input trajectory in acceleration of the joints. Only required for motion == ‘trajectory’ if some joints are independent. By default, pointer to NULL. Requirement on the file: First column is the time, other are the joints accelerations. Either provide only the independent joint (by increasing index), user_drivenjoint will be called. Either provide all the joint, user_drivenjoint will be neglected.

  • t0 (float) – initial time of the simulation, default = 0.0

  • tf (float) – final time of the simulation, default = 5.0

  • dt0 (float) – Time step, default = 0.001 For motion == ‘trajectory’ (for inverse kinematic analysis, there must be at least one independent joint): Set to 0.0 to use the time vector of the coordinate input file (MbsSolvekinOptions::t0 and MbsSolvekinOptions::tf are ignored). Specify a value to use specific time vector.

  • save2file (int) – Determine whether results are written to files on disk (in MbsSolvekinOptions::respath folder): 1: results are saved 0: results are not saved default = 1

  • resfilename (str) – The keyword used for determining the name of result files

  • respath (str) – Path in which result file are saved. Default: the resultsR folder of the project

  • animpath (str) – Path in which anim file is saved. Default: the animationR folder of the project

  • save_anim (int) – 1 to save the anim file 0 otherwise (only valid if ‘save2file’ is set to 1) default = 1

  • framerate (int) – number of frame per second for the .anim file default = 1000

  • saveperiod (int) – The number of time steps between two buffer records default: 1 (every time step are recorded)

  • max_save_user (int) – The maximal number of user variables saved default: 12

  • buffersize (int) – The number of time step that can be recorded in the buffer. Results are written to disk when the buffer is full. default: -1 compute the buffer size for saving results only once at the end according to dt0, t0 and tf.

  • buffer_format (str) – The format for saving the data (double) to file. For example set “%.3e” to use scientific notation with 3 decimal. defaut: ‘%e’.

  • verbose (int) – Gives informations during the process. default: 1, to disable set it to 0.

  • store_results (boolean) – 1 to save a copy of the results from the buffers default = 1

set_user_fct_from_file(self, function_name, user_path, user_file)

Load a user function from a file chosen by the user instead of the default one in the userfctR folder.

The function is then unassigned by the module at the end of the run().

Parameters
  • function_name (str) – name of the user function to replace.

  • user_path (str) – path to the new user function file.

  • user_file (str) – name of the new user function file.

set_user_fct_from_ptr(self, function_name, user_fct_ptr)

Load a user function chosen by the user instead of the default one in the userfctR folder.

The function is then unassigned by the module at the end of the run().

Parameters
  • function_name (str) – name of the user function to replace.

  • user_fct_ptr (ptr) – new user function pointer.