o
    oheK                    @   s   d dl mZmZ d dlmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZmZmZmZ d dlmZ d dlmZ g d	ZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdS )    )ABCabstractmethod)pi
DerivativeMatrix)AppliedUndef)BodyBase)_validate_coordinates)VectordynamicsymbolscrossPointReferenceFrame)iterable)sympy_deprecation_warning)JointPinJointPrismaticJointCylindricalJointPlanarJointSphericalJoint	WeldJointc                   @   s^  e Zd ZdZ				d>ddZdd Zdd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zed'd( Zed)d* Zed+d, Zed-d. Zed/d0 Ze		d?d1d2Zd3d4 Zd@d5d6Z d@d7d8Z!	:	;dAd<d=Z"dS )Br   a  Abstract base class for all specific joints.

    Explanation
    ===========

    A joint subtracts degrees of freedom from a body. This is the base class
    for all specific joints and holds all common methods acting as an interface
    for all joints. Custom joint can be created by inheriting Joint class and
    defining all abstract functions.

    The abstract methods are:

    - ``_generate_coordinates``
    - ``_generate_speeds``
    - ``_orient_frames``
    - ``_set_angular_velocity``
    - ``_set_linear_velocity``

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    coordinates : iterable of dynamicsymbols, optional
        Generalized coordinates of the joint.
    speeds : iterable of dynamicsymbols, optional
        Generalized speeds of joint.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the parent body which aligns with an axis fixed in the
            child body. The default is the x axis of parent's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    child_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the child body which aligns with an axis fixed in the
            parent body. The default is the x axis of child's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.
    parent_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by parent_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.
    child_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by child_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates.
    speeds : Matrix
        Matrix of the joint's generalized speeds.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_axis : Vector
        The axis fixed in the parent frame that represents the joint.
    child_axis : Vector
        The axis fixed in the child frame that represents the joint.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.

    Notes
    =====

    When providing a vector as the intermediate frame, a new intermediate frame
    is created which aligns its X axis with the provided vector. This is done
    with a single fixed rotation about a rotation axis. This rotation axis is
    determined by taking the cross product of the ``body.x`` axis with the
    provided vector. In the case where the provided vector is in the ``-body.x``
    direction, the rotation is done about the ``body.y`` axis.

    Nc                 C   s   t |ts	td|| _t |tstd|| _t |ts!td|| _|
d us,|d ur@tddddd |d u r:|
}|	d u r@|}	t| jd	rL| jj	| _
nt |trU|| _
nt| j d
| jj d| _
t| jd	ro| jj	| _nt |	trx|	| _nt| j d
| jj d| _| | j|| j
| _| | j|	| j| _| |
| j
| _| || j| _|d us|d urtddddd |d u r|}|d u r|}| | j|| j
| _| | j|| j| _| || _| || _t| j| j |  | _|    | !  | "  d S )NzSupply a valid name.zParent must be a body.zChild must be a body.z
                The parent_axis and child_axis arguments for the Joint classes
                are deprecated. Instead use parent_interframe, child_interframe.
                z1.12zdeprecated-mechanics-joint-axis   )deprecated_since_versionactive_deprecations_target
stacklevelframe__framez
                The parent_joint_pos and child_joint_pos arguments for the Joint
                classes are deprecated. Instead use parent_point and child_point.
                zdeprecated-mechanics-joint-pos)#
isinstancestr	TypeError_namer   _parent_childr   hasattrr   _parent_framer   name_child_frame_locate_joint_frame_parent_interframe_child_interframe_axis_parent_axis_child_axis_locate_joint_pos_parent_point_child_point_generate_coordinates_coordinates_generate_speeds_speedsr	   coordinatesspeeds_generate_kdes_kdes_orient_frames_set_angular_velocity_set_linear_velocity)selfr'   parentchildr6   r7   parent_pointchild_pointparent_interframechild_interframeparent_axis
child_axisparent_joint_poschild_joint_pos rH   q/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/physics/mechanics/joint.py__init__   s   


	



	


zJoint.__init__c                 C      | j S N)r'   r=   rH   rH   rI   __str__      zJoint.__str__c                 C   s   |   S rL   )rN   rM   rH   rH   rI   __repr__   s   zJoint.__repr__c                 C   rK   )zName of the joint.)r"   rM   rH   rH   rI   r'         z
Joint.namec                 C   rK   )zParent body of Joint.)r#   rM   rH   rH   rI   r>      rQ   zJoint.parentc                 C   rK   )zChild body of Joint.)r$   rM   rH   rH   rI   r?      rQ   zJoint.childc                 C   rK   )z.Matrix of the joint's generalized coordinates.)r3   rM   rH   rH   rI   r6      rQ   zJoint.coordinatesc                 C   rK   )z)Matrix of the joint's generalized speeds.)r5   rM   rH   rH   rI   r7      rQ   zJoint.speedsc                 C   rK   )z0Kinematical differential equations of the joint.)r9   rM   rH   rH   rI   kdes   rQ   z
Joint.kdesc                 C   rK   )zThe axis of parent frame.)r-   rM   rH   rH   rI   rD         zJoint.parent_axisc                 C   rK   )zThe axis of child frame.)r.   rM   rH   rH   rI   rE     rS   zJoint.child_axisc                 C   rK   )z=Attachment point where the joint is fixed to the parent body.)r0   rM   rH   rH   rI   r@     rQ   zJoint.parent_pointc                 C   rK   )z<Attachment point where the joint is fixed to the child body.)r1   rM   rH   rH   rI   rA     rQ   zJoint.child_pointc                 C   rK   rL   )r*   rM   rH   rH   rI   rB        zJoint.parent_interframec                 C   rK   rL   )r+   rM   rH   rH   rI   rC     rT   zJoint.child_interframec                 C      dS )z7Generate Matrix of the joint's generalized coordinates.NrH   r=   r6   rH   rH   rI   r2        zJoint._generate_coordinatesc                 C   rU   )z2Generate Matrix of the joint's generalized speeds.NrH   r=   r7   rH   rH   rI   r4   #  rW   zJoint._generate_speedsc                 C   rU   )zOrient frames as per the joint.NrH   rM   rH   rH   rI   r:   (  rW   zJoint._orient_framesc                 C   rU   )z1Set angular velocity of the joint related frames.NrH   rM   rH   rH   rI   r;   -  rW   zJoint._set_angular_velocityc                 C   rU   )z,Set velocity of related points to the joint.NrH   rM   rH   rH   rI   r<   2  rW   zJoint._set_linear_velocityc                 C   s   t | |fgS )z1Converts a matrix to a vector in the given frame.)r
   )matrixr   rH   rH   rI   
_to_vector7  s   zJoint._to_vectorc              	   G   s   | du r|d j } | S t| tstdd}|D ]}z| | W n	 ty*   Y qw |} |du r6td| |dksAtd| S )z4Check whether an axis is fixed in one of the frames.Nr   zAxis must be a Vector.z5Axis cannot be expressed in one of the body's frames.zAAxis cannot be time-varying when viewed from the associated body.)xr   r
   r!   	to_matrix
ValueErrordt)axframes	ref_framer   rH   rH   rI   r,   <  s&   

