Skip to content

Commit

Permalink
merge NarrowGoal into NavGoal
Browse files Browse the repository at this point in the history
Signed-off-by: Daisuke Sato <[email protected]>
  • Loading branch information
daisukes committed Mar 19, 2024
1 parent 2f52b2f commit 5b8761a
Show file tree
Hide file tree
Showing 7 changed files with 349 additions and 271 deletions.
66 changes: 0 additions & 66 deletions cabot_bt/behavior_trees/navigate_w_replanning_and_recovery.xml

This file was deleted.

90 changes: 0 additions & 90 deletions cabot_bt/behavior_trees/navigation.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct CaBotPlannerOptions
int kdtree_max_results = 50;
int min_iteration_count = 500;
int max_iteration_count = 1000;
bool ignore_obstacles = false;

// private params
float iteration_scale_min = 0.0001;
Expand Down
16 changes: 15 additions & 1 deletion cabot_navigation2/plugins/cabot_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ void CaBotPlanner::configure(
rclcpp::ParameterValue(defaultValue.max_iteration_count));
node->get_parameter(name + ".max_iteration_count", options_.max_iteration_count);

declare_parameter_if_not_declared(
node, name + ".ignore_obstacles",
rclcpp::ParameterValue(defaultValue.ignore_obstacles));
node->get_parameter(name + ".ignore_obstacles", options_.ignore_obstacles);

declare_parameter_if_not_declared(node, name + ".static_layer_name", rclcpp::ParameterValue("static_layer"));
node->get_parameter(name + ".static_layer_name", static_layer_name_);

Expand Down Expand Up @@ -410,6 +415,9 @@ rcl_interfaces::msg::SetParametersResult CaBotPlanner::param_set_callback(const
if (param.get_name() == name_ + ".max_iteration_count") {
options_.max_iteration_count = param.as_int();
}
if (param.get_name() == name_ + ".ignore_obstacles") {
options_.ignore_obstacles = param.as_bool();
}

// private
if (param.get_name() == name_ + ".private.iteration_scale_min") {
Expand Down Expand Up @@ -532,8 +540,14 @@ nav_msgs::msg::Path CaBotPlanner::createPlan(CaBotPlannerParam & param)

int total_count = 0;
DetourMode modes[3] = {DetourMode::RIGHT, DetourMode::LEFT, DetourMode::IGNORE};
int i = 0;
if (param.options.ignore_obstacles) {
plans[0].okay = false;
plans[1].okay = false;
i = 2;
}
rclcpp::Rate r(1);
for (int i = 0; i < 3; i++) {
for (; i < 3; i++) {
CaBotPlan & plan = plans[i];
plan.detour_mode = modes[i];

Expand Down
27 changes: 17 additions & 10 deletions cabot_ui/cabot_ui/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# -*- coding: utf-8 -*-
import sys
import traceback
import enum
import copy
import math
import json
Expand Down Expand Up @@ -381,6 +382,20 @@ def copy(self):
return copy.deepcopy(self)


class NavigationMode(enum.Enum):
Standard = 0
Narrow = 1
Tight = 2

@classmethod
def get_mode(cls, width):
if width < 1.0:
return NavigationMode.Tight
if width < 1.2:
return NavigationMode.Narrow
return NavigationMode.Standard


class Link(Object):
"""Link class"""
ROUTE_TYPE_WALKWAY = 1
Expand All @@ -391,8 +406,6 @@ class Link(Object):
ROUTE_TYPE_STAIRS = 6
ROUTE_TYPE_SLOPE = 7
ROUTE_TYPE_UNKNOWN = 99
ROUTE_NARROW_PATH_THRESHOLD = 1.2
ROUTE_NARROW_ANNOUNCE_THRESHOLD = 1.0

@classmethod
def marshal(cls, dic):
Expand Down Expand Up @@ -445,14 +458,8 @@ def is_leaf(self):
return self.start_node.is_leaf or self.end_node.is_leaf

@property
def is_narrow(self):
"""wheather this links is narrow or not"""
return self.properties.hulop_road_width < Link.ROUTE_NARROW_PATH_THRESHOLD

@property
def need_narrow_announce(self):
"""wheather this links is narrow or not"""
return self.properties.hulop_road_width < Link.ROUTE_NARROW_ANNOUNCE_THRESHOLD
def navigation_mode(self):
return NavigationMode.get_mode(self.properties.hulop_road_width)

@property
def length(self):
Expand Down
Loading

0 comments on commit 5b8761a

Please sign in to comment.