src/costmap_prohibition_layer.cpp
bool CostmapProhibitionLayer::getPoint(XmlRpc::XmlRpcValue &val, geometry_msgs::Point &point)
{
  try
  {
    // check if there a two values for the coordinate
    if (val.getType() == XmlRpc::XmlRpcValue::TypeArray && val.size() == 2)
    {
      auto convDouble = [](XmlRpc::XmlRpcValue &val) -> double {
        if (val.getType() == XmlRpc::XmlRpcValue::TypeInt) // XmlRpc cannot cast int to double
          return int(val);
        return val; // if not double, an exception is thrown;
      };

      point.x = convDouble(val[0]);
      point.y = convDouble(val[1]);
      point.z = 0.0;
      return true;
    }
    else
    {
      ROS_ERROR_STREAM("Prohibition_Layer: A point has to consist two values!");
      return false;
    }
  }
  catch (const XmlRpc::XmlRpcException &ex)
  {
    ROS_ERROR_STREAM("Prohibition Layer: Cannot add current point: " << ex.getMessage());
    return false;
  }
}
// get a point out of the XML Type into a geometry_msgs::Point
get a point out of the XML Type into a geometry_msgs::Point
get a point out of the XML Type into a geometry_msgs :: Point
bool CostmapProhibitionLayer::getPoint(XmlRpc::XmlRpcValue &val, geometry_msgs::Point &point)
{
  try
  {
    if (val.getType() == XmlRpc::XmlRpcValue::TypeArray && val.size() == 2)
    {
      auto convDouble = [](XmlRpc::XmlRpcValue &val) -> double {
        if (val.getType() == XmlRpc::XmlRpcValue::TypeInt) 
          return int(val);
        return val; 
      };
      point.x = convDouble(val[0]);
      point.y = convDouble(val[1]);
      point.z = 0.0;
      return true;
    }
    else
    {
      ROS_ERROR_STREAM("Prohibition_Layer: A point has to consist two values!");
      return false;
    }
  }
  catch (const XmlRpc::XmlRpcException &ex)
  {
    ROS_ERROR_STREAM("Prohibition Layer: Cannot add current point: " << ex.getMessage());
    return false;
  }
}
bool CostmapProhibitionLayer :: getPoint ( XmlRpc :: XmlRpcValue & val , geometry_msgs :: Point & point ) { try { if ( val . getType ( ) == XmlRpc :: XmlRpcValue :: TypeArray && val . size ( ) == 2 ) { auto convDouble = [ ] ( XmlRpc :: XmlRpcValue & val ) -> double { if ( val . getType ( ) == XmlRpc :: XmlRpcValue :: TypeInt ) return int ( val ) ; return val ; } ; point . x = convDouble ( val [ 0 ] ) ; point . y = convDouble ( val [ 1 ] ) ; point . z = 0.0 ; return true ; } else { ROS_ERROR_STREAM ( " " ) ; return false ; } } catch ( const XmlRpc :: XmlRpcException & ex ) { ROS_ERROR_STREAM ( " " << ex . getMessage ( ) ) ; return false ; } }
get a point out of the XML Type into a geometry_msgs::Point
get a point out of the XML Type into a geometry_msgs :: Point
// check if there a two values for the coordinate // XmlRpc cannot cast int to double // if not double, an exception is thrown;