zJoint._axisc                 C   sr   | | }|d |d |d }}}|dkr/|dkr%|dkr%t|| jS |dkr,| jS | jS |dkr6| jS | jS )Nr         )r\   r   r[   yz)r   axis
componentsr[   rd   re   rH   rH   rI   _choose_rotation_axisU  s   
zJoint._choose_rotation_axisc                 C   s   t | tr| j} |du r| j}|du r-| jdd dkr'| jdd  d}n| j d}||}t||}|tdkrC|dkrC| S |tkrMt	
| |}t|}|| || || d|  |S )u  
        Returns an intermediate frame, where the ``frame_axis`` defined in
        ``frame`` is aligned with ``axis``. By default this means that the X
        axis will be aligned with ``axis``.

        Parameters
        ==========

        frame : BodyBase or ReferenceFrame
            The body or reference frame with respect to which the intermediate
            frame is oriented.
        align_axis : Vector
            The vector with respect to which the intermediate frame will be
            aligned.
        frame_axis : Vector
            The vector of the frame which should get aligned with ``axis``. The
            default is the X axis of the frame.
        frame_name : string
            Name of the to be created intermediate frame. The default adds
            "_int_frame" to the name of ``frame``.

        Example
        =======

        An intermediate frame, where the X axis of the parent becomes aligned
        with ``parent.y + parent.z`` can be created as follows:

        >>> from sympy.physics.mechanics.joint import Joint
        >>> from sympy.physics.mechanics import RigidBody
        >>> parent = RigidBody('parent')
        >>> parent_interframe = Joint._create_aligned_interframe(
        ...     parent, parent.y + parent.z)
        >>> parent_interframe
        parent_int_frame
        >>> parent.frame.dcm(parent_interframe)
        Matrix([
        [        0, -sqrt(2)/2, -sqrt(2)/2],
        [sqrt(2)/2,        1/2,       -1/2],
        [sqrt(2)/2,       -1/2,        1/2]])
        >>> (parent.y + parent.z).express(parent_interframe)
        sqrt(2)*parent_int_frame.x

        Notes
        =====

        The direction cosine matrix between the given frame and intermediate
        frame is formed using a simple rotation about an axis that is normal to
        both ``align_axis`` and ``frame_axis``. In general, the normal axis is
        formed by crossing the ``frame_axis`` with the ``align_axis``. The
        exception is if the axes are parallel with opposite directions, in which
        case the rotation vector is chosen using the rules in the following
        table with the vectors expressed in the given frame:

        .. list-table::
           :header-rows: 1

           * - ``align_axis``
             - ``frame_axis``
             - ``rotation_axis``
           * - ``-x``
             - ``x``
             - ``z``
           * - ``-y``
             - ``y``
             - ``x``
           * - ``-z``
             - ``z``
             - ``y``
           * - ``-x-y``
             - ``x+y``
             - ``z``
           * - ``-y-z``
             - ``y+z``
             - ``x``
           * - ``-x-z``
             - ``x+z``
             - ``y``
           * - ``-x-y-z``
             - ``x+y+z``
             - ``(x+y+z) × x``

        Nir   
_int_framer   )r   r   r   r[   r'   angle_betweenr   r
   r   r   rh   r   orient_axisset_ang_vel)r   
align_axis
frame_axis
frame_nameanglerotation_axis	int_framerH   rH   rI   _create_aligned_interframef  s$   
U

z Joint._create_aligned_interframec                 C   sH   g }t j}tt| jD ]}|| j| | | j|   qt|S )z,Generate kinematical differential equations.)	r   _trangelenr6   appenddiffr7   r   )r=   rR   tirH   rH   rI   r8     s
   $zJoint._generate_kdesc                 C   s   |du r|j }|du r|jS t|ttfstdt|tr/| j d|j d}|j||}||j	|dks>t
d|S )z'Returns the attachment point of a body.Nz+Attachment point must be a Point or Vector.r   _jointr   z6Attachment point must be fixed to the associated body.)r   
masscenterr   r   r
   r!   r'   	locatenewpos_fromr^   r]   )r=   body	joint_pos
body_frame
point_namerH   rH   rI   r/     s   
zJoint._locate_joint_posc                 C   s   |du r|j }|du r|S t|tr#tj||| j d|j dd}n	t|ts,td||dks>t	d| d| d	|j
|d |S )
z'Returns the attachment frame of a body.Nr   ri   )ro   z$Interframe must be a ReferenceFrame.r   zInterframe z is not fixed to body .)r   r   r
   r   rs   r'   r   r!   
ang_vel_inr]   r|   set_vel)r=   r   
interframer   rH   rH   rI   r)     s"   



zJoint._locate_joint_frameqr   Fc              
      s   fdd} dkrdnd}g }|du rg }nt |s!|g}t|dks@t|ks@td d	| d
t| d	| d	t|D ])\}	}
|
du rV|||	|  qDt|
ttfrc||
 qDtd| d	|
 dt	t|| | D ]	}	|||	 qyt
|S )a  Helper method for _generate_coordinates and _generate_speeds.

        Parameters
        ==========

        coordinates : iterable
            Iterable of coordinates or speeds that have been provided.
        n_coords : Integer
            Number of coordinates that should be returned.
        label : String, optional
            Coordinate type either 'q' (coordinates) or 'u' (speeds). The
            Default is 'q'.
        offset : Integer
            Count offset when creating new dynamicsymbols. The default is 0.
        number_single : Boolean
            Boolean whether if n_coords == 1, number should still be used. The
            default is False.

        c                    s8   dkrst   dj S t   |  dj S )Nrb   r   )r   r'   )numberlabeln_coordsnumber_singler=   rH   rI   create_symbol  s   z2Joint._fill_coordinate_list.<locals>.create_symbolr   zgeneralized coordinatezgeneralized speedNr   z	Expected  zs, instead got zs.zThe z" should have been a dynamicsymbol.)r   rv   r]   	enumeraterw   r   r   r   r!   ru   r   )r=   r6   r   r   offsetr   r   r'   generated_coordinatesrz   coordrH   r   rI   _fill_coordinate_list  s,   
zJoint._fill_coordinate_list)
NNNNNNNNNN)NNrL   )r   r   F)#__name__
__module____qualname____doc__rJ   rN   rP   propertyr'   r>   r?   r6   r7   rR   rD   rE   r@   rA   rB   rC   r   r2   r4   r:   r;   r<   staticmethodrZ   r,   rh   rs   r8   r/   r)   r   rH   rH   rH   rI   r      sv    t
U



















i

r   c                       f   e Zd ZdZ				d fdd	Zdd Zedd Zd	d
 Zdd Z	dd Z
