Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC] Planar Joint #24046

Merged
merged 5 commits into from
Sep 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions sympy/physics/mechanics/joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,31 @@ class PlanarJoint(Joint):
>>> block.masscenter.vel(ground.frame)
u1_PC(t)*A.x + u2_PC(t)*A.y

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.
tjstienstra marked this conversation as resolved.
Show resolved Hide resolved
Note that the previously described option is however more computationally
efficient.
tjstienstra marked this conversation as resolved.
Show resolved Hide resolved

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

Notes
=====

Expand Down