mirte_lc_nav2.navigators module

class mirte_lc_nav2.navigators.CVTPath(node=None, resolution=0.1, n_seeds=30, n_iterations=20)

Bases: mirte_lc_nav2.navigator_types.SystematicNavigator

Waypoint planner based on Centroidal Voronoi Tessellation (CVT).

The planner: 1. Samples N seed points in free space. 2. Iterates Lloyd’s algorithm to converge to CVT centroids. 3. Solves a nearest-neighbor TSP over the centroids.

Reference: Cortes, Martinez, Karatas & Bullo, “Coverage Control for Mobile Sensing Networks”, IEEE Trans. Robotics and Automation, 2004.

namestr

Planner identifier.

n_seedsint

Number of Voronoi cells (waypoints).

n_iterationsint

Number of Lloyd iterations.

generate_path(start=None)
get_free_pixels()

Return pixel coordinates of all free cells in the costmap.

lloyd_iteration(seeds, free_pixels)

Run one Lloyd iteration: assign pixels to nearest seed, then move each seed to the centroid of its cell.

seeds : np.ndarray, shape (N, 2) free_pixels : np.ndarray, shape (M, 2)

np.ndarray

Updated seed positions.

name = 'CVTPlanner'
tsp_nearest_neighbor(points, start_idx=0)

Solve TSP with a nearest-neighbor heuristic.

points : np.ndarray, shape (N, 2) start_idx : int

np.ndarray

Points in visit order.

class mirte_lc_nav2.navigators.SkeletonPath(node=None, resolution=0.1)

Bases: mirte_lc_nav2.navigator_types.SystematicNavigator

Coverage planner based on skeletonization.

The planner: 1. Extracts the medial axis skeleton from free space. 2. Converts the skeleton into a graph. 3. Traverses the graph between leaf nodes.

namestr

Planner identifier.

find_nearest_leaf_node_along_path(current_node: int, leaf_nodes: list, graph: networkx.classes.graph.Graph) int

Find the nearest leaf node using graph distance.

current_nodeint

Current graph node.

leaf_nodeslist

Candidate leaf nodes.

graphnx.Graph

Navigation graph.

int

Nearest leaf node index.

generate_path(start=None)

Generate skeleton-based coverage trajectories.

startnp.ndarray | None, optional

Starting robot position.

None

get_path(source, target, graph) list

Compute the shortest path between two graph nodes.

sourceint

Start node.

targetint

Goal node.

graphnx.Graph

Navigation graph.

list

Ordered node indices.

name = 'SkeletonPlanner'
plan_path(start: numpy.ndarray, graph: networkx.classes.graph.Graph, waypoints: numpy.ndarray) numpy.ndarray

Generate a traversal path over the skeleton graph.

startnp.ndarray

Robot start position.

graphnx.Graph

Skeleton connectivity graph.

waypointsnp.ndarray

Waypoint coordinates.

np.ndarray

Ordered path coordinates.

read(plot=False) numpy.ndarray

Generate skeleton waypoints from polygon groups.

This function: - Rasterizes polygon contours - Computes the medial axis skeleton - Converts skeleton pixels to world coordinates

plotbool, optional

Unused visualization flag.

np.ndarray

Extracted waypoint groups.

class mirte_lc_nav2.navigators.SpanningTreePath(node=None, resolution=0.1, scale=0.06)

Bases: mirte_lc_nav2.navigator_types.SystematicNavigator

Coverage planner based on spanning-tree traversal.

The planner: 1. Downsamples the occupancy map. 2. Builds a spanning tree over free cells. 3. Generates traversal contours.

namestr

Planner identifier.

generate_path(start=None)

Generate coverage trajectories using spanning trees.

startnp.ndarray | None, optional

Starting robot position.

None

generate_waypoint_contours()

Generate contour regions around spanning-tree paths for circumnavigation.

None

get_waypoints(contour)

Convert contour pixels into world-coordinate waypoints.

name = 'SpanningTreePlanner'
plan_path(start: numpy.ndarray, graph: networkx.classes.graph.Graph, waypoints: numpy.ndarray) numpy.ndarray

Resample contour into evenly spaced path points.

read()
sample_map()

Downsample an occupancy map.

mapnp.ndarray

Occupancy map.

scalefloat

Scaling factor.

np.ndarray

Downsampled occupancy grid.

spanning_tree(grid)

Generate a spanning tree over free-space cells.

gridnp.ndarray

Binary occupancy grid.

None

subdivide(G)

Subdivide graph edges by inserting midpoint nodes.

Gnx.Graph

Input graph.

nx.Graph

Subdivided graph.

class mirte_lc_nav2.navigators.StraightLinePath(node=None, resolution=0.1, length=2.0)

Bases: mirte_lc_nav2.navigator_types.SystematicNavigator

Simple systematic planner that generates a straight-line trajectory.

The planner starts from a given pose and generates evenly spaced waypoints along a diagonal line.

namestr

Planner identifier.

lengthfloat

Total length of the generated line in meters.

start_posetuple

Starting pose in the form (x, y, yaw).

generate_path()

Generate a straight-line trajectory.

The path begins at self.start_pose and extends diagonally with waypoints separated by the configured resolution.

None

name = 'StraightLinePlanner'