Advanced Dynamics -- Lecture 17: Impacts and Contacts Continued
Overview
Christian Hubicki connects event-driven impact simulation with rigid-body contact modeling, first correcting a MATLAB bead-in-a-bowl simulation and then deriving the contact geometry for a rotating rod. The lecture also previews homework on forced Lagrangian systems, MuJoCo, and a slackening Atwood-machine cable, and introduces 3D rotational kinetic energy using an inertia tensor.
Key takeaways
- Event-driven impact simulation requires restarting the ODE solver at each impact with the remapped post-impact velocity and a time span that begins at the event time.
- MATLAB interpolation requires unique sample times, but concatenated solver segments duplicate their shared impact timestamp; a small restart-time offset such as 1e-10 seconds can avoid that failure.
- A negative Lagrange multiplier for a unilateral contact constraint indicates that the surface would need to pull the body, so the model should switch to flight rather than maintain contact.
- For a rigid rod contacting a surface at either endpoint, separate guard functions and contact Jacobians are needed so the impact map uses the geometry of the endpoint that actually struck.
- The rotational kinetic energy of a 3D rigid body is one-half omega-transpose I omega, where I is a 3-by-3 inertia tensor and omega is the angular-velocity vector.
- An ideal impact with coefficient of restitution 1 preserves energy in the bead example, while reducing restitution to 0.9 dissipates energy at each bounce.
Chapters
- The upcoming homework starts with a spherical pendulum on a cart, driven by a time-varying force and velocity-proportional drag.
- Undergraduates derive kinematics in minimal coordinates and simulate in MATLAB; graduate students also formulate the system in maximal coordinates with Lagrange multipliers.
- The pendulum problem also has a MuJoCo implementation, giving students a way to compare a maximal-coordinate Lagrangian model with a multibody simulation.
- A second system uses holonomic constraints for an Atwood-machine cable; negative cable tension signals that the rope should go slack.
- The homework asks students to model re-tensioning with an impact map, while graduate students simulate the transitions between taut and slack modes.
- Hubicki returns to MATLAB code for a bead falling onto a parabolic surface, where an event function detects contact and an impact map resets velocity.
- The simulation alternates continuous dynamics with discrete velocity updates, restarting the ODE solver after each detected impact.
- The homework is designed to practice external forces, constraints, minimal and maximal coordinates, and impact maps.
- After an impact, the next solver time span must begin at the current event time and continue to the final simulation time.
- Hubicki appends each segment's time and state data to running arrays, then initializes the next segment with the post-impact velocity.
- The ODE event function stops integration at the bowl boundary rather than allowing the solver to run through the full time span.
- The bead's Cartesian path is plotted against the parabola, with equal axis scaling to preserve the surface's shape.
- With coefficient of restitution equal to 1, the idealized impacts preserve mechanical energy; lowering it to 0.9 produces less-bouncy impacts.
- Hubicki notes that an event function can be defined from a more general symbolic boundary, not just the example parabola.
- A bead that numerically crosses the bowl boundary can pass through it because the event detector does not enforce contact during subsequent continuous dynamics.
- Acceleration-level constraints can drift as small errors integrate into position errors; Baumgarte stabilization counters this with a critically damped corrective force.
- A more complete contact model switches from impact dynamics to constrained sliding, then detects liftoff when the constraint force becomes negative.
- The MATLAB animation setup stores solver times, creates display times at 20 frames per second, and interpolates the bead's x and y coordinates.
- Concatenating solver segments creates duplicate timestamps at impact boundaries, which MATLAB's interpolation routine rejects because its sample times must be unique.
- Hubicki explains that the duplicate arises because a new integration segment starts at the same time the previous segment ended.
- One workaround adds a small increasing offset to stored times; the lecture finds that MATLAB's machine epsilon is too small for this use and demonstrates offsets around 1e-10 or 1e-12.
- Another option is to shift the restart time slightly after each impact, for example by 1e-10 seconds, so the concatenated timestamps differ.
- The animation loop uses interpolated coordinates, `drawnow`, and a dashed trace to show the bead's path over time.
- A contact simulation can transition from an impact map to constrained sliding instead of allowing the bead to pass through the bowl.
- The Lagrange multiplier associated with the contact constraint indicates whether the surface can maintain contact; a negative value signals liftoff.
- An event function can monitor that multiplier to detect the switch back to free-flight dynamics.
- A 2D rod requires generalized coordinates for its center of mass, x and y, plus an orientation angle, theta.
- Unlike a point mass, a rod also needs rotational inertia; in 3D, its inertia is represented by a 3-by-3 tensor with diagonal and potentially off-diagonal terms.
- The diagonal entries describe inertia about coordinate axes, while the parallel-axis theorem can shift inertia to another reference point.
- For a 3D rigid body, rotational kinetic energy is one-half omega-transpose times the inertia tensor times omega, producing a scalar.
- Hubicki models an infinitely thin rod above the bowl and uses its two endpoints as witness points for possible contact.
- Checking simple shapes such as circles or spheres is easier than detecting contact for irregular geometries, which is why simulations often approximate robot feet with spheres.
- For a rod of length L centered at (x, y) and oriented at theta, the endpoints are offset by plus or minus L/2 times the cosine and sine of theta.
- Each endpoint gets a separate guard function by substituting its coordinates into the bowl equation y = x squared.
- The two guards, labeled HA and HB, identify when endpoint A or endpoint B reaches the contact surface.
- Each guard's Jacobian is its partial derivative with respect to the generalized coordinates q = (x, y, theta), so each contact Jacobian has one row and three columns.
- The selected Jacobian depends on which endpoint triggered contact and is used in the corresponding impact map.
- Hubicki works through the derivatives and recommends MATLAB's symbolic toolbox to reduce hand-calculation errors.
- MATLAB's ODE45 event outputs include the index of the event that triggered, allowing code to select the correct endpoint's impact map.
- With two contact guards, the event function needs two event values, directions, and terminal flags; the event index distinguishes left-end from right-end contact.
- A direction setting of -1 detects crossings while the guard value decreases, +1 detects increasing crossings, and 0 detects either direction.
Transcript excerpt
2:22 testing one, two. Okay, I think we got it. >> Okay, sorry about that false start. How you doing today? >> Good. >> All right, so your next homework is all but posted. My TA is giving one last read through is a little of a of a challenge to set up, but mostly so that way you have checkpoints along the way to check to make sure things are working. Okay, so your homework going to look a little bit like this. Okay, it's got a few components. 2026 11:04. Good to see you this morning. We'll just jump right in. Okay, [snorts] you're going to be doing some lrangeian
3:10 mechanics. Again, these are the topics we talked about last lecture that'll be part of your exam and your and your homework and this will give you practice. All right, going to be lrangei mechanics with external forces. Okay, first problem's going to be a little 3D spherical pendulum on a cart. It's going to look like this. All right, but fear not. We have some simulation answers. That's not a rope. That's a straight line. Okay. We have some simulation results that you can compare to see if you got it right. Okay. Yes. Question. >> What is this?
3:59 >> Homework. >> Homework. Okay, the homework that is being under review by the TA. Thank you, TA. Appreciate it. Okay, so there's a little there's going to be a little extra pendulum on a cart and we're going to have little forces that are going to be pushing this around. Some F of T and some drag forces, okay, that are going to be minus C in the direction of your velocity. Okay, so you have some external forces on it. And if you're an undergrad, you're going to do this in minimal
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Christian Hubicki.