A toolkit for 3D dynamics and kinematics
Project description
pydynkin - A python version of dynkin
A toolkit for 3D dynamics and kinematics of rigid bodies using the YPR euler angle convention.
Note: dynkin
is also available in a C++ version, available here: https://github.com/freol35241/dynkin
General
dynkin
is a set of tools for handling the dynamics and kinematics of rigid bodies in 3 dimensions (6DOFs). Some features:
- Homogenous transformation matrices
- Chained reference frames
- Idealized rigid body implementation
The fundamentals of reference frames and the kinematic relations of these are based on Theory of Applied Robotics (Reza N. Jazar) , the idealized rigid body implementation follows the outline suggested in the lectures by Fossen.
Installation
pip install dynkin
Theory intro
Some basic notions:
- A reference
Frame
is defined indynkin
as an object whichpositions
,vectors
,velocities
,accelerations
etc can be decomposed in.dynkin
represents referenceFrame
s by (4x4) homogenous transformation matrices. AFrame
is aligned (positioned, rotated) and moves (linear and angular velocity) in relation to anotherFrame
or the inertial frame (represented byNone
). - The
pose
of aFrame
is its generalized position and thetwist
of aFrame
is its generalized velocity, both in relation to the inertial frame. - All rotations in
dynkin
are internally represented by rotation matrices but the external API, so far, deals only with Euler angles of the YPR (Yaw-Pitch-Roll) convention. - A
kinematic chain
is a single-linked list ofFrame
s, where eachFrame
holds a reference to its closest parent. Any number ofFrame
s may be attached into such a chain and the chain may also have any number of branches, it is however the user´s responsibility to ensure no kinematic loops occur. - A
transform
is an object relating twoFrame
s enabling transformation ofpositions
,vectors
,velocities
etc from oneFrame
to the other. TheFrame
s do not need to be part of the samekinematic chain
. - A
RigidBody
is a 3D body with arbitrary extent that may be described by a generalized inertia matrix (6x6). It accelerates when subject to generalized external forces (wrenches
) and rotational velocities give rise to inertial forces (coriolis and centripetal contributions).
Examples
Single frame
from dynkin import Frame, transform
frame1 = Frame(position=[1, 2, 3], attitude=[0, 0, 90], degrees=True)
# Find transformation from the inertial frame to frame1
ti1 = transform(None, frame1)
# Transformation of vector
v1_decomposed_in_frame1 = ti1.apply_vector(v1_decomposed_in_inertial_frame)
# Transformation of position
p1_decomposed_in_frame1 = ti1.apply_position(p1_decomposed_in_inertial_frame)
# Transformation of wrench
w1_decomposed_in_frame1 = ti1.apply_wrench(w1_decomposed_in_inertial_frame)
# Find the inverse transformation
t1i = ti1.inv()
# Pose of this frame, decomposed in inertial frame
frame1.get_pose()
# Twist of this frame, decomposed in inertial frame
frame.get_twist()
Two frames
from dynkin import Frame, transform
frame1 = Frame(position=[1, 2, 3], attitude=[0, 0, 90], degrees=True)
frame2 = Frame(position=[3, 2, 1], attitude=[0, 0, -90], degrees=True)
# Find transformation from frame1 to frame2
t12 = transform(frame1, frame2)
# Transformation of vector
v1_decomposed_in_frame2 = t12.apply_vector(v1_decomposed_in_frame1)
# Transformation of position
p1_decomposed_in_frame2 = t12.apply_position(p1_decomposed_in_frame1)
# Transformation of wrench
w1_decomposed_in_frame2 = t12.apply_wrench(w1_decomposed_in_frame1)
# Find the inverse transformation
t21 = t12.inv()
Kinematic chains
from dynkin import Frame, transform
frame1 = Frame(position=[1, 2, 3], attitude=[0, 0, 90], degrees=True)
frame2 = frame1.align_child(position=[3, 2, 1], attitude=[0, 0, -90], degrees=True)
frame3 = frame2.align_child(position=[1, 1, 1], attitude=[0, 0, 0], degrees=True)
# Find transformation from inertial frame to frame3
ti3 = transform(None, frame3)
# Transformation from frame3 and frame1
t31 = transform(frame3, frame1)
...
TODO: RigidBody example
License
Distributed under the terms of the MIT license, dynkin
is free and open source software
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file dynkin-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: dynkin-0.2.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa570c4caabd8e13b3e731569052e64a2a3732ec03a00233fde395ae15ec17c7 |
|
MD5 | ffe75fb724f7a813b51a3e110ee6e268 |
|
BLAKE2b-256 | c846a24cf754215012539b50c28f999982a9984c1086f9e3e18dbc901a461d39 |