Consider a ROS global planner using the A* algorithm on a grid map with obstacles. What will the planner output if a path exists?
Think about how A* uses heuristics and cost to find paths around obstacles.
A* finds the shortest path by exploring nodes with the lowest estimated total cost, avoiding obstacles by considering them as blocked nodes.
In a ROS global planner node, which message type should be used to publish the planned path?
The global plan is a sequence of poses representing the path.
The nav_msgs/Path message contains an array of poses representing the planned path for navigation.
Given this simplified Dijkstra planner snippet in ROS, why does it fail to find a path even though the map is free?
while (!open_list.empty()) {
current = open_list.top();
open_list.pop();
if (current == goal) break;
for (auto neighbor : getNeighbors(current)) {
if (visited[neighbor]) continue;
cost[neighbor] = cost[current] + 1;
open_list.push(neighbor);
}
}while (!open_list.empty()) { current = open_list.top(); open_list.pop(); if (current == goal) break; for (auto neighbor : getNeighbors(current)) { if (visited[neighbor]) continue; cost[neighbor] = cost[current] + 1; open_list.push(neighbor); } }
Check if nodes are marked visited after processing.
The code never marks nodes as visited after popping them, so nodes can be revisited endlessly or skipped incorrectly.
In a ROS Dijkstra global planner on a grid where each move costs 1, what is the cost value stored for the goal node after completion?
Think about what Dijkstra calculates as cost for each node.
Dijkstra calculates the minimum cost to reach each node; for the goal, this is the shortest path length in steps.
Consider the differences between A* and Dijkstra algorithms in ROS global planners. Why is A* usually preferred?
Think about how heuristics affect search efficiency.
A* uses heuristics to estimate distance to goal, focusing search and reducing computation compared to Dijkstra's exhaustive search.
