I have this sets of equations \begin{align} x_1'[t] &= x_2[t] \\ x_2'[t] &= -p_2[t] \\ p_1'[t]&=-x_1[t] \\ p_2'[t]&=-p_1[t] - p_3 (-2 H_2 (3 - x_2[t]) + 2 H_1 (3 + x_2[t])) \\ p_3'[t]&=0 \end{align} where $H_i$ are Heaviside functions defined as
$ H_1= \begin{cases} 0,&for \qquad-(3 + x_2[t])\geq 0\\ 1,&for \qquad-(3 + x_2[t])<0 \end{cases} $
$ H_2= \begin{cases} 0,&for \qquad-(3 - x_2[t])\geq 0\\ 1,&for \qquad-(3 - x_2[t])<0 \end{cases} $
I know Mathematica can solve systems of equations, but I don't know how to integrate a Heaviside function.
How can I solve this system of equations. Actually I know initial values of $x_i$ but don't know $p_i$ since they are Lagrange multipliers of the Hamiltonian equation.
I know that;
$p_1[t_f]=p_2[t_f]=0$ where $t_f$ is not defined it is free.