Inverse dynamics ================ Computation of the system inverse dynamics. It computes the required forces and torques in the actuated joints to follow a given motion. For more information, see `Robotran theoretical framework `_. Code sample ----------- For running the inverse dynamics, in the current configuration, insert the following code in your main script and adapt it to your need: .. code-block:: python mbs_data.process = 6 mbs_invdyn = MBsysPy.MbsInvdyn(mbs_data) mbs_invdyn.set_options(motion = "oneshot") mbs_invdyn.run() You can compute the inverse dynamics for a time-define trajectory by providing the trajectory files as follow: .. code-block:: python # Set all driven joint as independent mbs_data.set_qu(mbs_data.qc[1:].tolist()) mbs_data.process = 6 mbs_invdyn = MBsysPy.MbsInvdyn(mbs_data) # Set the motion to be solved as a trajectory mbs_invdyn.set_options(motion = "trajectory") # Provide the trajectory files to use mbs_invdyn.set_options(trajectoryqname = "../resultsR/inverse_kinematics_q.res", trajectoryqdname = "../resultsR/inverse_kinematics_qd.res", trajectoryqddname = "../resultsR/inverse_kinematics_qdd.res") # Provide the time interval and time step to solve the inverse dynamics. mbs_invdyn.set_options(t0 = 0.0, tf = 6.0, dt = 1e-3) # The final time "tf' must be less than the last time of the trajectory files. mbs_invdyn.run() In all cases the analysis requires actuated joint, see next section to set them. Use --- .. py:currentmodule:: MBsysPy.mbsyspy.mbs_invdyn The inverse dynamics computation is requires an instance of :py:class:`MbsInvdyn`. Then the analysis is performed by calling the function :py:func:`MbsInvdyn.run`. The options of the module are set with the function :py:func:`MbsInvdyn.set_options`. .. py:currentmodule:: MBsysPy.mbsyspy.mbs_data The force and torques are computed on the actuated joints (see `Robotran theoretical framework `_). A joint is (de)selected as actuated with the function :py:func:`MbsData.set_qa` (resp. :py:func:`MbsData.unset_qa`). Requirements on the system -------------------------- The system either: * contains independent joints: * The driven joints cannot be actuated; * The independent and dependent joint can be actuated; * The number of actuated joint must be equal or greather (over-actuated) than the number of independent joints. * does not contain any independent joints: * The driven joints must be actuated; * The dependent joints cannot be actuated