You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this project, a rigid bar is connected to two sliding pistons along
the diagonal tracks. As the pistons move along the tracks, the rigid bar rotates at a constant rate, $\dot{\theta}_3 = 2~rad/s$. The figure above has three relative coordinate systems that move with the bodies:
$x_1-y_1-$ describes piston 1 position and orientation, $\theta_1$
$x_2-y_2-$ describes piston 2 position and orientation, $\theta_2$
$x_3-y_3-$ describes the rigid bar position and orientation, $\theta_3$
Each of the pistons are on tracks at $\pm 45^o$ and the rotating rigid
bar is 10 cm. The hinges are mounted to the center of the pistons
connecting the ends of the rigid bar.
In this project, you need to
determine constraint equations $C(\mathbf{q},~t)$
solve for the velocities, $\dot{q}$ and accelerations, $\ddot{q}$
visualize the motion of the system as the rigid bar goes through at least one full rotation
Results
Mechanism Animation (2 Full Rotations)
Kinematic Dashboard
Positions vs. Time
Velocities vs. Time
Accelerations vs. Time
Piston Trajectories
Bar Center Trajectory
Conclusions
Several conclusions can be drawn from the results above. First, the piston trajectories confirm that Piston 1 slides along the $+45^{\circ}$ track and Piston 2 slides along the $-45^{\circ}$ track, as enforced by the prismatic joint constraints. The bar center traces a perfect circle of radius $L/2 = 0.05$ m.
From the position plots, one can observe that $x_1$, $y_1$, $\theta_1$, and $x_2$, $y_2$, $\theta_2$ are consistent with their respective constraint equations. This can also be observed for all generalized parameters in the velocity and acceleration plots, thus confirming that the constraints were implemented correctly and the simulation returned a valid solution. Furthermore, since the bar rotates at a constant rate, the position, velocity, and acceleration plots all exhibit sinusoidal behavior.
The analytical validation printout demonstrates that the numerical solver (using the NonlinearSolve package for positions and the backslash operator for velocities and accelerations) agrees with the analytical solution to within floating-point precision. The constraint residual also remains effectively zero throughout the simulation, verifying that all constraints are satisfied at every time step.
Overall, this project demonstrates the capabilities of using constraint-based methods to solve kinematics problems. By creating constraint equations, computing their Jacobian, and solving for the system's position, velocity, and acceleration at each time step, one can analyze complex problems without deriving explicit equations of motion. Furthermore, this general framework can be extended to systems with more bodies and/or constraints!
Derivations
Note: the following derivations use GitHub-compatible Markdown/LaTeX formatting. Certain expressions (e.g., subscripts or matrix notation) may need modification for standard LaTeX/Markdown environments.
In planar (2D) multibody dynamics, each unconstrained body has 3 degrees of freedom:
Translation in the $x$-direction
Translation in the $Y$-direction
Rotation by angle $\theta$. Therefore, the generalized coordinate vector for this project can be expressed as:
If a the center of body i is located at $\vec{R}_i = [x_i, y_i]^T$ in the global coordinate system and orientation $\theta_i$, then point p located at $\vec{s}^{(i)} = [s_x, s_y]^T$ in the body's local frame has global position:
For the system above, the hinges are mounted at the center of each piston. So the hinge location in each piston's local frame is at the origin: $\vec{s}_1 = \vec{s}_2 = [0, 0]^T$. Therefore, the hinge for each piston can be expressed in global coordinates as:
Now, the rigid bar has length $L$, and its local $x$-axis runs along its length. The center of the bar in global coordinates can be expressed as $\vec{R}_{3} = [x_3, y_3]^T$. End A connects to Piston 1 at local coordinates $\vec{s}_{3A} = \left[-\frac{L}{2}, 0\right]^T$. In global coordinates, this can be expressed as:
The constraint equations can now be assembled. A prismatic (sliding) joint constrains Piston 1 to the $+45^\circ$ track. Therefore, the center of Piston 1 is constrained to:
$$
C_1 = y_1 - x_1 = 0
$$
and its orientation is constrained to:
$$
C_2 = \theta_1 - \pi/4 = 0
$$
Similarly, a prismatic (sliding) joint also constrains Piston 2 to the $-45^\circ$ track. Therefore, the center of Piston 2 is constrained to:
$$
C_3 = y_2 + x_2 = 0
$$
and its orientation is constrained to:
$$
C_4 = \theta_2 + \pi/4 = 0
$$
Next, a revolute (hinge) joint connects the center of Piston 1 to end A of the bar. As a result, these two points must have the same global position:
The solution process for the system above will consist of 3 sequential steps at each time step $t_i$:
Step 01: Solve for Positions (Nonlinear)
Find $\vec{q}$ such that $\vec{C}\left(\vec{q}, t\right) = \vec{0}$ using a nonlinear iterative solver and the solution from the previous step as an initial guess.
Step 02: Solve for Velocities (Linear)
Solve $C_q , \dot{\vec{q}} = -\vec{C}_t$ for $\dot{\vec{q}}$ using positions found in Step 01.
Step 03: Solve for Accelerations (Linear)
Solve $C_q , \ddot{\vec{q}} = \vec{\gamma}$ for $\ddot{\vec{q}}$ using both positions found in Step 01 and velocities found in Step 02.
The coordinates of the system above can also be solved for analytically. The analytical solution can be used as an initial guess for the numerical solver, and also as a benchmark to verify the numerical results. From constraint equations $C_5$ and $C_6$: