New video: Creating Kinematic Constraints #20
Replies: 31 comments 3 replies
|
In order to determine the constraint equations for the same door with a sliding (or prismatic) constraint, we can begin by trying to understand what the sliding joint does physically. A sliding joint allows translation of the door in one direction only (let's say along the x-axis). Therefore, the sliding joint constrains translation in the y-direction, and prevents rotation. In this example, we can assume that the sliding constraint is applied at the Center of Mass (COM) of the door (if it wasn't, we would have to include an offset term and a rotation matrix (which would reduce to the identity matrix due to the constraint on Since the door cannot translate in the y-direction, and it cannot rotate, we can write its position constraints as: Therefore, we can see that only where and Our velocity constraint equations can be expressed in matrix form as: From this, we can see that the door's angular velocity |
|
To find the constraints about a sliding (prismatic) constraint, we have to take a look at what degrees of freedom are being removed compared to a hinge. While a hinge allows a door to rotate but keeps one point fixed in space, a prismatic joint does the exact opposite, allowing the door to slide along an axis but not rotate at all. If we assume the door is sliding along a horizontal track (the x-axis), we are effectively fixing vertical position and rotation. The door is not allowed to move up or down (meaning y=0) and the door can't swing or tilt either (meaning theta=0). This leaves only the horizontal position (the x-axis) free to change, which means our 3-DOF system has now been restrained to a 1-DOF system and is much easier to analyze as a result. In terms of the math we are doing in Julia, this means the Jacobian matrix for this joint will essentially act as a filter that zeroes out any vertical or rotational velocity. When we eventually plug this into our MBD equations, the computer will only solve for the acceleration along the track, treating the door like a block on a rail rather than a swinging pendulum |
|
A planar prismatic (sliding) constraint cannot use the hinge equation directly; instead, it replaces the hinge’s two position constraints with a single scalar constraint that forces a point on the body to lie on a line (the slide axis), and adds a second scalar constraint that locks the body’s orientation relative to that axis. Using the same notation as the notes, if R_1+A(θ_1 ) r^((1) ) is a point on the body, then the constraints are: (1) n^T (R_1+A(θ_1 ) r^((1) )−R_a^((0) ))=0, which enforces no motion perpendicular to the rail, and (2) θ_1−θ_rail−θ_0=0, which prevents rotation. Together these give two scalar equations, leaving one degree of freedom—translation along the slide axis. |
|
It became clear while trying to follow the video that the framing used to create the constraints for the hinge will not work for a slider, since there is not a singular point of the door that is equal in both coordinate systems like the hinge in the video. The slider creates a condition where the theta value does not change and the x and y values both change linearly. If you orient the door to have the central axis coincident with the x axis, then you can say that y=0. This would make the problem as simple as f=ma and basic kinematics to calculate velocity and distance from the origin. Leaving it in the original orientation from the video would create a similar result with trigonometry added to the equations to account for the angle. Pushing on the door like in the simulation would result in no change, so a different force would need to be applied for any change to be observed. |
|
A prismatic (sliding) joint constrains a rigid body to translate along a single direction while preventing any rotation. In 2D, this is enforced by one position constraint that keeps the body on a fixed line, e_y(x − x0) − e_x(y − y0) = 0, where e = (e_x, e_y) defines the sliding direction, and a second constraint that fixes orientation, θ = constant. Together, these remove two degrees of freedom, leaving only motion along the line. Differentiating yields the velocity constraints e_y x_dot − e_x y_dot = 0 and θ_dot = 0, ensuring consistent motion in multibody dynamic formulations. |
|
A planar prismatic joint is made by constraining a body to a fixed point to remain on a line and preventing relative rotation so instead of having multiple degrees of freedom it reduces to just one. If the rail has unit direction a and unit normal n, and a body point P has ground position p=r+A(θ)s_P, then the constraints of on rail with(no perpendicular motion: n^T(p-r_0)=0 and no rotation: θ−θ_0=0 |
|
A prismatic joint is the translational counterpart to a revolute joint. Instead of freeing rotation while locking position, it frees translation along one axis while locking everything else. In 2D this still produces two constraint equations: one enforcing that the two bodies don't rotate relative to each other (the sliding axes stay parallel), and one enforcing that relative motion stays on-axis. Written out: v_i · u_j = 0 and v_i · d_ij = 0, where u_i, v_i are unit vectors along and perpendicular to the sliding axis on body i, and d_ij is the vector connecting reference points on each body. With two constraints, one DOF remains which is just translation instead of rotation. |
|
A prismatic joint gives the body one translational degree of freedom along a line and removes other motions, it prevents motion normal to the slot and relative motion. Starting with the generalized coordinates of x,y, and theta, we can build constraint equations based on the So our final position constraints are: So our constraint Jacobian is: Cq = [∂C/∂q] = And our velocity constraint is Cq q̇ = [0, 0]ᵀ |
|
It is interesting to see how this example differs from the previous hinged door, and how to apply the prismatic constraint. The door is no longer allowed to rotate, so its motion is limited to translation along a single direction and can be written in generalized coordinates: q=[𝑥1, 𝑦1, 𝜃1] where 𝜃1=0 and 𝑦1=0. (I think cjdipietrantonio did a good job putting this into matrix form to represent this clearly). |
|
I notice for this problem that at first glance it seems like it can be solved easily using radius and theta. If we have x be r cos(theta) and y be r sin theta, it can be graphed really easily. However, this is an insanely simplified idea that doesn't include the thickness and height of the door along with center of mass. I did notice that this idea of having a reference frame and a frame on the door itself is like the exact same idea of what I am doing in my aerospace control system class. We have to be able to compare the internal frame of the ground to the internal frame of our quadcopter model. This conversion of frames (like in this video x_o y_o and x_1 and y_1) need to be able to be compared and how to get from one another. I wonder if I can apply this idea of constraints to my aerospace class. If we have a 2d slider, then the constraints of the body would be [x y theta] ' . For a rotational constraint, theta_rot would have to be zero, because the bodies cannot rotate in different ways. Using the cosine and sine matrix from the video, we can figure out the translational constraint for the x and y values for two different points in a slider. So this would look like C2 = -(x_i - x_j)sin(theta) + (y_i - y_j) cos(theta) from my derivations. Finally this can then be in terms of r_i and r_j, where we have r_i = [x_i y_i]'+A * r_o_i and r_j = [x_j y_j] + A_j * r_o_j. If we wanted we can then be able to graph the position of this in respect to time. |
|
To build the equation, we first need to look at what degrees of freedom are removed compared to a hinge. A hinge allows rotation about a fixed point, but a prismatic joint does the opposite: it removes rotation entirely and only allows translation along a single axis. If we assume the motion is constrained along the x-axis (like a horizontal rail), then the system is restricted so that there is no vertical motion and no rotation. That means y=0 and θ=0, leaving only translation along x as the single degree of freedom. So a 3-DOF rigid body effectively becomes a 1-DOF system. In a full MBD formulation, the solver would then only compute acceleration along the rail, treating the body like a block constrained to slide rather than rotate. |
|
A prismatic constraint is basically the opposite of a hinge. Instead of fixing a point and having rotation around the point, a prismatic constraint allows translation along one direction while restricting any rotation. This leads to two constraint equations and one degree of freedom for the motion along the slider. The equation for the first constraint for the body on the fixed line would be: |
|
A prismatic joint removes two degrees if freedom from a planar rigid body, leaving only translation along a specified axis. Starting from generalized coordinates q = [x, y, θ], the constraints enforce (1) no motion to perpendicular to the sliding direction and (2) no rotation. For a slider aligned with the x-axis, the constraint equations are: If the sliding direction is defined by an angle, α, the constraints become: These constraints reduce the system to one degree of freedom and, through Jacobian, ensure that the only velocity along the sliding axis is permitted in the resulting DAE formulation. |
|
A prismatic constraint is like a translational counterpart to a hinge. A prismatic joint allows translation along one axis and this is why the hinge constraint equations cannot directly be reused. Two constraint equations are needed to remove two degrees of freedom from the system. We can use no perpendicular motion and no relative rotation to reduce the system from 3 degrees of freedom down to 1 degree of freedom. There is no single fixed point shared between the coordinate systems, so the constraint has to be expressed in terms of the sliding direction vector. |
|
A sliding (prismatic) constraint is the opposite of a hinge joint. Rather than fixing a point and allowing rotation, it fixes rotation and allows travel along a singular axis. In the x plane the door could only move left or right. This means that the equations of motion for the prismatic constraint would be different than the ones for the hinge joint. Since there is only one degree of freedom for the prismatic joint there would only be one equation of motion. In terms of velocity the system can only have a horizontal velocity. Not a vertical or rotational velocity due to the equations of motion. A simple example is a sliding barn door. |
|
To understand a sliding (prismatic) constraint, it helped me to compare it to the hinge example. A hinge keeps a point fixed and lets something rotate, while a sliding joint is kind of the opposite. It lets something move in one direction but doesn’t let it rotate or move any other way. Using the same coordinates as the door example sliding along a horizontal track, seeing that it can only move left and right, not vertically, and it can’t rotate. So we can just say y=1 and θ=0. This removes vertical motion and rotation, so the only motion left is in the x-direction. If we take the time derivative, we get the velocity constraints, which just say the vertical and rotational velocities are zero. That matches what we expect physically. |
|
A prismatic constraint is the opposite of a hinge—it prevents rotation and only allows motion along one axis. For a horizontal slider, using q=[x,y,θ], the constraints are: y=0,θ=0 so the body can only move in the x-direction. This reduces the system from 3 DOF to 1 DOF, behaving like a block sliding along a track. |
|
A prismatic (sliding) constraint is essentially the opposite of a hinge. Instead of fixing a point and allowing rotation, it removes rotation and only allows motion along one direction. Using the generalized coordinates q = [x1, y1, theta1], a horizontal slider can be described by the constraints y1 = 0 and theta1 = 0. This reduces the system from 3 degrees of freedom to 1 degree of freedom, leaving only motion in the x-direction. The velocity constraints also enforce y1_dot = 0 and theta1_dot = 0, so the motion stays strictly along the sliding axis. |
|
It was interesting to learn about how to represent motion using the multibody dynamics approach. The animation of the door opening in Julia was helpful in visualizing the utility of the constraint equations for the door hinge. By contrast, a prismatic joint allows translation along a single axis while removing all other independent motions, including rotational motion. For a slider to move along the global x-axis, two constraint equations are used. The first ensures that there is no translation in the y-direction: y_p – 0 = 0. The second ensures that there is no rotation: θ_p – 0 = 0. Since there are two constraint equations and three generalized coordinates, the constraint Jacobian C_q is a 2x3 matrix: C_q = [0 1 0; 0 0 1] where each row corresponds to one constraint equation and each column corresponds to one generalized coordinate (x, y, θ), respectively. By comparison, the hinge has a C_q = [1 0; 0 1]. Since these constraints have no time dependence, the derivative of the constraint function is equal to 0 for all generalized coords. @cjdipietrantonio has a great visualization of these equations in his post! |
|
A sliding, or prismatic, constraint is different from a hinge because it allows one direction of translation but blocks the other relative motions. For a hinge, the point on the body is forced to stay at one fixed point in space, which gives two position constraints. For a slider, the body is allowed to move along a line, so we should not constrain motion along that line. Instead, we constrain the body so it stays on the sliding path and does not rotate relative to the track. For example, if a rigid body is sliding horizontally along a ground-fixed rail, its generalized coordinates could be q = [x1, y1, θ1]^T where x1 is the allowed sliding motion. Since the slider can only move horizontally, the vertical position must stay fixed: C1(q) = y1 - y_rail = 0 Also, because a prismatic joint prevents rotation between the slider and the rail, the body angle must remain aligned with the rail: C2(q) = θ1 - θ_rail = 0 So for a horizontal slider where the rail is at y=0 and has no rotation, the constraints simplify to: C(q) = [y1; θ1] matrix This leaves x1 free, which is exactly what we want because the body is allowed to translate along the rail. The constraint says: “you can slide left and right, but you cannot move up and down, and you cannot rotate.” If the rail were angled instead of horizontal, I would write the constraint using a rail direction vector and a perpendicular direction vector. The body’s position would be constrained in the direction normal to the rail, while motion along the rail would remain free. This is the same general idea from the hinge example on the tutorial page: write the body point in global coordinates, compare it to the allowed geometric path, and set the restricted motion equal to zero. The main difference is that a hinge removes two translations, while a prismatic joint removes one translation and one rotation. |
|
For a hinge, you keep rotation and remove translation at a point. For a sliding or prismatic joint, it is basically flipped. You allow motion along one direction, but you remove rotation and motion in the other direction. If we stick with the same top down view and say the door is constrained to slide along the x direction, then the constraints are pretty straightforward. The door cannot move in the y direction, and it cannot rotate. So you end up enforcing something like y is fixed and theta is fixed, while x is the only thing that can change. So compared to the original 3 degrees of freedom x, y, and theta, you are removing two of them and leaving just one. That is what makes it a 1 DOF system. From the modeling side, this shows up the same way as the hinge did, just with different constraints. When you build the Jacobian, it is basically removing any velocity in y and any angular velocity. So the solver only evolves motion along x. What I found interesting is that even though the physical picture is simple, writing it as constraints makes it really clear what the system is allowed to do. And once it is in that form, it plugs directly into the multibody setup without having to rethink the physics again. |
|
A prismatic constraint is the opposite of a hinge joint. It only allows motion along one direction while preventing rotation and motion in the perpendicular direction. If the slider is constrained to move along the x-axis, then the constraints would force y=0 and θ=0. That leaves only the x-direction free, so the system goes from 3 DOF to 1 DOF. It was interesting seeing how the constraint equations mathematically remove certain motions while still allowing the body to move freely in the allowed direction. |
|
This discussion highlighted how introducing damping makes the system behavior more realistic by allowing energy to decrease over time. Unlike the idealized conservative systems we’ve mostly worked with, damping causes trajectories to spiral toward stable equilibria rather than oscillating indefinitely. Seeing this effect both in the equations and in simulations helped solidify the physical meaning of damping terms. Linearizing damped systems around equilibrium made it clear how damping ratios affect stability and transient response. Small damping leads to oscillatory decay while higher damping removes oscillations altogether. This distinction is difficult to see from equations alone but becomes obvious when looking at phase portraits or time histories. Overall, this discussion was a useful step toward modeling real mechanical systems, where energy losses and non conservative forces are unavoidable and must be accounted for in both analysis and design. |
|
a hinge in a door is pretty much a prismatic joint. The actual motion is different, it stops movement but allows rotation and then there is no more rotational freedom while translation is allowed. Constraints are important as the door would probably move in a way that is not actually possible in real life. To make it "realistic", gotta have constraints. |
|
For a sliding / prismatic constraint, the main idea is that the body is allowed to move in one direction but is restricted in the other, and restricted from rotating. So if we have a sliding door that's only allowed movement in the x-direction, the constraints should force the y-position and angle to stay constant / fixed. ([y = y_0] and [\theta = \theta_0] ?) Then, the only generalized coordinate that is free to change is the x-position. This is different from the hinge example, because the hinge allows rotation but fixes the point in all directions. The slider is the opposite, allowing translation along one axis but fixes the rotation. Also, it always depends on the setup. If the joint is attached to the center of mass of the body, it's pretty straightforward. On the other hand, if it is attached anywhere else, the rotation affects the constraint equations more. |
|
A prismatic constraint would work differently from the hinge constraint because it allows sliding motion along one direction instead of rotation about a fixed point. In the door example, the hinge constraint keeps the hinge point fixed in space while still allowing the door to rotate. For a sliding or prismatic joint, the body would be allowed to move along a track, but it would be restricted from moving perpendicular to that track. For example, if the track is horizontal, the body should only move in the x-direction. That means the vertical position of the constrained point would need to stay constant: C1=yP−ytrack=0 A second constraint would usually control the rotation of the body so that it stays aligned with the slider instead of freely rotating like a hinged door: C2=θ−θtrack=0 This would leave one degree of freedom remaining, which is the motion along the track. If the slider motion was prescribed, like x=2t, then that could be added as another time varying constraint. Taking the time derivative of the constraint equations would then give the velocity constraints, similar to how the hinge example used the Jacobian matrix. Overall, I think the main difference is that a hinge fixes a point and allows rotation, while a prismatic constraint prevents rotation and sideways movement but allows straight-line translation. This makes sense physically because a slider should move only along its guide path and not swing away from it. |
|
A sliding or prismatic constraint would differ from a hinge constraint because the body isn't rotating about a fixed point like it is in a hinge. In a sliding or prisamtic contraint we the body can only move along one direction like a door on a track rather than on a hinge. |
|
For a sliding (prismatic) constraint, the goal is to allow motion in only one direction while preventing motion in the other direction and preventing rotation. If the door is constrained to slide along the x-axis, the generalized coordinates are |
|
For a sliding constraint, the limits that are placed on its movement is to move along a single direction while removing rotation and motion perpendicular to that direction. Unlike the hinge in the video, there isn’t a point that stays fixed in both frames. Instead, the constraint keeps the body aligned to a path. In a 2D case where the slider is along the x‑axis, this can be expressed with position constraints like y1 = 0 and θ1 = 0, which reduce the original three degrees of freedom down to one. Taking the time derivative gives y˙1 = 0 and θ˙1 = 0, which fit into the same constraints used for the hinged door, just with different degrees of freedom being restricted. |

Uh oh!
There was an error while loading. Please reload this page.
Creating Kinematic Constraints
In this notebook + video, I go through the process of creating formal constraint equations on the motion of a door (from the top-down perspective i.e. watching the swinging motion in plane). This process is the beginning of Module_02's work to create Multibody Dynamic (MBD) Differential Algebraic Equations (DAE).
Here, we make the Constraint equations for a hinge. What would the Constraint equations be for a sliding (or prismatic) constraint?
All reactions