dd Zdd Z  ZS )r   u!  Pin (Revolute) Joint.

    .. raw:: html
        :file: ../../../doc/src/modules/physics/mechanics/api/PinJoint.svg

    Explanation
    ===========

    A pin joint is defined such that the joint rotation axis is fixed in both
    the child and parent and the location of the joint is relative to the mass
    center of each body. The child rotates an angle, θ, from the parent about
    the rotation axis and has a simple angular speed, ω, relative to the
    parent. The direction cosine matrix between the child interframe and
    parent interframe is formed using a simple rotation about the joint axis.
    The page on the joints framework gives a more detailed explanation of the
    intermediate frames.

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    coordinates : dynamicsymbol, optional
        Generalized coordinates of the joint.
    speeds : dynamicsymbol, optional
        Generalized speeds of joint.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the parent body which aligns with an axis fixed in the
            child body. The default is the x axis of parent's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    child_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the child body which aligns with an axis fixed in the
            parent body. The default is the x axis of child's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.
    joint_axis : Vector
        The axis about which the rotation occurs. Note that the components
        of this axis are the same in the parent_interframe and child_interframe.
    parent_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by parent_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.
    child_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by child_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates. The default value is
        ``dynamicsymbols(f'q_{joint.name}')``.
    speeds : Matrix
        Matrix of the joint's generalized speeds. The default value is
        ``dynamicsymbols(f'u_{joint.name}')``.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_axis : Vector
        The axis fixed in the parent frame that represents the joint.
    child_axis : Vector
        The axis fixed in the child frame that represents the joint.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    joint_axis : Vector
        The axis about which the rotation occurs. Note that the components of
        this axis are the same in the parent_interframe and child_interframe.
    kdes : Matrix
        Kinematical differential equations of the joint.

    Examples
    =========

    A single pin joint is created from two bodies and has the following basic
    attributes:

    >>> from sympy.physics.mechanics import RigidBody, PinJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = PinJoint('PC', parent, child)
    >>> joint
    PinJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.parent_axis
    P_frame.x
    >>> joint.child_axis
    C_frame.x
    >>> joint.coordinates
    Matrix([[q_PC(t)]])
    >>> joint.speeds
    Matrix([[u_PC(t)]])
    >>> child.frame.ang_vel_in(parent.frame)
    u_PC(t)*P_frame.x
    >>> child.frame.dcm(parent.frame)
    Matrix([
    [1,             0,            0],
    [0,  cos(q_PC(t)), sin(q_PC(t))],
    [0, -sin(q_PC(t)), cos(q_PC(t))]])
    >>> joint.child_point.pos_from(joint.parent_point)
    0

    To further demonstrate the use of the pin joint, the kinematics of simple
    double pendulum that rotates about the Z axis of each connected body can be
    created as follows.

    >>> from sympy import symbols, trigsimp
    >>> from sympy.physics.mechanics import RigidBody, PinJoint
    >>> l1, l2 = symbols('l1 l2')

    First create bodies to represent the fixed ceiling and one to represent
    each pendulum bob.

    >>> ceiling = RigidBody('C')
    >>> upper_bob = RigidBody('U')
    >>> lower_bob = RigidBody('L')

    The first joint will connect the upper bob to the ceiling by a distance of
    ``l1`` and the joint axis will be about the Z axis for each body.

    >>> ceiling_joint = PinJoint('P1', ceiling, upper_bob,
    ... child_point=-l1*upper_bob.frame.x,
    ... joint_axis=ceiling.frame.z)

    The second joint will connect the lower bob to the upper bob by a distance
    of ``l2`` and the joint axis will also be about the Z axis for each body.

    >>> pendulum_joint = PinJoint('P2', upper_bob, lower_bob,
    ... child_point=-l2*lower_bob.frame.x,
    ... joint_axis=upper_bob.frame.z)

    Once the joints are established the kinematics of the connected bodies can
    be accessed. First the direction cosine matrices of pendulum link relative
    to the ceiling are found:

    >>> upper_bob.frame.dcm(ceiling.frame)
    Matrix([
    [ cos(q_P1(t)), sin(q_P1(t)), 0],
    [-sin(q_P1(t)), cos(q_P1(t)), 0],
    [            0,            0, 1]])
    >>> trigsimp(lower_bob.frame.dcm(ceiling.frame))
    Matrix([
    [ cos(q_P1(t) + q_P2(t)), sin(q_P1(t) + q_P2(t)), 0],
    [-sin(q_P1(t) + q_P2(t)), cos(q_P1(t) + q_P2(t)), 0],
    [                      0,                      0, 1]])

    The position of the lower bob's masscenter is found with:

    >>> lower_bob.masscenter.pos_from(ceiling.masscenter)
    l1*U_frame.x + l2*L_frame.x

    The angular velocities of the two pendulum links can be computed with
    respect to the ceiling.

    >>> upper_bob.frame.ang_vel_in(ceiling.frame)
    u_P1(t)*C_frame.z
    >>> lower_bob.frame.ang_vel_in(ceiling.frame)
    u_P1(t)*C_frame.z + u_P2(t)*U_frame.z

    And finally, the linear velocities of the two pendulum bobs can be computed
    with respect to the ceiling.

    >>> upper_bob.masscenter.vel(ceiling.frame)
    l1*u_P1(t)*U_frame.y
    >>> lower_bob.masscenter.vel(ceiling.frame)
    l1*u_P1(t)*U_frame.y + l2*(u_P1(t) + u_P2(t))*L_frame.y

    Nc                    .   || _ t |||||||||	|
||| d S rL   _joint_axissuperrJ   r=   r'   r>   r?   r6   r7   r@   rA   rB   rC   rD   rE   
joint_axisrF   rG   	__class__rH   rI   rJ        zPinJoint.__init__c                 C      d| j  d| j d| j S )Nz
PinJoint: 
  parent: 	  child: r'   r>   r?   rM   rH   rH   rI   rN        zPinJoint.__str__c                 C   rK   )z>Axis about which the child rotates with respect to the parent.r   rM   rH   rH   rI   r     rQ   zPinJoint.joint_axisc                 C      |  |ddS Nrb   r   r   r=   
coordinaterH   rH   rI   r2        zPinJoint._generate_coordinatesc                 C   r   Nrb   ur   r=   speedrH   rH   rI   r4   "  r   zPinJoint._generate_speedsc                 C   s0   |  | j| j| _| j| j| j| jd  d S Nr   )r,   r   rB   r   rC   rk   r6   rM   rH   rH   rI   r:   %  s   zPinJoint._orient_framesc                 C   s$   | j | j| jd | j   d S r   )rC   rl   rB   r7   r   	normalizerM   rH   rH   rI   r;   *  s
   
zPinJoint._set_angular_velocityc                 C   L   | j | jd | j| jd | j | jd | jj| j| j| j d S r   	rA   set_posr@   r   r&   r(   r?   r|   v2pt_theoryrM   rH   rH   rI   r<   .  s   zPinJoint._set_linear_velocityNNNNNNNNNNNr   r   r   r   rJ   rN   r   r   r2   r4   r:   r;   r<   __classcell__rH   rH   r   rI   r   ,  s      _
r   c                       r   )r   a  Prismatic (Sliding) Joint.

    .. image:: PrismaticJoint.svg

    Explanation
    ===========

    It is defined such that the child body translates with respect to the parent
    body along the body-fixed joint axis. The location of the joint is defined
    by two points, one in each body, which coincide when the generalized
    coordinate is zero. The direction cosine matrix between the
    parent_interframe and child_interframe is the identity matrix. Therefore,
    the direction cosine matrix between the parent and child frames is fully
    defined by the definition of the intermediate frames. The page on the joints
    framework gives a more detailed explanation of the intermediate frames.

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    coordinates : dynamicsymbol, optional
        Generalized coordinates of the joint. The default value is
        ``dynamicsymbols(f'q_{joint.name}')``.
    speeds : dynamicsymbol, optional
        Generalized speeds of joint. The default value is
        ``dynamicsymbols(f'u_{joint.name}')``.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the parent body which aligns with an axis fixed in the
            child body. The default is the x axis of parent's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    child_axis : Vector, optional
        .. deprecated:: 1.12
            Axis fixed in the child body which aligns with an axis fixed in the
            parent body. The default is the x axis of child's reference frame.
            For more information on this deprecation, see
            :ref:`deprecated-mechanics-joint-axis`.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.
    joint_axis : Vector
        The axis along which the translation occurs. Note that the components
        of this axis are the same in the parent_interframe and child_interframe.
    parent_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by parent_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.
    child_joint_pos : Point or Vector, optional
        .. deprecated:: 1.12
            This argument is replaced by child_point and will be removed in a
            future version.
            See :ref:`deprecated-mechanics-joint-pos` for more information.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates.
    speeds : Matrix
        Matrix of the joint's generalized speeds.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_axis : Vector
        The axis fixed in the parent frame that represents the joint.
    child_axis : Vector
        The axis fixed in the child frame that represents the joint.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.

    Examples
    =========

    A single prismatic joint is created from two bodies and has the following
    basic attributes:

    >>> from sympy.physics.mechanics import RigidBody, PrismaticJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = PrismaticJoint('PC', parent, child)
    >>> joint
    PrismaticJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.parent_axis
    P_frame.x
    >>> joint.child_axis
    C_frame.x
    >>> joint.coordinates
    Matrix([[q_PC(t)]])
    >>> joint.speeds
    Matrix([[u_PC(t)]])
    >>> child.frame.ang_vel_in(parent.frame)
    0
    >>> child.frame.dcm(parent.frame)
    Matrix([
    [1, 0, 0],
    [0, 1, 0],
    [0, 0, 1]])
    >>> joint.child_point.pos_from(joint.parent_point)
    q_PC(t)*P_frame.x

    To further demonstrate the use of the prismatic joint, the kinematics of two
    masses sliding, one moving relative to a fixed body and the other relative
    to the moving body. about the X axis of each connected body can be created
    as follows.

    >>> from sympy.physics.mechanics import PrismaticJoint, RigidBody

    First create bodies to represent the fixed ceiling and one to represent
    a particle.

    >>> wall = RigidBody('W')
    >>> Part1 = RigidBody('P1')
    >>> Part2 = RigidBody('P2')

    The first joint will connect the particle to the ceiling and the
    joint axis will be about the X axis for each body.

    >>> J1 = PrismaticJoint('J1', wall, Part1)

    The second joint will connect the second particle to the first particle
    and the joint axis will also be about the X axis for each body.

    >>> J2 = PrismaticJoint('J2', Part1, Part2)

    Once the joint is established the kinematics of the connected bodies can
    be accessed. First the direction cosine matrices of Part relative
    to the ceiling are found:

    >>> Part1.frame.dcm(wall.frame)
    Matrix([
    [1, 0, 0],
    [0, 1, 0],
    [0, 0, 1]])

    >>> Part2.frame.dcm(wall.frame)
    Matrix([
    [1, 0, 0],
    [0, 1, 0],
    [0, 0, 1]])

    The position of the particles' masscenter is found with:

    >>> Part1.masscenter.pos_from(wall.masscenter)
    q_J1(t)*W_frame.x

    >>> Part2.masscenter.pos_from(wall.masscenter)
    q_J1(t)*W_frame.x + q_J2(t)*P1_frame.x

    The angular velocities of the two particle links can be computed with
    respect to the ceiling.

    >>> Part1.frame.ang_vel_in(wall.frame)
    0

    >>> Part2.frame.ang_vel_in(wall.frame)
    0

    And finally, the linear velocities of the two particles can be computed
    with respect to the ceiling.

    >>> Part1.masscenter.vel(wall.frame)
    u_J1(t)*W_frame.x

    >>> Part2.masscenter.vel(wall.frame)
    u_J1(t)*W_frame.x + Derivative(q_J2(t), t)*P1_frame.x

    Nc                    r   rL   r   r   r   rH   rI   rJ     r   zPrismaticJoint.__init__c                 C   r   )NzPrismaticJoint: r   r   r   rM   rH   rH   rI   rN     r   zPrismaticJoint.__str__c                 C   rK   )zAAxis along which the child translates with respect to the parent.r   rM   rH   rH   rI   r   !  rQ   zPrismaticJoint.joint_axisc                 C   r   r   r   r   rH   rH   rI   r2   &  r   z$PrismaticJoint._generate_coordinatesc                 C   r   r   r   r   rH   rH   rI   r4   )  r   zPrismaticJoint._generate_speedsc                 C   s*   |  | j| j| _| j| j| jd d S r   )r,   r   rB   r   rC   rk   rM   rH   rH   rI   r:   ,  s   
zPrismaticJoint._orient_framesc                 C      | j | jd d S r   rC   rl   rB   rM   rH   rH   rI   r;   1     z$PrismaticJoint._set_angular_velocityc                 C   s~   | j  }| j| j| jd |  | j| jd | j| jd | j| j| j	d |  | j
j| j| j	d |  d S r   )r   r   rA   r   r@   r6   r   r&   r(   r7   r?   r|   )r=   rf   rH   rH   rI   r<   4  s   
 z#PrismaticJoint._set_linear_velocityr   r   rH   rH   r   rI   r   6  s      \
r   c                       s   e Zd ZdZ					d fdd	Zdd Zedd Zed	d
 Zedd Z	edd Z
edd Zdd Zdd Zdd Zdd Zdd Z  ZS )r   a'#  Cylindrical Joint.

    .. image:: CylindricalJoint.svg
        :align: center
        :width: 600

    Explanation
    ===========

    A cylindrical joint is defined such that the child body both rotates about
    and translates along the body-fixed joint axis with respect to the parent
    body. The joint axis is both the rotation axis and translation axis. The
    location of the joint is defined by two points, one in each body, which
    coincide when the generalized coordinate corresponding to the translation is
    zero. The direction cosine matrix between the child interframe and parent
    interframe is formed using a simple rotation about the joint axis. The page
    on the joints framework gives a more detailed explanation of the
    intermediate frames.

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    rotation_coordinate : dynamicsymbol, optional
        Generalized coordinate corresponding to the rotation angle. The default
        value is ``dynamicsymbols(f'q0_{joint.name}')``.
    translation_coordinate : dynamicsymbol, optional
        Generalized coordinate corresponding to the translation distance. The
        default value is ``dynamicsymbols(f'q1_{joint.name}')``.
    rotation_speed : dynamicsymbol, optional
        Generalized speed corresponding to the angular velocity. The default
        value is ``dynamicsymbols(f'u0_{joint.name}')``.
    translation_speed : dynamicsymbol, optional
        Generalized speed corresponding to the translation velocity. The default
        value is ``dynamicsymbols(f'u1_{joint.name}')``.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.
    joint_axis : Vector, optional
        The rotation as well as translation axis. Note that the components of
        this axis are the same in the parent_interframe and child_interframe.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    rotation_coordinate : dynamicsymbol
        Generalized coordinate corresponding to the rotation angle.
    translation_coordinate : dynamicsymbol
        Generalized coordinate corresponding to the translation distance.
    rotation_speed : dynamicsymbol
        Generalized speed corresponding to the angular velocity.
    translation_speed : dynamicsymbol
        Generalized speed corresponding to the translation velocity.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates.
    speeds : Matrix
        Matrix of the joint's generalized speeds.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.
    joint_axis : Vector
        The axis of rotation and translation.

    Examples
    =========

    A single cylindrical joint is created between two bodies and has the
    following basic attributes:

    >>> from sympy.physics.mechanics import RigidBody, CylindricalJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = CylindricalJoint('PC', parent, child)
    >>> joint
    CylindricalJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.parent_axis
    P_frame.x
    >>> joint.child_axis
    C_frame.x
    >>> joint.coordinates
    Matrix([
    [q0_PC(t)],
    [q1_PC(t)]])
    >>> joint.speeds
    Matrix([
    [u0_PC(t)],
    [u1_PC(t)]])
    >>> child.frame.ang_vel_in(parent.frame)
    u0_PC(t)*P_frame.x
    >>> child.frame.dcm(parent.frame)
    Matrix([
    [1,              0,             0],
    [0,  cos(q0_PC(t)), sin(q0_PC(t))],
    [0, -sin(q0_PC(t)), cos(q0_PC(t))]])
    >>> joint.child_point.pos_from(joint.parent_point)
    q1_PC(t)*P_frame.x
    >>> child.masscenter.vel(parent.frame)
    u1_PC(t)*P_frame.x

    To further demonstrate the use of the cylindrical joint, the kinematics of
    two cylindrical joints perpendicular to each other can be created as follows.

    >>> from sympy import symbols
    >>> from sympy.physics.mechanics import RigidBody, CylindricalJoint
    >>> r, l, w = symbols('r l w')

    First create bodies to represent the fixed floor with a fixed pole on it.
    The second body represents a freely moving tube around that pole. The third
    body represents a solid flag freely translating along and rotating around
    the Y axis of the tube.

    >>> floor = RigidBody('floor')
    >>> tube = RigidBody('tube')
    >>> flag = RigidBody('flag')

    The first joint will connect the first tube to the floor with it translating
    along and rotating around the Z axis of both bodies.

    >>> floor_joint = CylindricalJoint('C1', floor, tube, joint_axis=floor.z)

    The second joint will connect the tube perpendicular to the flag along the Y
    axis of both the tube and the flag, with the joint located at a distance
    ``r`` from the tube's center of mass and a combination of the distances
    ``l`` and ``w`` from the flag's center of mass.

    >>> flag_joint = CylindricalJoint('C2', tube, flag,
    ...                               parent_point=r * tube.y,
    ...                               child_point=-w * flag.y + l * flag.z,
    ...                               joint_axis=tube.y)

    Once the joints are established the kinematics of the connected bodies can
    be accessed. First the direction cosine matrices of both the body and the
    flag relative to the floor are found:

    >>> tube.frame.dcm(floor.frame)
    Matrix([
    [ cos(q0_C1(t)), sin(q0_C1(t)), 0],
    [-sin(q0_C1(t)), cos(q0_C1(t)), 0],
    [             0,             0, 1]])
    >>> flag.frame.dcm(floor.frame)
    Matrix([
    [cos(q0_C1(t))*cos(q0_C2(t)), sin(q0_C1(t))*cos(q0_C2(t)), -sin(q0_C2(t))],
    [             -sin(q0_C1(t)),               cos(q0_C1(t)),              0],
    [sin(q0_C2(t))*cos(q0_C1(t)), sin(q0_C1(t))*sin(q0_C2(t)),  cos(q0_C2(t))]])

    The position of the flag's center of mass is found with:

    >>> flag.masscenter.pos_from(floor.masscenter)
    q1_C1(t)*floor_frame.z + (r + q1_C2(t))*tube_frame.y + w*flag_frame.y - l*flag_frame.z

    The angular velocities of the two tubes can be computed with respect to the
    floor.

    >>> tube.frame.ang_vel_in(floor.frame)
    u0_C1(t)*floor_frame.z
    >>> flag.frame.ang_vel_in(floor.frame)
    u0_C1(t)*floor_frame.z + u0_C2(t)*tube_frame.y

    Finally, the linear velocities of the two tube centers of mass can be
    computed with respect to the floor, while expressed in the tube's frame.

    >>> tube.masscenter.vel(floor.frame).to_matrix(tube.frame)
    Matrix([
    [       0],
    [       0],
    [u1_C1(t)]])
    >>> flag.masscenter.vel(floor.frame).to_matrix(tube.frame).simplify()
    Matrix([
    [-l*u0_C2(t)*cos(q0_C2(t)) - r*u0_C1(t) - w*u0_C1(t) - q1_C2(t)*u0_C1(t)],
    [                    -l*u0_C1(t)*sin(q0_C2(t)) + Derivative(q1_C2(t), t)],
    [                                    l*u0_C2(t)*sin(q0_C2(t)) + u1_C1(t)]])

    Nc                    s8   || _ ||f}||f}t j|||||||	|
