ELASTICPATHING/SOURCECODE/UbiComp2014/Elastic_Pathing_Code/path_decisions.rb
def advanceBError(epath, navigator)
  #Look for the nearest next intersection along the path, find the
  #expansion factor from the last landmark.
  #First find the last intersection, adding any path points that are encountered
  #that are not part of an intersection.

  while (1 >= navigator.pathIntersects(epath).length)
    nex = navigator.pathIntersects(epath).first
    if (nil == nex)
      return nil
    end
    #The addPoint function adjusts the distance to this node, stored in
    #the epath.progress variable, so we can check the distance increase
    #at the very end
    epath.addPoint(nex)
  end
  #Also need to back up at least one lane's width from the inersection since
  #we cannot stop in the middle of it.
  #Convert lane width in feet into miles (5280 feet in a mile)
  distance_increase = epath.progress - LANE_WIDTH/5280.0
  epath.progress = -1 * LANE_WIDTH/5280.0

  #Now set a landmark at this spot
  epath.setLandmark(epath.segment_dist/(epath.segment_dist + distance_increase))
  return epath
end
#Advance the B error by expanding samples from the last landmark to the
#current point. This assumes that the recorded distance travelled is more than
#the actual distance covered.
#Returns the expansion factor and the new sample index when compression works,
#nil otherwise.
Advance the B error by expanding samples from the last landmark to the
current point. This assumes that the recorded distance travelled is more than
the actual distance covered.
Returns the expansion factor and the new sample index when compression works,
nil otherwise.
Advance the B error by expanding samples from the last landmark to the current point . This assumes that the recorded distance travelled is more than the actual distance covered . Returns the expansion factor and the new sample index when compression works nil otherwise .
def advanceBError(epath, navigator)
  while (1 >= navigator.pathIntersects(epath).length)
    nex = navigator.pathIntersects(epath).first
    if (nil == nex)
      return nil
    end
    epath.addPoint(nex)
  end
  distance_increase = epath.progress - LANE_WIDTH/5280.0
  epath.progress = -1 * LANE_WIDTH/5280.0
  epath.setLandmark(epath.segment_dist/(epath.segment_dist + distance_increase))
  return epath
end
def advanceBError ( epath , navigator ) while ( 1 >= navigator . pathIntersects ( epath ) . length ) nex = navigator . pathIntersects ( epath ) . first if ( nil == nex ) return nil end epath . addPoint ( nex ) end distance_increase = epath . progress - LANE_WIDTH / 5280.0 epath . progress = - 1 * LANE_WIDTH / 5280.0 epath . setLandmark ( epath . segment_dist / ( epath . segment_dist + distance_increase ) ) return epath end
Advance the B error by expanding samples from the last landmark to the
current point.
Advance the B error by expanding samples from the last landmark to the current point .
#Look for the nearest next intersection along the path, find the #expansion factor from the last landmark. #First find the last intersection, adding any path points that are encountered #that are not part of an intersection. #The addPoint function adjusts the distance to this node, stored in #the epath.progress variable, so we can check the distance increase #at the very end #Also need to back up at least one lane's width from the inersection since #we cannot stop in the middle of it. #Convert lane width in feet into miles (5280 feet in a mile) #Now set a landmark at this spot
epath
navigator