Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix random node and use yaml parameter" #26

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,9 @@ int main(int argc, char **argv)
// Planner config
auto planner_name = config["planner_name"].as<std::string>();
PlannerType planner = GetPlanner(planner_name);

// Visualizer config
auto rescale_factor = config["visualizer"]["rescale"].as<double>();
auto delay = config["visualizer"]["delay"].as<size_t>();

auto tree_visualizer = std::make_shared<tools::Visualizer>(
map, tools::pair_double{rescale_factor, rescale_factor}, delay,
"Tree Visualizer", planner_name);
map, tools::pair_double{2.0, 2.0}, 1u, "Tree Visualizer", planner_name);

// Path config
auto s = config["path"]["start"];
Expand Down
1 change: 0 additions & 1 deletion planning/grid_base/dfs/dfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Path DFS::FindPath(const Node &start_node, const Node &goal_node,

search_list.push(new_node_parent);
}
std::this_thread::sleep_for(std::chrono::microseconds(100));
}

if (search_list.empty())
Expand Down
20 changes: 12 additions & 8 deletions planning/tree_base/src/common_tree_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ std::pair<double, double> RandomSampling()

Node RandomNode(const std::shared_ptr<Map> map)
{
bool is_valid{false};
Node random_node;
auto random_point{RandomSampling()};
random_node = Node(static_cast<int>(random_point.first * map->GetHeight()),
static_cast<int>(random_point.second * map->GetWidth()));

while (!is_valid)
{
auto random_point{RandomSampling()};
random_node =
Node(static_cast<int>(random_point.first * map->GetHeight()),
static_cast<int>(random_point.second * map->GetWidth()));
if (map->GetNodeState(random_node) == NodeState::kFree)
{
is_valid = true;
}
}
return random_node;
}

Expand Down Expand Up @@ -187,10 +195,6 @@ WireNewNode(const int max_branch_length, const int min_branch_length,
{
return std::make_shared<NodeParent>(new_node, nearest_node, Cost{});
}
if (index == 0)
{
return std::nullptr_t();
}
auto isLengthValid{EuclideanDistance(ray[index - 1], nearest_node->node) >
min_branch_length};
auto isNodeValid{map->GetNodeState(ray[index]) != NodeState::kOccupied &&
Expand Down
Loading