|d	 d S NrB   rC   r   )r=   r'   r>   r?   rotation_coordinatetranslation_coordinaterotation_speedtranslation_speedr@   rA   rB   rC   r   r6   r7   r   rH   rI   rJ     s   
zCylindricalJoint.__init__c                 C   r   )NzCylindricalJoint: r   r   r   rM   rH   rH   rI   rN   ,  r   zCylindricalJoint.__str__c                 C   rK   )z?Axis about and along which the rotation and translation occurs.r   rM   rH   rH   rI   r   0  rQ   zCylindricalJoint.joint_axisc                 C   
   | j d S z;Generalized coordinate corresponding to the rotation angle.r   r6   rM   rH   rH   rI   r   5     
z$CylindricalJoint.rotation_coordinatec                 C   r   )zAGeneralized coordinate corresponding to the translation distance.rb   r   rM   rH   rH   rI   r   :  r   z'CylindricalJoint.translation_coordinatec                 C   r   z8Generalized speed corresponding to the angular velocity.r   r7   rM   rH   rH   rI   r   ?  r   zCylindricalJoint.rotation_speedc                 C   r   )z<Generalized speed corresponding to the translation velocity.rb   r   rM   rH   rH   rI   r   D  r   z"CylindricalJoint.translation_speedc                 C   r   )Nrc   r   r   rV   rH   rH   rI   r2   I  r   z&CylindricalJoint._generate_coordinatesc                 C   r   )Nrc   r   r   rX   rH   rH   rI   r4   L  r   z!CylindricalJoint._generate_speedsc                 C   s,   |  | j| j| _| j| j| j| j d S rL   )r,   r   rB   r   rC   rk   r   rM   rH   rH   rI   r:   O  s   zCylindricalJoint._orient_framesc                 C   s    | j | j| j| j   d S rL   )rC   rl   rB   r   r   r   rM   rH   rH   rI   r;   T  s   z&CylindricalJoint._set_angular_velocityc                 C   st   | j | j| j| j   | j| jd | j | jd | j | j| j	| j   | j
j| j | j| j d S r   )rA   r   r@   r   r   r   r   r&   r(   r   r?   r|   r   rC   rM   rH   rH   rI   r<   Y  s   z%CylindricalJoint._set_linear_velocity)	NNNNNNNNN)r   r   r   r   rJ   rN   r   r   r   r   r   r   r2   r4   r:   r;   r<   r   rH   rH   r   rI   r   =  s2     b




r   c                       s   e Zd ZdZ				d fdd	Zdd Zedd Zed	d
 Zedd Z	edd Z
