Skip to content

ValidatePath

Checks to see if the global path is valid. If there is an obstacle along the path, it returns FAILURE, otherwise it returns SUCCESS. Optionally checks specific costmap layers and can use a custom footprint for validation.

Input Ports

path

Type: nav_msgs::msg::Path Default: N/A

The global path to check for validity.

max_cost

Type: unsigned int Default: 254

The maximum allowable cost for the path to be considered valid.

consider_unknown_as_obstacle

Type: bool Default: false

Whether to consider unknown cost (255) as obstacle.

layer_name

Type: string Default: ""

Name of the specific costmap layer to check against. If empty, checks against the full costmap.

footprint

Type: string Default: ""

Custom footprint specification as a bracketed array of arrays, e.g., "[[x1,y1],[x2,y2],...]". If empty, uses the robot's configured footprint.

stop_at_first_collision

Type: bool Default: true

Whether to stop validation at the first collision (true) or check all poses in the path (false). When false, all collision poses are reported.

max_lookahead_distance

Type: double Default: -1.0

Maximum distance ahead of the robot along the path to validate. When set to -1.0 (default), the full path is validated. A positive value limits validation to only the portion of the path within that distance from the robot's current position.

service_name

Type: string Default: N/A

Costmap service name responsible for getting the cost. If not specified, is_path_valid is used.

server_timeout

Type: chrono::milliseconds Default: N/A

Service server timeout (ms). If not provided, uses the BT Navigator's default_server_timeout parameter value (20 ms by default).

Output Ports

collision_poses

Type: vector<geometry_msgs::msg::PoseStamped> Default: N/A

Vector of poses in the path that are in collision or invalid. Empty if the path is valid.

Example

<ValidatePath
  server_timeout="10"
  path="{path}"
  max_cost="100"
  consider_unknown_as_obstacle="false"
  layer_name=""
  footprint=""
  stop_at_first_collision="true"
  collision_poses="{collision_poses}" />

<!-- With max_lookahead_distance: -->
<ValidatePath
  path="{path}"
  max_lookahead_distance="5.0"
  collision_poses="{collision_poses}" />

<!-- With custom footprint: -->
<ValidatePath
  path="{path}"
  footprint="[[0.5,0.5],[0.5,-0.5],[-0.5,-0.5],[-0.5,0.5]]"
  collision_poses="{collision_poses}" />

<!-- Checking a specific costmap layer: -->
<ValidatePath
  path="{path}"
  layer_name="obstacle_layer"
  stop_at_first_collision="false"
  collision_poses="{collision_poses}" />