def __init__(self, Lagrangian, q_list, coneqs=None, forcelist=None, frame=None):
"""Supply the following for the initialization of LagrangesMethod
Lagrangian : Sympifyable
q_list : list
A list of the generalized coordinates
coneqs : list
A list of the holonomic and non-holonomic constraint equations.
VERY IMPORTANT NOTE- The holonomic constraints must be
differentiated with respect to time and then included in coneqs.
forcelist : list
Takes a list of (Point, Vector) or (ReferenceFrame, Vector) tuples
which represent the force at a point or torque on a frame. This
feature is primarily to account for the nonconservative forces
amd/or moments.
frame : ReferenceFrame
Supply the inertial frame. This is used to determine the
generalized forces due to non-sonservative forces.
"""
self._L = sympify(Lagrangian)
self.eom = None # initializing the eom Matrix
self._m_cd = Matrix([]) # Mass Matrix of differentiated coneqs
self._m_d = Matrix([]) # Mass Matrix of dynamic equations
self._f_cd = Matrix([]) # Forcing part of the diff coneqs
self._f_d = Matrix([]) # Forcing part of the dynamic equations
self.lam_coeffs = Matrix([]) # Initializing the coeffecients of lams
self.forcelist = forcelist
self.inertial = frame
self.lam_vec = Matrix([])
self._term1 = Matrix([])
self._term2 = Matrix([])
self._term3 = Matrix([])
self._term4 = Matrix([])
# Creating the qs, qdots and qdoubledots
q_list = list(q_list)
if not isinstance(q_list, list):
raise TypeError('Generalized coords. must be supplied in a list')
self._q = q_list
self._qdots = [diff(i, dynamicsymbols._t) for i in self._q]
self._qdoubledots = [diff(i, dynamicsymbols._t) for i in self._qdots]
self.coneqs = coneqs
评论列表
文章目录