rst-tu-dortmund / teb_local_planner

An optimal trajectory planner considering distinctive topologies for mobile robots based on Timed-Elastic-Bands (ROS Package)
http://wiki.ros.org/teb_local_planner
BSD 3-Clause "New" or "Revised" License
1.03k stars 546 forks source link

I think something is wrong with penaltyBoundToInterval and penaltyBoundToIntervalDerivative #400

Open charon-cheung opened 1 year ago

charon-cheung commented 1 year ago

The function is for bounding \c var to the interval -a < var < a , but the code is

  if (var < -a+epsilon)
  {
    return (-var - (a - epsilon));
  }
  if (var <= a-epsilon)
  {
    return 0.;
  }
  else
  {
    return (var - (a - epsilon));
  }

inline double penaltyBoundToIntervalDerivative(const double& var,const double& a, const double& epsilon)
{
  if (var < -a+epsilon)
  {
    return -1;
  }
  if (var <= a-epsilon)
  {
    return 0.;
  }
  else
  {
    return 1;       
  }
}

I think it should be if (var >= a-epsilon), the other overload funtion has the same problem