route_network.planner

Route network path planner.

class route_network.planner.Edge(end, seg, heuristic=0.0)[source]

Edge stores graph edge data for a way point.

Parameters:
  • end – Index of ending way point.
  • seguuid_msgs/UniqueID of corresponding RouteSegment.
  • heuristic – Distance heuristic from start to end (must not be an over-estimate).
exception route_network.planner.NoPathToGoalError[source]

Exception raised when there is no path to the goal.

class route_network.planner.Planner(graph)[source]

Planner plans a route through a RouteNetwork.

Parameters:graphgeographic_msgs/RouteNetwork message.
static distance2D(utm1, utm2)[source]

Compute 2D Euclidean distance between two utm points.

Parameters:
  • utm1 (geodesy.utm.UTMPoint) – The first point.
  • utm2 (geodey.utm.UTMPoint) – The second point.
Returns:

Distance in meters within the UTM XY plane. Altitudes are ignored.

Return type:

float64

geo_path(req)[source]

Plan the shortest path between a start and a destination geopoint.

Unlike the ‘planner’ method, the ‘geo_path’ method can receive GeoPoints out of the graph, upon such a case, the nearest segments on the OSM map are detected, and the planning is carried out.

Pram req:The request message.
Parameters:req – geographic_msgs/GetGeoPath
Returns:The computed path, as well as the ids of the RouteNetwork and the start and end segments, plus the length of the path. The length is set to -1 in case of failure.
Return type:(geographic_msgs/GeoPoint[], uuid_msgs/UniqueID, uuid_msgs/UniqueID, uuid_msgs/UniqueID, length)
Raises:ValueError if invalid request.
getNearestSegment(geo_point, max_dist=500.0)[source]

Determine the nearest segment to the given point.

Parameters:
  • geo_point (geographic_msgs/GeoPoint) – The position.
  • max_dist (float) – The maximal allowed distance to segment.
Returns:

A tuple of the nearest segment, which has the minimum distance to given point, the distance to the segment and the perpendicular point.

Return type:

(geographic_msgs/RouteSegment, float, geodesy.utm.UTMPoint) or (None, None, None), if the distance of given point to start or end of the segment is greater then max_dist

getPerpendicularPoint2D(utm_start, utm_end, utm_p)[source]

Returns the orthongal projection of point utm_p onto a line segment (utm_start -> utm_end)

Parameters:
  • utm_start (geodesy.utm.UTMPoint) – The starting point of the line segment.
  • utm_end (geodesy.utm.UTMPoint) – The ending point of the line segment.
  • utm_p (geodesy.utm.UTMPoint) – The point.
Returns:

The orthogonal projection (cut point) if no errors, None otherwise.

Return type:

geodesy.utm.UTMPoint

planner(req)[source]

Plan route from start to goal.

Parameters:reqgeographic_msgs/GetRoutePlan request message.
Returns:geographic_msgs/RoutePath message.
Raises:ValueError if invalid request.
Raises:NoPathToGoalError if goal not reachable.
exception route_network.planner.PlannerError[source]

Base class for exceptions in this module.