# Lagrangian for non-smooth mechanical systems (bouncing ball)

I've been searching for a while for this answer, but yet not found anything. Let's take a bouncing ball as an example, what would the Lagrangian be of this system? In this case we can use the horizontal ground as the potential zero, and if we choose to denote displacement over ground as $$z$$ we obtain the potential expression $$V=m_{ball}gz$$.

What about the kinetic energy then? If there is no spin of the ball and no horizontal motion, then the ball can be modeled as a particle (or resembles a particle) and the expresion for the kinetic energy becomes $$T=\frac{1}{2}m_{ball}|\textbf{v}|^{2}=\frac{1}{2}m_{ball}\dot{z}^{2}$$.

The Lagrangian then becomes $$L=T-V$$. I assume this holds only during free fall and not impact. So for this non-smooth system the Lagrangian was easy to find. But what about a mechanical system that stops, and falls, and stops, and falls, and so on? Here we don't have a static ground, how should I go about it to find its Lagrangian? Look at the figure below:

The rigid body $$S$$ (the Woodpecker) falls down a rod with some play. As you can see it is connected to a sleeve, or ring, around the rod via a spring. For a given angle $$|\theta|\geq\theta_{K1}$$ the sleeve will jam with the rod, thus stopping the free fall for a while until the angle becomes $$|\theta|<\theta_{K1}$$, then it starts falling again.

How would one calculate the Lagrangian for a system like this? Can I divide the Lagrangian into two parts: One when its jammed (then no vertical movement, the kinetic and potential energies are all due to the spring); the other when it is free falling. What would be an appropriate way of defining the Lagrangian when it's free falling? We can assume here no tension is built up in the spring, so we have a falling, rotating body.