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

adding the missing output from extend_towards_q in euclidean tree example #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions examples/euclidean_tree/euclidean_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ def compute_edge_cost(self, parent_node: Node, child_node: Node):
x_child = child_node.q
return np.linalg.norm(x_parent - x_child)

def extend_towards_q(self, node: Node, q: np.array):
if np.linalg.norm(q - node.q) < self.rrt_params.radius:
def extend_towards_q(self, parent_node: Node, q: np.array):
if np.linalg.norm(q - parent_node.q) < self.rrt_params.radius:
child_q = q
else:
child_q = node.q + self.rrt_params.radius * (
q - node.q
) / np.linalg.norm(q - node.q)
return Node(child_q)
child_q = parent_node.q + self.rrt_params.radius * (
q - parent_node.q
) / np.linalg.norm(q - parent_node.q)

child_node = Node(child_q)

edge = Edge()
edge.parent = parent_node
edge.child = child_node
edge.cost = self.compute_edge_cost(parent_node, child_node)

return child_node, edge

def calc_distance_batch(self, q_query: np.array):
q_batch = self.get_q_matrix_up_to()
Expand Down