# Optimality conditions for optimal control: BVP - DAE

I am solving an optimal control problem of the form $$\min_u \qquad\int_0^T \langle u(t), u(t) \rangle \, \mathrm{d}t \\ s.t. \quad \dot{x} = \tilde{f}(x) + u, \quad x(0)=x_0 \\ \qquad \tilde{\Phi}(x(T)) = 0\}$$ reformulated as $$\min_{\xi(T)} \qquad \xi(T) \\ s.t. \quad \dot{z} = f(z,u), \quad z(0) = z_0 \\ \qquad \Phi(z(T)) = 0$$ where the dual variable on the dynamics is denoted by $$\lambda$$ and the dual variable on the terminal constraint is denoted by $$\mu$$. Also, we define $$z := (x^{\top}, \xi)^{\top}$$, $$f(z,u) := (f(x,u)^{\top}, \langle u, u \rangle)^{\top}$$, and $$\Phi(z(T)) := \tilde{\Phi}(x(T))$$.

I would like to use a BVP-DAE solver to solve directly the optimality conditions $$\dot{\lambda} = -\frac{df}{dz}, \quad \lambda(T) = \frac{d\xi(T)}{dz} + \mu \frac{d\Phi(z(T))}{dz} \\ \dot{z} = f(z,p), \quad z(0) = z_0 \\ \Phi(z(T)) = 0$$ and was wondering what numerical software I could use. Ideally it would be a collocation-based DAE solver. I've looked into Sundials a bit, but was wondering what I should use. I've looked at a few previous questions but am looking for existing software. Thanks!