Best strategies to solve an ODE with piecewise functions using OrdinaryDiffEq

You probably want to look into the methods for dynamical ODE problems as this is a partitioned (second order) ODE.

Set autodiff=false, like Rodas5P(autodiff=false).

https://diffeq.sciml.ai/stable/basics/faq/#I-get-Dual-number-errors-when-I-solve-my-ODE-with-Rosenbrock-or-SDIRK-methods

Though with your equation I don’t see why one would use an implicit method. Nothing sticks out to me as stiff there.

See https://diffeq.sciml.ai/stable/basics/faq/#My-Problem-Has-Discontinuities-and-is-Unstable-/-Slow or

For your case, you callbacks and a decreased interp_points probably makes sense. Did you try it?