.. _hybrid: Hybrid Avoid Obstacles and Go-to-Goal ---------------------------------------- When an obstacle is near by, but not an immediate threat for a collision, then the robot does not need to go directly away from the obstacle as the :ref:`AvoidObstacle` behavior would, but it should veer to the side of the obstacle while moving towards the goal. The hybrid algorithm calculates an weighted angle heading that favors :math:`\alpha_g` when :math:`\alpha_{ao}` is small while favoring larger values of :math:`\alpha_{ao}`. The input to the behavior is the set of angles: * Angle to goal in the global coordinate frame, :math:`\phi_g`. * The avoid obstacle angle in the local coordinate frame, :math:`\alpha_{ao}`, which comes from the sonar data. * The robot's orientation in the global coordinate frame, :math:`\theta`. * The threshold angle, :math:`Max_{\alpha\_Hybrid}`, for switching to the :ref:`AvoidObstacle` behavior. The variable that we call :math:`h` is the weighting variable. .. math:: :label: blended-h h = \left\{ \begin{array}{ll} \frac{|\alpha_{ao}|}{Max_{\alpha\_Hybrid}} & \mbox{if} \: |\alpha_{ao}| < Max_{\alpha\_Hybrid} \\ 1 & \mbox{otherwise} \end{array} \right. .. math:: \alpha = h \cdot \alpha_{ao} + (1 - h) \cdot \alpha_g .. math:: \alpha = h \cdot \alpha_{ao} + (1 - h) \cdot (\phi_g - \theta) Thus, for :math:`|\alpha_{ao}| \geq Max_{\alpha\_Hybrid}`, we have pure collision avoidance: .. math:: \alpha = \alpha_{ao}