From f5919882bd0d2e6be9c24c7335dae1f8dc227162 Mon Sep 17 00:00:00 2001 From: moscowsky Date: Mon, 22 Jun 2026 14:58:39 +0300 Subject: [PATCH] fix coords --- .gitignore | 1 + .../gen_locations_on_mesh_node.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/gen_locations_on_mesh/gen_locations_on_mesh/gen_locations_on_mesh_node.py b/gen_locations_on_mesh/gen_locations_on_mesh/gen_locations_on_mesh_node.py index 8bbf24c..2de4222 100644 --- a/gen_locations_on_mesh/gen_locations_on_mesh/gen_locations_on_mesh_node.py +++ b/gen_locations_on_mesh/gen_locations_on_mesh/gen_locations_on_mesh_node.py @@ -135,7 +135,7 @@ def gen_new_point(piece, trs, vs, existing_ps, dist_limit, vert_shift): # если после множества попыток это не получится, смиримся # и примем ту, что есть curr_trial = 0 - max_trials = 100 + max_trials = 500 while curr_trial < max_trials: # выбрать случайный треугольник tr_ind = random.randrange(len(piece)) @@ -153,6 +153,8 @@ def gen_new_point(piece, trs, vs, existing_ps, dist_limit, vert_shift): c2 = vs[ind2,:] p = c0 + (c1-c0)*alpha + (c2-c0)*beta p[2] += vert_shift + if p[2] > 1.: + continue # проверить совпадение координат с существующими точками succ = True for ep in existing_ps.values(): @@ -231,9 +233,12 @@ class GenLocationsOnMeshNode(Node): self.state_pub_msg.z = [] for l_id, p in self.existing_points.items(): self.state_pub_msg.location_id.append(l_id) - self.state_pub_msg.x.append(p[0]) - self.state_pub_msg.y.append(p[1]) - self.state_pub_msg.z.append(p[2]) + # self.state_pub_msg.x.append(p[0]) + # self.state_pub_msg.y.append(p[1]) + # self.state_pub_msg.z.append(p[2]) + self.state_pub_msg.x.append(-p[1] - 400.) + self.state_pub_msg.y.append(p[2]) + self.state_pub_msg.z.append(p[0] + 400.) # опубликовать их self.state_pub.publish(self.state_pub_msg)