edd Zedd Zdd Zdd Zdd Zdd Zdd Z  ZS )r   a*  Planar Joint.

    .. raw:: html
        :file: ../../../doc/src/modules/physics/mechanics/api/PlanarJoint.svg

    Explanation
    ===========

    A planar joint is defined such that the child body translates over a fixed
    plane of the parent body as well as rotate about the rotation axis, which
    is perpendicular to that plane. The origin of this plane is the
    ``parent_point`` and the plane is spanned by two nonparallel planar vectors.
    The location of the ``child_point`` is based on the planar vectors
    ($\vec{v}_1$, $\vec{v}_2$) and generalized coordinates ($q_1$, $q_2$),
    i.e. $\vec{r} = q_1 \hat{v}_1 + q_2 \hat{v}_2$. The direction cosine
    matrix between the ``child_interframe`` and ``parent_interframe`` is formed
    using a simple rotation ($q_0$) about the rotation axis.

    In order to simplify the definition of the ``PlanarJoint``, the
    ``rotation_axis`` and ``planar_vectors`` are set to be the unit vectors of
    the ``parent_interframe`` according to the table below. This ensures that
    you can only define these vectors by creating a separate frame and supplying
    that as the interframe. If you however would only like to supply the normals
    of the plane with respect to the parent and child bodies, then you can also
    supply those to the ``parent_interframe`` and ``child_interframe``
    arguments. An example of both of these cases is in the examples section
    below and the page on the joints framework provides a more detailed
    explanation of the intermediate frames.

    .. list-table::

        * - ``rotation_axis``
          - ``parent_interframe.x``
        * - ``planar_vectors[0]``
          - ``parent_interframe.y``
        * - ``planar_vectors[1]``
          - ``parent_interframe.z``

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    rotation_coordinate : dynamicsymbol, optional
        Generalized coordinate corresponding to the rotation angle. The default
        value is ``dynamicsymbols(f'q0_{joint.name}')``.
    planar_coordinates : iterable of dynamicsymbols, optional
        Two generalized coordinates used for the planar translation. The default
        value is ``dynamicsymbols(f'q1_{joint.name} q2_{joint.name}')``.
    rotation_speed : dynamicsymbol, optional
        Generalized speed corresponding to the angular velocity. The default
        value is ``dynamicsymbols(f'u0_{joint.name}')``.
    planar_speeds : dynamicsymbols, optional
        Two generalized speeds used for the planar translation velocity. The
        default value is ``dynamicsymbols(f'u1_{joint.name} u2_{joint.name}')``.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    rotation_coordinate : dynamicsymbol
        Generalized coordinate corresponding to the rotation angle.
    planar_coordinates : Matrix
        Two generalized coordinates used for the planar translation.
    rotation_speed : dynamicsymbol
        Generalized speed corresponding to the angular velocity.
    planar_speeds : Matrix
        Two generalized speeds used for the planar translation velocity.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates.
    speeds : Matrix
        Matrix of the joint's generalized speeds.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.
    rotation_axis : Vector
        The axis about which the rotation occurs.
    planar_vectors : list
        The vectors that describe the planar translation directions.

    Examples
    =========

    A single planar joint is created between two bodies and has the following
    basic attributes:

    >>> from sympy.physics.mechanics import RigidBody, PlanarJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = PlanarJoint('PC', parent, child)
    >>> joint
    PlanarJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.rotation_axis
    P_frame.x
    >>> joint.planar_vectors
    [P_frame.y, P_frame.z]
    >>> joint.rotation_coordinate
    q0_PC(t)
    >>> joint.planar_coordinates
    Matrix([
    [q1_PC(t)],
    [q2_PC(t)]])
    >>> joint.coordinates
    Matrix([
    [q0_PC(t)],
    [q1_PC(t)],
    [q2_PC(t)]])
    >>> joint.rotation_speed
    u0_PC(t)
    >>> joint.planar_speeds
    Matrix([
    [u1_PC(t)],
    [u2_PC(t)]])
    >>> joint.speeds
    Matrix([
    [u0_PC(t)],
    [u1_PC(t)],
    [u2_PC(t)]])
    >>> child.frame.ang_vel_in(parent.frame)
    u0_PC(t)*P_frame.x
    >>> child.frame.dcm(parent.frame)
    Matrix([
    [1,              0,             0],
    [0,  cos(q0_PC(t)), sin(q0_PC(t))],
    [0, -sin(q0_PC(t)), cos(q0_PC(t))]])
    >>> joint.child_point.pos_from(joint.parent_point)
    q1_PC(t)*P_frame.y + q2_PC(t)*P_frame.z
    >>> child.masscenter.vel(parent.frame)
    u1_PC(t)*P_frame.y + u2_PC(t)*P_frame.z

    To further demonstrate the use of the planar joint, the kinematics of a
    block sliding on a slope, can be created as follows.

    >>> from sympy import symbols
    >>> from sympy.physics.mechanics import PlanarJoint, RigidBody, ReferenceFrame
    >>> a, d, h = symbols('a d h')

    First create bodies to represent the slope and the block.

    >>> ground = RigidBody('G')
    >>> block = RigidBody('B')

    To define the slope you can either define the plane by specifying the
    ``planar_vectors`` or/and the ``rotation_axis``. However it is advisable to
    create a rotated intermediate frame, so that the ``parent_vectors`` and
    ``rotation_axis`` will be the unit vectors of this intermediate frame.

    >>> slope = ReferenceFrame('A')
    >>> slope.orient_axis(ground.frame, ground.y, a)

    The planar joint can be created using these bodies and intermediate frame.
    We can specify the origin of the slope to be ``d`` above the slope's center
    of mass and the block's center of mass to be a distance ``h`` above the
    slope's surface. Note that we can specify the normal of the plane using the
    rotation axis argument.

    >>> joint = PlanarJoint('PC', ground, block, parent_point=d * ground.x,
    ...                     child_point=-h * block.x, parent_interframe=slope)

    Once the joint is established the kinematics of the bodies can be accessed.
    First the ``rotation_axis``, which is normal to the plane and the
    ``plane_vectors``, can be found.

    >>> joint.rotation_axis
    A.x
    >>> joint.planar_vectors
    [A.y, A.z]

    The direction cosine matrix of the block with respect to the ground can be
    found with:

    >>> block.frame.dcm(ground.frame)
    Matrix([
    [              cos(a),              0,              -sin(a)],
    [sin(a)*sin(q0_PC(t)),  cos(q0_PC(t)), sin(q0_PC(t))*cos(a)],
    [sin(a)*cos(q0_PC(t)), -sin(q0_PC(t)), cos(a)*cos(q0_PC(t))]])

    The angular velocity of the block can be computed with respect to the
    ground.

    >>> block.frame.ang_vel_in(ground.frame)
    u0_PC(t)*A.x

    The position of the block's center of mass can be found with:

    >>> block.masscenter.pos_from(ground.masscenter)
    d*G_frame.x + h*B_frame.x + q1_PC(t)*A.y + q2_PC(t)*A.z

    Finally, the linear velocity of the block's center of mass can be
    computed with respect to the ground.

    >>> block.masscenter.vel(ground.frame)
    u1_PC(t)*A.y + u2_PC(t)*A.z

    In some cases it could be your preference to only define the normals of the
    plane with respect to both bodies. This can most easily be done by supplying
    vectors to the ``interframe`` arguments. What will happen in this case is
    that an interframe will be created with its ``x`` axis aligned with the
    provided vector. For a further explanation of how this is done see the notes
    of the ``Joint`` class. In the code below, the above example (with the block
    on the slope) is recreated by supplying vectors to the interframe arguments.
    Note that the previously described option is however more computationally
    efficient, because the algorithm now has to compute the rotation angle
    between the provided vector and the 'x' axis.

    >>> from sympy import symbols, cos, sin
    >>> from sympy.physics.mechanics import PlanarJoint, RigidBody
    >>> a, d, h = symbols('a d h')
    >>> ground = RigidBody('G')
    >>> block = RigidBody('B')
    >>> joint = PlanarJoint(
    ...     'PC', ground, block, parent_point=d * ground.x,
    ...     child_point=-h * block.x, child_interframe=block.x,
    ...     parent_interframe=cos(a) * ground.x + sin(a) * ground.z)
    >>> block.frame.dcm(ground.frame).simplify()
    Matrix([
    [               cos(a),              0,               sin(a)],
    [-sin(a)*sin(q0_PC(t)),  cos(q0_PC(t)), sin(q0_PC(t))*cos(a)],
    [-sin(a)*cos(q0_PC(t)), -sin(q0_PC(t)), cos(a)*cos(q0_PC(t))]])

    Nc                    s2   ||f}||f}t  j|||||||	|
|d	 d S r   )r   rJ   )r=   r'   r>   r?   r   planar_coordinatesr   planar_speedsr@   rA   rB   rC   r6   r7   r   rH   rI   rJ   y  s   
zPlanarJoint.__init__c                 C   r   )NzPlanarJoint: r   r   r   rM   rH   rH   rI   rN     r   zPlanarJoint.__str__c                 C   r   r   r   rM   rH   rH   rI   r     r   zPlanarJoint.rotation_coordinatec                 C      | j dddf S )z<Two generalized coordinates used for the planar translation.rb   Nr   r   rM   rH   rH   rI   r        zPlanarJoint.planar_coordinatesc                 C   r   r   r   rM   rH   rH   rI   r     r   zPlanarJoint.rotation_speedc                 C   r   )z@Two generalized speeds used for the planar translation velocity.rb   Nr   r   rM   rH   rH   rI   r     r   zPlanarJoint.planar_speedsc                 C   s   | j jS )z)The axis about which the rotation occurs.)rB   r[   rM   rH   rH   rI   rq     s   zPlanarJoint.rotation_axisc                 C   s   | j j| j jgS )z<The vectors that describe the planar translation directions.)rB   rd   re   rM   rH   rH   rI   planar_vectors  s   zPlanarJoint.planar_vectorsc                 C   4   | j |d dddd}|  |d ddd}||S )Nr   rb   r   Tr   rc   r   col_join)r=   r6   r   r   rH   rH   rI   r2     
   
