-
Notifications
You must be signed in to change notification settings - Fork 0
RBDyn problem
Carlos Adir edited this page Oct 31, 2021
·
1 revision
So, Rigid body dynamics problems are problems that are described by the following requirements:
- There is a inertial frame of reference, static, absolute, that we call
R0
, in the origin - There are some referential frames, which are relatively connected to the frame
R0
usingtranslation
androtation
vectors - There are some bodies in the space
- with a Reference Frame called
baseframe
, which moves and rotates with the object. - with a mass
m
- with a center of mass
CM
, relative to thebaseframe
- with a moment of inertia
II
, relative to thebaseframe
- with a Reference Frame called
- Initial configuration of the system:
position
andvelocity
att=0
for each object
On the page Exemple: Simple Pendulum (Angular parameterization) we have the mathematical description of the problem.
The code to describe the problem is:
import rbdyn
# Definition of constant values
a = 1 # radius
m = 1 # mass
# Definition of the variables
theta = rbdyn.variable("theta")
# Definition of the frames of reference
R0 = rbdyn.FrameReference() # Inertial frame of reference
R1 = rbdyn.FrameReference(R0, rotation=(theta, "z"))
R2 = rbdyn.FrameReference(R1, translation=(a, 0, 0))
ball = rbdyn.Object(R2, name="ball")
ball.mass = m
E = ball.KineticEnergy(R0)
print("Kinetic Energy = ")
print(E)
gives us the result
Kinetic Energy =
0.5 * m * dtheta**2
The second example, we have a bar of mass m
, length l
, its center at the position (x, y, 0)
and it's rotationed at an angle theta
relative to the vector z
. So, we describe the problem as
import rbdyn
# Definition of constant values
m = 1 # The mass
l = 1 # The bar's length
# Definition of the variables
x = rbdyn.variable("x")
y = rbdyn.variable("y")
theta = rbdyn.variable("theta")
# Definition of the frames of reference
R0 = rbdyn.FrameReference() # Inertial frame of reference
R1 = rbdyn.FrameReference(base=R0, translation=(x, y, 0))
R2 = rbdyn.FrameReference(base=R1, rotation=(theta, "z"))
# Definition of the object
CM = (0, 0, 0) # Center of mass
II = (l**2 / 12) * np.array([[0, 0, 0],
[0, 1, 0],
[0, 0, 1]])
bar = Objet(base=R2, name="bar")
bar.mass = m # Put the mass into the object
bar.CM = CM # Put the CM into the object
bar.II = II # Put the kinematic moment of inertia tensor
# Calculus of Kinetic Energy relative of the frame R0
E = bar.KineticEnergy(R0)
print("Kinetic Energy = ")
print(E)
And it gives the result
Kinetic Energy =
m * (0.0833333333333333 * l**2 * dtheta**2 + dx**2 + dy**2) / 2