Lagrangian of point mass on rod inside ring with holonomic constraint 
I am given a massless ring of radius $R$ that is rolling along a flat plane without slipping. There is friction. A massless rod of length $\frac {R} {2} $ is attached to the inside edge of the ring and a point mass of mass $m$ is attached to the end of the rod. Think of this as a wheel with a single spoke that is only attached to the edge and whose mass is concentrated on the point nearest the center. The entire system is in a gravity field with strength $g$. I want to find the equation of motion for the system using the Euler Lagrange equations.

My work so far:
I want to use 2 generalized coordinates to describe my system: $x$, the location of the center of the ring along the flat plane and $\theta$, the angle that the rod inside the cylinder makes with respect to the flat plane (I define increasing $\theta$ as counterclockwise). 
Kinetic Energy: $\frac{1}{2} m \dot{x}^{2} + \frac{1}{2} m \frac{R^2}{4}\dot{\theta}^{2}$ 
Potential Energy: $mg(\frac{R}{2}\sin{\theta} + R)$
There is also a contraint due to the no slipping of the form:
$f(x,\theta) = x + R\theta = 0$
With this, my Lagrangian is:
$L = \frac{1}{2} m \dot{x}^{2} + \frac{1}{2} m \frac{R^2}{4}\dot{\theta}^{2} -  mg(\frac{R}{2}\sin{\theta} + R)$
The Euler Lagrange equations with the holonomic constraint are:
$\frac{d}{dt}\frac{\partial L}{\partial \dot{x}} - \frac{\partial L}{\partial x} - \lambda\frac{\partial f}{\partial x} = 0$
$\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}} - \frac{\partial L}{\partial \theta} - \lambda\frac{\partial f}{\partial \theta} = 0$
which yields:
$m\ddot{x} - \lambda = 0$
$m\frac{R^{2}}{4} \ddot{\theta} -mg\frac{R}{2}\cos{\theta}- \lambda R = 0$
using the constraint I can solve the system of equations and yield:
$\lambda = m\ddot{x}$
$\ddot{x} = -R\ddot{\theta}$
Therefore
$m\frac{R^{2}}{4} \ddot{\theta} -mg\frac{R}{2}\cos{\theta} + m \ddot{\theta} R^{2} = 0$
This results in:
$\ddot{\theta} = \frac{2g\cos{\theta}}{5R}$
The issue is that this is not the correct answer which should be:
$\frac{d}{dt}(m R^{2} \dot{\theta}(\frac{5}{4} + \sin{\theta})) = -mg\frac{R}{2} \cos{\theta}$
This was found by finding the angular momentum of the point mass and relating it to the external torque due to gravity
I am unsure of what I have messed up on in the Lagrangian. Could anyone help?
 A: The massless ring with a rod serve as holonomic constraints. The main object is a mass point p. The motion takes place in the $xy$ plane of an inertial coordinate system $Oxyz$ where axis $Ox$ is horizontal and axis $Oy$ is vertical. Then the position of the point p is given by the coordinates $(x_p, y_p)$. It's velocity is then 
$\Big(\frac{dx_p}{dt}, \frac{dy_p}{dt}\Big)$. The gravitational potential energy of the point p is as usual $U(x_p, y_p) = mg\,y_p$. Therefore the Lagrangian, in $xy$ coordinates is
$$L = \frac{m}{2}\left(\Big(\frac{dx_p}{dt}\Big)^2 +  \Big(\frac{dx_p}{dt}\Big)^2\right) - mg\, y_p$$ 
subject to the holonomic constraints imposed by the ring with a rod and the nature of the ring's motion. 
Next, parametrize the constraints. The center of the ring has coordinates $(x, R)$ throughout the motion where $x = -\, R\,\theta$ due to the ring's motion without slipping. Our goal is to parametrize the coordinates $(x_p,y_p)$ of point p with respect to $\theta$. Thus
\begin{align}
x_p&= x + \frac{R}{2}\cos{\theta} = R\,\theta + \frac{R}{2}\cos{\theta}\\
y_p&= R + \frac{R}{2}\sin{\theta}
\end{align} that is
\begin{align}
x_p&= R\,\theta + \frac{R}{2}\cos{\theta}\\
y_p&= R + \frac{R}{2}\sin{\theta}
\end{align}  whose velocity should be
\begin{align}
\frac{dx_p}{dt}&= R\,\frac{d\theta}{dt} - \Big(\frac{R} {2}\sin{\theta}\Big)\,\frac{d\theta}{dt} = \Big(\, R - \frac{R}{2}\sin{\theta}\,\Big)\,\frac{d\theta}{dt}\\
\frac{dy_p}{dt}&= \Big(\,\frac{R}{2}\cos{\theta}\,\Big)\,\frac{d\theta}{dt}
\end{align} 
Plug the expressions above in the Lagrangian and simplify
\begin{align}
L &= \frac{m}{2}\left(\Big(\frac{dx_p}{dt}\Big)^2 +  \Big(\frac{dx_p}{dt}\Big)^2\right)  - mg\, y_p = \\
&= \frac{m}{2} \left(\Big(\, R - \frac{R}{2}\sin{\theta}\,\Big)^2\,\left(\frac{d\theta}{dt}\right)^2 + \Big(\,\frac{R}{2}\cos{\theta}\,\Big)^2\,\left(\frac{d\theta}{dt}\right)^2 \right)  \, - \, mg\frac{R}{2}\, \sin{\theta} - mgR = \\
&= \frac{m}{2}R^2 \Big(\, \frac{5}{4} + \sin{\theta}\,\Big) \,\left(\frac{d\theta}{dt}\right)^2  \, - \, mg\frac{R}{2}\, \sin{\theta} - mgR 
\end{align} The last term $mgR$ is constant, so it has no effect on the equations of motion. Therefore your Lagrangian is 
$$L = \frac{m}{2}R^2 \Big(\, \frac{5}{4} + \sin{\theta}\,\Big) \,\left(\frac{d\theta}{dt}\right)^2  \, - \, mg\frac{R}{2}\, \sin{\theta}$$
The Euler-Lagrange equations are 
$$\frac{d}{dt} \left(\frac{\partial L}{\partial \dot{\theta}}\right) = \frac{\partial L}{\partial {\theta}}$$ and thus
$$\frac{d}{dt} \left(\, mR^2 \Big(\, \frac{5}{4} + \sin{\theta} \, \Big) \, \frac{d\theta}{dt}\, \right) \, = \, - \, mg\frac{R}{2}\,\sin{\theta} \, + \, \frac{m}{2}R^2 \left(\frac{d\theta}{dt}\right)^2 \cos{\theta}$$