z!PlanarJoint._generate_coordinatesc                 C   r   )Nr   rb   r   Tr   rc   r   )r=   r7   r   r   rH   rH   rI   r4     r   zPlanarJoint._generate_speedsc                 C   s   | j | j| j| j d S rL   )rC   rk   rB   rq   r   rM   rH   rH   rI   r:     s   zPlanarJoint._orient_framesc                 C   s   | j | j| j| j  d S rL   )rC   rl   rB   r   rq   rM   rH   rH   rI   r;     s   
z!PlanarJoint._set_angular_velocityc                 C   s   | j | j| jd | jd  | jd | jd    | j| jd | j | jd | j | j| j	d | jd  | j	d | jd    | j
j| j | j| j d S )Nr   rb   )rA   r   r@   r   r   r   rB   rC   r&   r   r?   r|   r   r(   rM   rH   rH   rI   r<     s    z PlanarJoint._set_linear_velocity)NNNNNNNN)r   r   r   r   rJ   rN   r   r   r   r   r   rq   r   r2   r4   r:   r;   r<   r   rH   rH   r   rI   r   f  s6      





r   c                       sZ   e Zd ZdZ				d fdd	Zdd Zd	d
 Zdd Zdd Zdd Z	dd Z
  ZS )r   a^  Spherical (Ball-and-Socket) Joint.

    .. image:: SphericalJoint.svg
        :align: center
        :width: 600

    Explanation
    ===========

    A spherical joint is defined such that the child body is free to rotate in
    any direction, without allowing a translation of the ``child_point``. As can
    also be seen in the image, the ``parent_point`` and ``child_point`` are
    fixed on top of each other, i.e. the ``joint_point``. This rotation is
    defined using the :func:`parent_interframe.orient(child_interframe,
    rot_type, amounts, rot_order)
    <sympy.physics.vector.frame.ReferenceFrame.orient>` method. The default
    rotation consists of three relative rotations, i.e. body-fixed rotations.
    Based on the direction cosine matrix following from these rotations, the
    angular velocity is computed based on the generalized coordinates and
    generalized speeds.

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    coordinates: iterable of dynamicsymbols, optional
        Generalized coordinates of the joint.
    speeds : iterable of dynamicsymbols, optional
        Generalized speeds of joint.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.
    rot_type : str, optional
        The method used to generate the direction cosine matrix. Supported
        methods are:

        - ``'Body'``: three successive rotations about new intermediate axes,
          also called "Euler and Tait-Bryan angles"
        - ``'Space'``: three successive rotations about the parent frames' unit
          vectors

        The default method is ``'Body'``.
    amounts :
        Expressions defining the rotation angles or direction cosine matrix.
        These must match the ``rot_type``. See examples below for details. The
        input types are:

        - ``'Body'``: 3-tuple of expressions, symbols, or functions
        - ``'Space'``: 3-tuple of expressions, symbols, or functions

        The default amounts are the given ``coordinates``.
    rot_order : str or int, optional
        If applicable, the order of the successive of rotations. The string
        ``'123'`` and integer ``123`` are equivalent, for example. Required for
        ``'Body'`` and ``'Space'``. The default value is ``123``.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates.
    speeds : Matrix
        Matrix of the joint's generalized speeds.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.

    Examples
    =========

    A single spherical joint is created from two bodies and has the following
    basic attributes:

    >>> from sympy.physics.mechanics import RigidBody, SphericalJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = SphericalJoint('PC', parent, child)
    >>> joint
    SphericalJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.parent_interframe
    P_frame
    >>> joint.child_interframe
    C_frame
    >>> joint.coordinates
    Matrix([
    [q0_PC(t)],
    [q1_PC(t)],
    [q2_PC(t)]])
    >>> joint.speeds
    Matrix([
    [u0_PC(t)],
    [u1_PC(t)],
    [u2_PC(t)]])
    >>> child.frame.ang_vel_in(parent.frame).to_matrix(child.frame)
    Matrix([
    [ u0_PC(t)*cos(q1_PC(t))*cos(q2_PC(t)) + u1_PC(t)*sin(q2_PC(t))],
    [-u0_PC(t)*sin(q2_PC(t))*cos(q1_PC(t)) + u1_PC(t)*cos(q2_PC(t))],
    [                             u0_PC(t)*sin(q1_PC(t)) + u2_PC(t)]])
    >>> child.frame.x.to_matrix(parent.frame)
    Matrix([
    [                                            cos(q1_PC(t))*cos(q2_PC(t))],
    [sin(q0_PC(t))*sin(q1_PC(t))*cos(q2_PC(t)) + sin(q2_PC(t))*cos(q0_PC(t))],
    [sin(q0_PC(t))*sin(q2_PC(t)) - sin(q1_PC(t))*cos(q0_PC(t))*cos(q2_PC(t))]])
    >>> joint.child_point.pos_from(joint.parent_point)
    0

    To further demonstrate the use of the spherical joint, the kinematics of a
    spherical joint with a ZXZ rotation can be created as follows.

    >>> from sympy import symbols
    >>> from sympy.physics.mechanics import RigidBody, SphericalJoint
    >>> l1 = symbols('l1')

    First create bodies to represent the fixed floor and a pendulum bob.

    >>> floor = RigidBody('F')
    >>> bob = RigidBody('B')

    The joint will connect the bob to the floor, with the joint located at a
    distance of ``l1`` from the child's center of mass and the rotation set to a
    body-fixed ZXZ rotation.

    >>> joint = SphericalJoint('S', floor, bob, child_point=l1 * bob.y,
    ...                        rot_type='body', rot_order='ZXZ')

    Now that the joint is established, the kinematics of the connected body can
    be accessed.

    The position of the bob's masscenter is found with:

    >>> bob.masscenter.pos_from(floor.masscenter)
    - l1*B_frame.y

    The angular velocities of the pendulum link can be computed with respect to
    the floor.

    >>> bob.frame.ang_vel_in(floor.frame).to_matrix(
    ...     floor.frame).simplify()
    Matrix([
    [u1_S(t)*cos(q0_S(t)) + u2_S(t)*sin(q0_S(t))*sin(q1_S(t))],
    [u1_S(t)*sin(q0_S(t)) - u2_S(t)*sin(q1_S(t))*cos(q0_S(t))],
    [                          u0_S(t) + u2_S(t)*cos(q1_S(t))]])

    Finally, the linear velocity of the bob's center of mass can be computed.

    >>> bob.masscenter.vel(floor.frame).to_matrix(bob.frame)
    Matrix([
    [                           l1*(u0_S(t)*cos(q1_S(t)) + u2_S(t))],
    [                                                             0],
    [-l1*(u0_S(t)*sin(q1_S(t))*sin(q2_S(t)) + u1_S(t)*cos(q2_S(t)))]])

    NBODY{   c                    s4   |
| _ || _|| _t j|||||||||	d	 d S r   )	_rot_type_amounts
_rot_orderr   rJ   )r=   r'   r>   r?   r6   r7   r@   rA   rB   rC   rot_typeamounts	rot_orderr   rH   rI   rJ     s   
zSphericalJoint.__init__c                 C   r   )NzSphericalJoint: r   r   r   rM   rH   rH   rI   rN     r   zSphericalJoint.__str__c                 C   r   )N   r   r   rV   rH   rH   rI   r2     r   z$SphericalJoint._generate_coordinatesc                 C   s   |  |t| jdS )Nr   )r   rv   r6   rX   rH   rH   rI   r4     r   zSphericalJoint._generate_speedsc                 C   sZ   d}| j  |vrtd| j  d| | jd u r| jn| j}| j| j| j || j d S )N)r   SPACEzRotation type "z6" is not implemented. Implemented rotation types are: )	r   upperNotImplementedErrorr   r6   rC   orientrB   r   )r=   supported_rot_typesr   rH   rH   rI   r:     s   
zSphericalJoint._orient_framesc                    sF   t j | j| j fddt| j| jD }| j	| j| d S )Nc                    s   i | ]
\}}|  |qS rH   )rx   ).0r   r   ry   rH   rI   
<dictcomp>  s    z8SphericalJoint._set_angular_velocity.<locals>.<dictcomp>)
r   rt   rC   r   rB   xreplacezipr6   r7   rl   )r=   velrH   r   rI   r;     s
   z$SphericalJoint._set_angular_velocityc                 C   r   r   r   rM   rH   rH   rI   r<     s   z#SphericalJoint._set_linear_velocity)	NNNNNNr   Nr   r   r   r   r   rJ   rN   r2   r4   r:   r;   r<   r   rH   rH   r   rI   r     s     L
