Skip to content

Feature: allow zero-length paths #2517

@Aposhian

Description

@Aposhian

Feature request

Allow planners to submit zero-length paths as valid paths that are trivially concatenated during ComputePlanThroughPoses.

Feature description

Currently, planners communicate failure to create a plan by returning a zero-length path from createPlan. This precludes the possibility of providing a goal that is the same pose as the starting position. That may seem like a nonsensical case to handle, but it actually comes up in real cases of using NavigateThroughPoses/ComputePlanThroughPoses.

Suppose you have a sequence of poses that represent a known maneuver you want a robot to complete. With the current implementation, if you get the robot so close to the starting position that it is an equivalent pose as far as the planner is concerned, the the first path segment will be a zero-length path. At this point, the planner server ceases to compute paths for subsequent goal poses.

For this situation, the workaround would be to retry the sequence, but without the first pose, but I believe this should work out of the box, and this quirk only exists because zero-length paths were chosen as a proxy for an error condition.

Implementation considerations

Instead of returning a Path from GlobalPlanner::createPlan, createPlan could either return an

  • std::error_code, while returning the Path by reference
  • Result type, which has the Path, or an error condition

Then all nav2_planners would have to have their error-handling logic to communicate errors with this new mechanism. While taking some significant refactoring, the benefit would be that, if desired, planners could propagate the actual error condition, rather than having a single error code of "zero-length path".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions