New approach to control and filtering of mechanical systems by using the estimates of their Lagrangians