r   c                       sV   e Zd ZdZ		d fdd	Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
  ZS )r   a  Weld Joint.

    .. raw:: html
        :file: ../../../doc/src/modules/physics/mechanics/api/WeldJoint.svg

    Explanation
    ===========

    A weld joint is defined such that there is no relative motion between the
    child and parent bodies. The direction cosine matrix between the attachment
    frame (``parent_interframe`` and ``child_interframe``) is the identity
    matrix and the attachment points (``parent_point`` and ``child_point``) are
    coincident. The page on the joints framework gives a more detailed
    explanation of the intermediate frames.

    Parameters
    ==========

    name : string
        A unique name for the joint.
    parent : Particle or RigidBody or Body
        The parent body of joint.
    child : Particle or RigidBody or Body
        The child body of joint.
    parent_point : Point or Vector, optional
        Attachment point where the joint is fixed to the parent body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the parent's mass
        center.
    child_point : Point or Vector, optional
        Attachment point where the joint is fixed to the child body. If a
        vector is provided, then the attachment point is computed by adding the
        vector to the body's mass center. The default value is the child's mass
        center.
    parent_interframe : ReferenceFrame, optional
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the parent's own frame.
    child_interframe : ReferenceFrame, optional
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated. If a Vector is provided then an interframe
        is created which aligns its X axis with the given vector. The default
        value is the child's own frame.

    Attributes
    ==========

    name : string
        The joint's name.
    parent : Particle or RigidBody or Body
        The joint's parent body.
    child : Particle or RigidBody or Body
        The joint's child body.
    coordinates : Matrix
        Matrix of the joint's generalized coordinates. The default value is
        ``dynamicsymbols(f'q_{joint.name}')``.
    speeds : Matrix
        Matrix of the joint's generalized speeds. The default value is
        ``dynamicsymbols(f'u_{joint.name}')``.
    parent_point : Point
        Attachment point where the joint is fixed to the parent body.
    child_point : Point
        Attachment point where the joint is fixed to the child body.
    parent_interframe : ReferenceFrame
        Intermediate frame of the parent body with respect to which the joint
        transformation is formulated.
    child_interframe : ReferenceFrame
        Intermediate frame of the child body with respect to which the joint
        transformation is formulated.
    kdes : Matrix
        Kinematical differential equations of the joint.

    Examples
    =========

    A single weld joint is created from two bodies and has the following basic
    attributes:

    >>> from sympy.physics.mechanics import RigidBody, WeldJoint
    >>> parent = RigidBody('P')
    >>> parent
    P
    >>> child = RigidBody('C')
    >>> child
    C
    >>> joint = WeldJoint('PC', parent, child)
    >>> joint
    WeldJoint: PC  parent: P  child: C
    >>> joint.name
    'PC'
    >>> joint.parent
    P
    >>> joint.child
    C
    >>> joint.parent_point
    P_masscenter
    >>> joint.child_point
    C_masscenter
    >>> joint.coordinates
    Matrix(0, 0, [])
    >>> joint.speeds
    Matrix(0, 0, [])
    >>> child.frame.ang_vel_in(parent.frame)
    0
    >>> child.frame.dcm(parent.frame)
    Matrix([
    [1, 0, 0],
    [0, 1, 0],
    [0, 0, 1]])
    >>> joint.child_point.pos_from(joint.parent_point)
    0

    To further demonstrate the use of the weld joint, two relatively-fixed
    bodies rotated by a quarter turn about the Y axis can be created as follows:

    >>> from sympy import symbols, pi
    >>> from sympy.physics.mechanics import ReferenceFrame, RigidBody, WeldJoint
    >>> l1, l2 = symbols('l1 l2')

    First create the bodies to represent the parent and rotated child body.

    >>> parent = RigidBody('P')
    >>> child = RigidBody('C')

    Next the intermediate frame specifying the fixed rotation with respect to
    the parent can be created.

    >>> rotated_frame = ReferenceFrame('Pr')
    >>> rotated_frame.orient_axis(parent.frame, parent.y, pi / 2)

    The weld between the parent body and child body is located at a distance
    ``l1`` from the parent's center of mass in the X direction and ``l2`` from
    the child's center of mass in the child's negative X direction.

    >>> weld = WeldJoint('weld', parent, child, parent_point=l1 * parent.x,
    ...                  child_point=-l2 * child.x,
    ...                  parent_interframe=rotated_frame)

    Now that the joint has been established, the kinematics of the bodies can be
    accessed. The direction cosine matrix of the child body with respect to the
    parent can be found:

    >>> child.frame.dcm(parent.frame)
    Matrix([
    [0, 0, -1],
    [0, 1,  0],
    [1, 0,  0]])

    As can also been seen from the direction cosine matrix, the parent X axis is
    aligned with the child's Z axis:
    >>> parent.x == child.z
    True

    The position of the child's center of mass with respect to the parent's
    center of mass can be found with:

    >>> child.masscenter.pos_from(parent.masscenter)
    l1*P_frame.x + l2*C_frame.x

    The angular velocity of the child with respect to the parent is 0 as one
    would expect.

    >>> child.frame.ang_vel_in(parent.frame)
    0

    Nc                    s2   t  j|||g g ||||d	 tddg j| _d S )Nr   rb   r   )r   rJ   r   Tr9   )r=   r'   r>   r?   r@   rA   rB   rC   r   rH   rI   rJ   p  s
   zWeldJoint.__init__c                 C   r   )NzWeldJoint: r   r   r   rM   rH   rH   rI   rN   w  r   zWeldJoint.__str__c                 C      t  S rL   r   r   rH   rH   rI   r2   {  rO   zWeldJoint._generate_coordinatesc                 C   r   rL   r   r   rH   rH   rI   r4   ~  rO   zWeldJoint._generate_speedsc                 C   s   | j | j| jjd d S r   )rC   rk   rB   r[   rM   rH   rH   rI   r:     s   
zWeldJoint._orient_framesc                 C   r   r   r   rM   rH   rH   rI   r;     r   zWeldJoint._set_angular_velocityc                 C   sF   | j | jd | j| jd | j | jd | jj| jd d S r   )rA   r   r@   r   r&   r(   r?   r|   rM   rH   rH   rI   r<     s   zWeldJoint._set_linear_velocity)NNNNr   rH   rH   r   rI   r     s     )r   N)abcr   r   sympyr   r   r   sympy.core.functionr   !sympy.physics.mechanics.body_baser   !sympy.physics.mechanics.functionsr	   sympy.physics.vectorr
   r   r   r   r   sympy.utilities.iterablesr   sympy.utilities.exceptionsr   __all__r   r   r   r   r   r   r   rH   rH   rH   rI   <module>   s:           	  +  h |