# Multidimensional obstacle avoidance in ODE. Part II

Multidimensional obstacle avoidance

https://math.stackexchange.com/questions/4146255/multidimensional-obstacle-avoidance-in-ode

For some time, I studied this question more closely and came to the conclusion that it is best to assign its own constraint for each selected coordinate. Here are the results.

I choose those system of ODE:

$$F=\begin{cases} \dot{x}=g_x+\frac{d(U_{rep_1})}{dx} \\ \dot{g_x}=-g_x+\frac{df}{dx} \\ \dot{y}=g_y+\frac{d(U_{rep_2})}{dy} \\ \dot{g_y}=-g_y+\frac{df}{dy} \end{cases}$$

where $$x,y,g_x,g_y$$ - variables;

$$f=e^{-(x^2+y^2)}$$

$$U_{rep_1}=\begin{cases} \frac{1}{2}(\frac{1}{\rho_1}-\frac{1}{\rho_0})^2, & \mbox{if } \rho_1<=\rho_0\mbox{} \\ 0, & \mbox{if } \rho_1>\rho_0\mbox{} \end{cases}$$

$$U_{rep_2}=\begin{cases} \frac{1}{2}(\frac{1}{\rho_2}-\frac{1}{\rho_0})^2, & \mbox{if } \rho_2<=\rho_0\mbox{} \\ 0, & \mbox{if } \rho_2>\rho_0\mbox{} \end{cases}$$

$$\rho_1=\sqrt{(x-\psi_1)^2}-d_{obs}$$

$$\rho_2=\sqrt{(y-\psi_2)^2}-d_{obs}$$

$$\psi_1=\delta +2 e^{-t T}$$

$$\psi_2=\delta +\frac{1}{2.2}e^{-t T}$$

$$\rho_0 = 0.15, T = 0.5, \delta = 0.35,d_{obs}=0.1$$

The figure below shows the results of numerical simulations from Mathematica. It can be seen that the selected variables cannot cross the selected barrier. The following is interesting. When a variable touches the barrier, it kind of "sticks" to it, holds on for a while, and then "unsticks". At this time, $$\frac{d(U_{rep_1})}{dx}$$ and $$\frac{d(U_{rep_2})}{dy}$$ is not zero. In general, I ask for help with this task - how to quickly "detach" the variable from the barrier? Are there any tricks? Maybe experts in differential equations and dynamical systems can help. I will be glad to help.